# Add a name to a Computer

URL: https://heaven.dev/docs/reference/domains/add
Updated: 2026-11-21

Assign a custom hostname, apex domain or wildcard to a Computer's website. Heaven serves a new name after DNS verification and removes names that remain unverified for seven days. A name that serves the website uses the Computer's website access settings. Use `domain check` to see which DNS records the name needs.

`POST /v1/organization/domain/modify`

## Parameters

- `computer` (string, required): Computer name or ID.
- `domain` (string, required): Hostname, apex domain or wildcard you control, such as `www.example.com`, `example.com` or `*.example.com`. For `path`, give the existing website name.
- `port` (string): HTTP port inside the Computer for this hostname or path, from 1 to 65535 except the desktop port 6080. Omit to use the Computer's website port. Use only for a route without `redirect`.
- `redirect` (string): HTTPS destination for a redirect from this name. Supply the URL or hostname. Use only when both `port` and `path` are omitted. The redirect runs before the Computer's website access check.
- `path` (string): Path prefix such as `/api` on an already verified website name in the same organization. Routes that part of the website to another Computer. Use `strip_prefix: true` to remove the prefix before forwarding.
- `strip_prefix` (boolean): Remove the path prefix before forwarding. For example, with `path` `/api`, the Computer receives `/users` for `/api/users`. Requires `path`.

## Returns

- `data` (object, always present): A saved domain assignment or removal.
  - `also` (string[]): Other names changed with this one, such as www. May be omitted.
  - `computer` (string, always present): Computer associated with the change.
  - `domain` (string, always present): Affected domain name.
  - `moved_from` (string): Computer that previously held the name. May be omitted.
  - `path` (string): Affected path prefix, for a path route. May be omitted.
  - `port` (integer): Selected guest port, when explicitly set. May be omitted.
  - `redirect` (string): Configured redirect destination. May be omitted.
  - `removed` (boolean): Whether the assignment was removed. May be omitted.
  - `setup` (object): DNS check explaining what remains to be configured. May be omitted.
    - `certificate` (object): Certificate check for a configured name whose DNS is correct. May be omitted.
      - `message` (string, always present): An explanation of the certificate check.
      - `state` (string, always present): Whether the certificate is ready or still needs attention.
    - `code` (string): First problem that needs correction. May be omitted.
    - `computer` (string): Organization's Computer currently using this name. May be omitted.
    - `domain` (string, always present): Registrable domain containing the name.
    - `kind` (string, always present): Whether the check concerns an ordinary name, root domain or wildcard.
    - `message` (string): What to change to make the name work. May be omitted.
    - `name` (string, always present): Full name being checked.
    - `one_click_url` (string): A provider page that can add the required records, when supported. May be omitted.
    - `optional` (object[]): Suggested additional records, such as a root domain's www name. May be omitted.
      - `items` (object): One DNS record needed for routing or ownership proof.
        - `found` (string): What DNS returned when it differed from the expected value. May be omitted.
        - `name` (string, always present): DNS name where the record belongs.
        - `one_click_url` (string): DNS provider's page for adding this record, when available. May be omitted.
        - `purpose` (string, always present): Whether the record establishes routing or proves ownership.
        - `state` (string, always present): DNS-check result. `proxied` requires turning off Cloudflare's proxy for this record.
        - `type` (string, always present): DNS record type to create.
        - `value` (string, always present): Value the record should contain.
    - `proof` (string): How ownership was proved, such as a CNAME or TXT record. May be omitted.
    - `provider` (object): Detected DNS provider and where to edit its records. May be omitted.
      - `id` (string, always present): Provider identifier.
      - `name` (string, always present): Provider's display name.
      - `records_url` (string): Provider page for editing DNS records. May be omitted.
      - `root_record` (string): Provider's supported record form for a root domain. May be omitted.
    - `proxied` (boolean): Whether Cloudflare's proxy is in front of the name. May be omitted.
    - `records` (object[] | null, always present): Required DNS records and what the check found.
      - `items` (object): One DNS record needed for routing or ownership proof.
        - `found` (string): What DNS returned when it differed from the expected value. May be omitted.
        - `name` (string, always present): DNS name where the record belongs.
        - `one_click_url` (string): DNS provider's page for adding this record, when available. May be omitted.
        - `purpose` (string, always present): Whether the record establishes routing or proves ownership.
        - `state` (string, always present): DNS-check result. `proxied` requires turning off Cloudflare's proxy for this record.
        - `type` (string, always present): DNS record type to create.
        - `value` (string, always present): Value the record should contain.
    - `state` (string, always present): Overall DNS-check result.
    - `target` (string, always present): Organization's DNS destination.
    - `whole` (boolean): Whether the parent domain's DNS already routes this name. May be omitted.
  - `updated` (boolean, always present): Whether the assignment was updated.
  - `waiting` (boolean): Whether DNS proof is pending. The saved name serves only after proof succeeds. May be omitted.

## Errors

Each code is explained in full at https://heaven.dev/docs/reference/errors.

| Code | Status | What happened |
|---|---:|---|
| `invalid` | 400 | An input is missing or invalid. |
| `unauthenticated` | 401 | The credential is missing, invalid, expired or revoked. |
| `denied` | 403 | The caller lacks permission for this action. |
| `not_found` | 404 | The resource is absent or inaccessible to this caller. |
| `conflict` | 409 | The request conflicts with the current resource state or an earlier request. |
| `over_capacity` | 409 | The request exceeds a resource or credential allowance. |
| `access_list_full` | 409 | The change would exceed the access-list allowance. |
| `payment_required` | 402 | Payment or credit is required. |
| `rate_limited` | 429 | The caller's request rate exceeds its limit. |
| `busy` | 429 | Too much work is in progress to accept this request. |
| `unknown` | 503 | The outcome is unconfirmed; a change may have happened. |
| `unavailable` | 503 | The service or requested feature is unavailable. |

## Notes

- API key permission: `domain add`.

## Examples

```sh tab="heaven CLI"
heaven domain add COMPUTER DOMAIN
  [--port PORT]
  [--redirect URL]
  [--path PATH]
  [--strip-prefix]
```

```sh tab="SSH"
ssh cli@heaven.dev domain add COMPUTER DOMAIN
  [--port PORT]
  [--redirect URL]
  [--path PATH]
  [--strip-prefix]
```

```sh tab="cURL"
curl https://heaven.dev/v1/organization/domain/modify \
  -H "Authorization: Bearer $HEAVEN_API_KEY" \
  --json '{"action": "add", "computer": "my-site", "domain": "app.example.com"}'
```

```json tab="MCP"
{ "tool": "domain_add",
  "arguments": { "computer": "my-site", "domain": "app.example.com" } }
```

Response:

```json title="Response excerpt"
{
  "version": 1,
  "data": {
    "computer": "my-site",
    "domain": "app.example.com",
    "updated": true
  }
}
```
