---
title: "Domains"
description: "Account-owned mail domains, DNS records, verification and setup."
url: https://doorman.fyi/docs/reference/domains
markdown: https://doorman.fyi/docs/reference/domains.md
area: "API reference"
section: "API reference"
---

# Domains

Account-owned mail domains, DNS records, verification and setup.

Source: https://doorman.fyi/docs/reference/domains

## List custom domains

`GET /v1/domains`

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`.

The account's active custom domains and their DNS records. Reading remains available when the transport is disabled.

OAuth: not available to delegated app tokens.

Also available as [`client.domains.list`](https://doorman.fyi/docs/sdk/reference/domains.md#domains-list) in TypeScript, [`client.domains.list`](https://doorman.fyi/docs/python/reference/domains.md#domains-list) in Python, the [`domains_list`](https://doorman.fyi/docs/mcp/tools/domains.md#domains-list) tool and [`doorman domains list`](https://doorman.fyi/docs/cli/commands/domains.md#domains-list) on the command line.

Organizations: every member's console session may call it. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

Answers `200`: The custom domains.

**Response 200: DomainList**
The account's active custom domains.
- `data` (Domain[])

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `forbidden` | The key is scoped to one inbox and cannot manage inboxes, keys or webhooks, or cannot read account-wide data. |
| 403 | `insufficient_scope` | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |

curl:
```sh
curl -s "https://api.doorman.fyi/v1/domains" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/domains", {
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
  },
  redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.get(
    "https://api.doorman.fyi/v1/domains",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Add a custom domain

`POST /v1/domains`

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`.

Creates the domain at the configured mail transport and returns its DNS records. Requires a paid plan; every plan has a ceiling of 50 active domains, and an account may add 20 domains per 24 hours. No inbox can be created on the domain until it verifies, and a domain that has not verified 7 days after it was added is removed (see `expiresAt`), which frees its name. A name another account holds, here or at the mail transport, answers 409 `already_exists`.

OAuth: not available to delegated app tokens.

Also available as [`client.domains.create`](https://doorman.fyi/docs/sdk/reference/domains.md#domains-create) in TypeScript, [`client.domains.create`](https://doorman.fyi/docs/python/reference/domains.md#domains-create) in Python, the [`domains_create`](https://doorman.fyi/docs/mcp/tools/domains.md#domains-create) tool and [`doorman domains create`](https://doorman.fyi/docs/cli/commands/domains.md#domains-create) on the command line.

Organizations: a member's console session needs `domains:manage`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Request body (application/json): CreateDomain**
A domain to connect. A subdomain avoids replacing an existing apex mailbox service.
- `name` (string): Trimmed, lowercased and validated as a domain by the Worker. Example: `agents.example.com`

Answers `201`: The domain and its records.

**Response 201: Domain**
An account's custom mail domain. Only verified domains can issue inboxes; one that never verifies is removed at `expiresAt`.
- `id` (string): A custom domain identifier. Example: `dom_01jc5f1a2b3c4d5e6f7g8h9j0k`
- `name` (string)
- `status` ("pending" | "verified" | "failed")
- `transport` ("resend")
- `records` (DomainRecord[])
- `connect` (object)
  - `available` (boolean)
  - `setupType` ("automatic" | "manual" | null)
  - `propagationStatus` ("pending" | "success" | "failed" | null)
  - `provider` (string | null)
- `inboxes` (integer)
- `verifiedAt` (string (date-time) | null)
- `expiresAt` (string (date-time) | null): When the domain is removed and its name freed, unless it verifies first. Null for a domain that has verified, which is never removed this way.
- `lastCheckedAt` (string (date-time) | null)
- `createdAt` (string (date-time)) Example: `2026-11-05T10:05:00.000Z`
- `updatedAt` (string (date-time)) Example: `2026-11-05T10:05:00.000Z`

Example 201 response:
```json
{
  "id": "dom_01jc5f1a2b3c4d5e6f7g8h9j0k",
  "name": "agents.example.com",
  "status": "pending",
  "transport": "resend",
  "records": [],
  "connect": {
    "available": false,
    "setupType": null,
    "propagationStatus": null,
    "provider": null
  },
  "inboxes": 0,
  "verifiedAt": null,
  "expiresAt": "2026-11-12T10:05:00.000Z",
  "lastCheckedAt": null,
  "createdAt": "2026-11-05T10:05:00.000Z",
  "updatedAt": "2026-11-05T10:05:00.000Z"
}
```

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 400 | `validation_error` | A field is missing or invalid; the message names it. |
| 400 | `invalid_json` | The request body is not JSON. |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 402 | `plan_limit_reached` | The plan's allowance is used up; `scope` says whether it is the inbox count, the monthly sends or the custom domains. Upgrade rather than wait. |
| 403 | `forbidden` | The key is scoped to one inbox and cannot manage inboxes, keys or webhooks, or cannot read account-wide data. |
| 403 | `insufficient_scope` | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `permission_denied` | The signed-in member's role in the organization lacks a permission the operation needs; `permission` names it. An admin of the organization can do it, or change the member's role. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 409 | `limit_reached` | The abuse ceiling for inboxes, custom domains, keys, endpoints, services, relying parties, the services an address signs in to, the sends an inbox has waiting for its owner or the invitations an organization has open; delete, revoke or decide one first. |
| 409 | `already_exists` | The mailbox name or the `externalId` is already in use (`field` says which), or another account holds the custom domain, here or at the mail transport. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 429 | `rate_limit_exceeded` | A per-inbox or per-account rate limit; `Retry-After` and `resetsAt` say when to try again. |
| 500 | `internal_error` | Something went wrong on the server. |
| 502 | `provider_unavailable` | The mail transport, the DNS setup provider or the payment provider did not answer, or refused this deployment's credentials. |
| 503 | `custom_domains_unavailable` | The custom-domain mail transport and inbound webhook are not fully configured. |

curl:
```sh
curl -s -X POST "https://api.doorman.fyi/v1/domains" \
  -H "authorization: Bearer $DOORMAN_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "name": "agents.example.com"
  }'
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/domains", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
    "content-type": "application/json",
  },
  redirect: "manual", credentials: "omit",
  body: JSON.stringify({
    "name": "agents.example.com"
  }),
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.post(
    "https://api.doorman.fyi/v1/domains",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    json={
        "name": "agents.example.com",
    },
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Read a custom domain

`GET /v1/domains/{domainId}`

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`.

One live custom domain belonging to the account; another account's domain is a 404.

OAuth: not available to delegated app tokens.

Also available as [`client.domains.get`](https://doorman.fyi/docs/sdk/reference/domains.md#domains-get) in TypeScript, [`client.domains.get`](https://doorman.fyi/docs/python/reference/domains.md#domains-get) in Python, the [`domains_get`](https://doorman.fyi/docs/mcp/tools/domains.md#domains-get) tool and [`doorman domains get`](https://doorman.fyi/docs/cli/commands/domains.md#domains-get) on the command line.

Organizations: every member's console session may call it. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domainId` | path | `string` | yes | The custom domain. Example: `dom_01jc5f1a2b3c4d5e6f7g8h9j0k`. |

Answers `200`: The domain and its records.

**Response 200: Domain**
An account's custom mail domain. Only verified domains can issue inboxes; one that never verifies is removed at `expiresAt`.
- `id` (string): A custom domain identifier. Example: `dom_01jc5f1a2b3c4d5e6f7g8h9j0k`
- `name` (string)
- `status` ("pending" | "verified" | "failed")
- `transport` ("resend")
- `records` (DomainRecord[])
- `connect` (object)
  - `available` (boolean)
  - `setupType` ("automatic" | "manual" | null)
  - `propagationStatus` ("pending" | "success" | "failed" | null)
  - `provider` (string | null)
- `inboxes` (integer)
- `verifiedAt` (string (date-time) | null)
- `expiresAt` (string (date-time) | null): When the domain is removed and its name freed, unless it verifies first. Null for a domain that has verified, which is never removed this way.
- `lastCheckedAt` (string (date-time) | null)
- `createdAt` (string (date-time)) Example: `2026-11-05T10:05:00.000Z`
- `updatedAt` (string (date-time)) Example: `2026-11-05T10:05:00.000Z`

Example 200 response:
```json
{
  "id": "dom_01jc5f1a2b3c4d5e6f7g8h9j0k",
  "name": "agents.example.com",
  "status": "pending",
  "transport": "resend",
  "records": [],
  "connect": {
    "available": false,
    "setupType": null,
    "propagationStatus": null,
    "provider": null
  },
  "inboxes": 0,
  "verifiedAt": null,
  "expiresAt": "2026-11-12T10:05:00.000Z",
  "lastCheckedAt": null,
  "createdAt": "2026-11-05T10:05:00.000Z",
  "updatedAt": "2026-11-05T10:05:00.000Z"
}
```

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `forbidden` | The key is scoped to one inbox and cannot manage inboxes, keys or webhooks, or cannot read account-wide data. |
| 403 | `insufficient_scope` | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | `not_found` | No such resource for this caller, or no such route. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |

curl:
```sh
curl -s "https://api.doorman.fyi/v1/domains/dom_01jc5f1a2b3c4d5e6f7g8h9j0k" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/domains/dom_01jc5f1a2b3c4d5e6f7g8h9j0k", {
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
  },
  redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.get(
    "https://api.doorman.fyi/v1/domains/dom_01jc5f1a2b3c4d5e6f7g8h9j0k",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Check the domain's DNS

`POST /v1/domains/{domainId}/verify`

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`.

Asks the mail transport to verify the required records, then returns the current status. Verification is asynchronous; repeated requests are rate limited.

OAuth: not available to delegated app tokens.

Also available as [`client.domains.verify`](https://doorman.fyi/docs/sdk/reference/domains.md#domains-verify) in TypeScript, [`client.domains.verify`](https://doorman.fyi/docs/python/reference/domains.md#domains-verify) in Python, the [`domains_verify`](https://doorman.fyi/docs/mcp/tools/domains.md#domains-verify) tool and [`doorman domains verify`](https://doorman.fyi/docs/cli/commands/domains.md#domains-verify) on the command line.

Organizations: a member's console session needs `domains:manage`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domainId` | path | `string` | yes | The custom domain. Example: `dom_01jc5f1a2b3c4d5e6f7g8h9j0k`. |

Answers `202`: The domain's current verification state.

**Response 202: Domain**
An account's custom mail domain. Only verified domains can issue inboxes; one that never verifies is removed at `expiresAt`.
- `id` (string): A custom domain identifier. Example: `dom_01jc5f1a2b3c4d5e6f7g8h9j0k`
- `name` (string)
- `status` ("pending" | "verified" | "failed")
- `transport` ("resend")
- `records` (DomainRecord[])
- `connect` (object)
  - `available` (boolean)
  - `setupType` ("automatic" | "manual" | null)
  - `propagationStatus` ("pending" | "success" | "failed" | null)
  - `provider` (string | null)
- `inboxes` (integer)
- `verifiedAt` (string (date-time) | null)
- `expiresAt` (string (date-time) | null): When the domain is removed and its name freed, unless it verifies first. Null for a domain that has verified, which is never removed this way.
- `lastCheckedAt` (string (date-time) | null)
- `createdAt` (string (date-time)) Example: `2026-11-05T10:05:00.000Z`
- `updatedAt` (string (date-time)) Example: `2026-11-05T10:05:00.000Z`

Example 202 response:
```json
{
  "id": "dom_01jc5f1a2b3c4d5e6f7g8h9j0k",
  "name": "agents.example.com",
  "status": "pending",
  "transport": "resend",
  "records": [],
  "connect": {
    "available": false,
    "setupType": null,
    "propagationStatus": null,
    "provider": null
  },
  "inboxes": 0,
  "verifiedAt": null,
  "expiresAt": "2026-11-12T10:05:00.000Z",
  "lastCheckedAt": null,
  "createdAt": "2026-11-05T10:05:00.000Z",
  "updatedAt": "2026-11-05T10:05:00.000Z"
}
```

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `forbidden` | The key is scoped to one inbox and cannot manage inboxes, keys or webhooks, or cannot read account-wide data. |
| 403 | `insufficient_scope` | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `permission_denied` | The signed-in member's role in the organization lacks a permission the operation needs; `permission` names it. An admin of the organization can do it, or change the member's role. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | `not_found` | No such resource for this caller, or no such route. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 429 | `rate_limit_exceeded` | A per-inbox or per-account rate limit; `Retry-After` and `resetsAt` say when to try again. |
| 500 | `internal_error` | Something went wrong on the server. |
| 502 | `provider_unavailable` | The mail transport, the DNS setup provider or the payment provider did not answer, or refused this deployment's credentials. |
| 503 | `custom_domains_unavailable` | The custom-domain mail transport and inbound webhook are not fully configured. |

curl:
```sh
curl -s -X POST "https://api.doorman.fyi/v1/domains/dom_01jc5f1a2b3c4d5e6f7g8h9j0k/verify" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/domains/dom_01jc5f1a2b3c4d5e6f7g8h9j0k/verify", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
  },
  redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.post(
    "https://api.doorman.fyi/v1/domains/dom_01jc5f1a2b3c4d5e6f7g8h9j0k/verify",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Start automatic DNS setup

`POST /v1/domains/{domainId}/connect-session`

Access `session`: a console session only; an API key gets 403 `session_required`.

A console-only, short-lived DNS setup token and the records to publish. Provider secrets never leave the Worker.

OAuth: not available to delegated app tokens.

Also available as [`client.domains.connectSession`](https://doorman.fyi/docs/sdk/reference/domains.md#domains-connectSession) in TypeScript and [`client.domains.connect_session`](https://doorman.fyi/docs/python/reference/domains.md#domains-connectSession) in Python.

Organizations: a member's console session needs `domains:manage`. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domainId` | path | `string` | yes | The custom domain. Example: `dom_01jc5f1a2b3c4d5e6f7g8h9j0k`. |

Answers `200`: The short-lived setup session.

**Response 200: DomainConnectSession**
A short-lived DNS setup token and records, returned to the console only.
- `applicationId` (string)
- `token` (string)
- `prefilledDomain` (string)
- `userId` (string)
- `dnsRecords` (object)
  - `domain` (object[], optional)
    - `type` (string)
    - `host` (string)
    - `value` (string)
    - `ttl` (integer)
    - `priority` (integer, optional)
    - `optional` (boolean, optional)
  - `subDomain` (object[], optional)
    - `type` (string)
    - `host` (string)
    - `value` (string)
    - `ttl` (integer)
    - `priority` (integer, optional)
    - `optional` (boolean, optional)

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `forbidden` | The key is scoped to one inbox and cannot manage inboxes, keys or webhooks, or cannot read account-wide data. |
| 403 | `session_required` | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `permission_denied` | The signed-in member's role in the organization lacks a permission the operation needs; `permission` names it. An admin of the organization can do it, or change the member's role. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | `not_found` | No such resource for this caller, or no such route. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |
| 502 | `provider_unavailable` | The mail transport, the DNS setup provider or the payment provider did not answer, or refused this deployment's credentials. |
| 503 | `custom_domains_unavailable` | The custom-domain mail transport and inbound webhook are not fully configured. |
| 503 | `connect_unavailable` | Automatic DNS setup is not configured; publish the records manually. |

curl:
```sh
curl -s -X POST "https://api.doorman.fyi/v1/domains/dom_01jc5f1a2b3c4d5e6f7g8h9j0k/connect-session" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/domains/dom_01jc5f1a2b3c4d5e6f7g8h9j0k/connect-session", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
  },
  redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.post(
    "https://api.doorman.fyi/v1/domains/dom_01jc5f1a2b3c4d5e6f7g8h9j0k/connect-session",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Remove a custom domain

`DELETE /v1/domains/{domainId}`

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`.

Removes the domain and its inboxes, revokes their keys and closes their streams. Removal at the mail transport is queued.

OAuth: not available to delegated app tokens.

Also available as [`client.domains.delete`](https://doorman.fyi/docs/sdk/reference/domains.md#domains-delete) in TypeScript, [`client.domains.delete`](https://doorman.fyi/docs/python/reference/domains.md#domains-delete) in Python, the [`domains_delete`](https://doorman.fyi/docs/mcp/tools/domains.md#domains-delete) tool and [`doorman domains delete`](https://doorman.fyi/docs/cli/commands/domains.md#domains-delete) on the command line.

Organizations: a member's console session needs `domains:manage`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domainId` | path | `string` | yes | The custom domain. Example: `dom_01jc5f1a2b3c4d5e6f7g8h9j0k`. |

Answers `204`: Removed.

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `forbidden` | The key is scoped to one inbox and cannot manage inboxes, keys or webhooks, or cannot read account-wide data. |
| 403 | `insufficient_scope` | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `permission_denied` | The signed-in member's role in the organization lacks a permission the operation needs; `permission` names it. An admin of the organization can do it, or change the member's role. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | `not_found` | No such resource for this caller, or no such route. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |

curl:
```sh
curl -s -X DELETE "https://api.doorman.fyi/v1/domains/dom_01jc5f1a2b3c4d5e6f7g8h9j0k" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/domains/dom_01jc5f1a2b3c4d5e6f7g8h9j0k", {
  method: "DELETE",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
  },
  redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
// 204: nothing to read.
```

Python:
```python
import os
import requests

response = requests.delete(
    "https://api.doorman.fyi/v1/domains/dom_01jc5f1a2b3c4d5e6f7g8h9j0k",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
# 204: nothing to read.
```
