---
title: "Platform API: Sending domain"
description: "Get the sending domain, set the sending domain, or remove the sending domain, with the Agentpost API."
url: "https://agentpost.tools/docs/platform/reference/sending-domain"
kind: reference
---

# Sending domain

A project’s email, sign-in codes included, comes from a domain it verified; until one verifies, it sends none, except to a `dev` environment’s test inbox. Add the domain, then add the DNS records the answer lists. Agentpost checks every 5 minutes for the first hour, then hourly, for up to 72 hours, and emails the workspace’s owners when the domain verifies or fails. A domain belongs to the first workspace that adds it; if it fails to verify, another workspace may add it.

Paths are from `https://api.agentpost.tools`, and every route follows the [API basics](/docs/platform/api-basics.md). The examples send the first credential the route takes; [Credentials](/docs/platform/concepts/credentials.md) explains each one.

## Get the sending domain

`GET /v1/projects/{id}/sending-domain`

The project’s sending domain and the sender in force. A pending domain is checked again first, so polling this shows when it verifies.

-   **Who may call:** A member of the workspace, with its API key; a member of the workspace, with its session; or a delegate, with its delegated token.
-   **Access:** The caller holds `apoa.project:view` in the project’s workspace.
-   **Credential:** the examples send your API key, `agp_ak_apoa_…`, as `Authorization: Bearer <token>`.

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | A project ID, `prj_…`. The `id` of a [`Project`](/docs/platform/reference/projects.md#the-project-object). |

### Response

`200 OK`, with [`SendingDomainState`](/docs/platform/reference/sending-domain.md#the-sendingdomainstate-object).

### Errors

-   [`forbidden`](/docs/errors.md#forbidden) (403)
-   [`not_found`](/docs/errors.md#not_found) (404)
-   [`unavailable`](/docs/errors.md#unavailable) (503)

Any operation can also answer with the codes [Conventions](/docs/platform/reference.md#conventions) lists.

```bash tab="curl"
curl https://api.agentpost.tools/v1/projects/prj_01JDKYC5RZKAFFK3K2ENNC1ZTK/sending-domain \
  -H "Authorization: Bearer agp_ak_apoa_…"
```

```json title="Response"
{
  "projectId": "prj_01JDKYC5RZKAFFK3K2ENNC1ZTK",
  "sendingDomain": {
    "domain": "example.com",
    "address": "no-reply@example.com",
    "status": "pending",
    "waitingOn": ["DKIM is PENDING"],
    "records": [
      {
        "type": "CNAME",
        "name": "abc123._domainkey.example.com",
        "value": "abc123.dkim.amazonses.com"
      },
      {
        "type": "MX",
        "name": "mail.example.com",
        "value": "10 feedback-smtp.us-east-2.amazonses.com"
      },
      {
        "type": "TXT",
        "name": "mail.example.com",
        "value": "v=spf1 include:amazonses.com ~all"
      }
    ],
    "recommended": [
      {
        "type": "TXT",
        "name": "_dmarc.example.com",
        "value": "v=DMARC1; p=none;"
      }
    ],
    "requestedAt": "2026-11-13T09:30:00.000Z",
    "checkedAt": "2026-11-13T09:30:00.000Z",
    "nextCheckAt": "2026-11-13T09:35:00.000Z"
  },
  "sender": null
}
```

## Set the sending domain

`PUT /v1/projects/{id}/sending-domain`

Adds a domain to send from, or changes the address. The answer lists the DNS records to add. While a new domain is pending, the current sender keeps sending.

-   **Who may call:** A member of the workspace, with its API key; a member of the workspace, with its session; or a delegate, with its delegated token.
-   **Access:** The caller holds `apoa.project:update` in the project’s workspace.
-   **Credential:** the examples send your API key, `agp_ak_apoa_…`, as `Authorization: Bearer <token>`.

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | A project ID, `prj_…`. The `id` of a [`Project`](/docs/platform/reference/projects.md#the-project-object). |

### Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `domain` | `string` | Yes | Such as `example.com`. |
| `address` | `string` | No | At the domain. Default `no-reply@<domain>`. |

### Response

`200 OK`, with [`SendingDomainState`](/docs/platform/reference/sending-domain.md#the-sendingdomainstate-object).

### Errors

-   [`conflict`](/docs/errors.md#conflict) (409)
-   [`forbidden`](/docs/errors.md#forbidden) (403)
-   [`not_found`](/docs/errors.md#not_found) (404)
-   [`unavailable`](/docs/errors.md#unavailable) (503)

Any operation can also answer with the codes [Conventions](/docs/platform/reference.md#conventions) lists.

```bash tab="curl"
curl -X PUT https://api.agentpost.tools/v1/projects/prj_01JDKYC5RZKAFFK3K2ENNC1ZTK/sending-domain \
  -H "Authorization: Bearer agp_ak_apoa_…" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "example.com"
  }'
```

```json title="Response"
{
  "projectId": "prj_01JDKYC5RZKAFFK3K2ENNC1ZTK",
  "sendingDomain": {
    "domain": "example.com",
    "address": "no-reply@example.com",
    "status": "pending",
    "waitingOn": ["DKIM is PENDING"],
    "records": [
      {
        "type": "CNAME",
        "name": "abc123._domainkey.example.com",
        "value": "abc123.dkim.amazonses.com"
      },
      {
        "type": "MX",
        "name": "mail.example.com",
        "value": "10 feedback-smtp.us-east-2.amazonses.com"
      },
      {
        "type": "TXT",
        "name": "mail.example.com",
        "value": "v=spf1 include:amazonses.com ~all"
      }
    ],
    "recommended": [
      {
        "type": "TXT",
        "name": "_dmarc.example.com",
        "value": "v=DMARC1; p=none;"
      }
    ],
    "requestedAt": "2026-11-13T09:30:00.000Z",
    "checkedAt": "2026-11-13T09:30:00.000Z",
    "nextCheckAt": "2026-11-13T09:35:00.000Z"
  },
  "sender": null
}
```

## Remove the sending domain

`DELETE /v1/projects/{id}/sending-domain`

Removes the sending domain. The project sends no email, sign-in codes included, until another domain verifies, so it needs the domain as confirmation.

-   **Who may call:** A member of the workspace, with its API key; a member of the workspace, with its session; or a delegate, with its delegated token.
-   **Access:** The caller holds `apoa.project:update` in the project’s workspace.
-   **Credential:** the examples send your API key, `agp_ak_apoa_…`, as `Authorization: Bearer <token>`.

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | A project ID, `prj_…`. The `id` of a [`Project`](/docs/platform/reference/projects.md#the-project-object). |

### Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `confirm` | `string` | Yes | The domain. |

### Response

`200 OK`, with [`SendingDomainState`](/docs/platform/reference/sending-domain.md#the-sendingdomainstate-object).

### Errors

-   [`confirmation_required`](/docs/errors.md#confirmation_required) (400)
-   [`forbidden`](/docs/errors.md#forbidden) (403)
-   [`not_found`](/docs/errors.md#not_found) (404)
-   [`unavailable`](/docs/errors.md#unavailable) (503)

Any operation can also answer with the codes [Conventions](/docs/platform/reference.md#conventions) lists.

```bash tab="curl"
curl -X DELETE https://api.agentpost.tools/v1/projects/prj_01JDKYC5RZKAFFK3K2ENNC1ZTK/sending-domain \
  -H "Authorization: Bearer agp_ak_apoa_…" \
  -H "Content-Type: application/json" \
  -d '{
    "confirm": "example.com"
  }'
```

```json title="Response"
{
  "projectId": "prj_01JDKYC5RZKAFFK3K2ENNC1ZTK",
  "sendingDomain": null,
  "sender": null
}
```

## The SendingDomainState object

A project’s sending domain, and the sender in force, which stays the old one until a new domain verifies.

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `projectId` | `string` | Always |  |
| `sendingDomain` | [`SendingDomain`](/docs/platform/reference/sending-domain.md#the-sendingdomain-object) or `null` | Always | `null` when the project asked for none. |
| `sender` | `object` or `null` | Always | Where the project’s email comes from now. `null` when it sends none in production. |

```json title="The SendingDomainState object"
{
  "projectId": "prj_01JDKYC5RZKAFFK3K2ENNC1ZTK",
  "sendingDomain": {
    "domain": "example.com",
    "address": "no-reply@example.com",
    "status": "pending",
    "waitingOn": ["DKIM is PENDING"],
    "records": [
      {
        "type": "CNAME",
        "name": "abc123._domainkey.example.com",
        "value": "abc123.dkim.amazonses.com"
      },
      {
        "type": "MX",
        "name": "mail.example.com",
        "value": "10 feedback-smtp.us-east-2.amazonses.com"
      },
      {
        "type": "TXT",
        "name": "mail.example.com",
        "value": "v=spf1 include:amazonses.com ~all"
      }
    ],
    "recommended": [
      {
        "type": "TXT",
        "name": "_dmarc.example.com",
        "value": "v=DMARC1; p=none;"
      }
    ],
    "requestedAt": "2026-11-13T09:30:00.000Z",
    "checkedAt": "2026-11-13T09:30:00.000Z",
    "nextCheckAt": "2026-11-13T09:35:00.000Z"
  },
  "sender": null
}
```

## The SendingDomain object

The domain a project asked to send email from.

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `domain` | `string` | Always |  |
| `address` | `string` | Always | The address email comes from. |
| `status` | `string` | Always | One of `"pending"`, `"verified"`, or `"failed"`. |
| `waitingOn` | `string[]` | Always | What Agentpost still waits on, in words. Empty unless pending. |
| `failure` | `string` | When set | Why it failed, and what to do. |
| `records` | [`DnsRecord`](/docs/platform/reference/sending-domain.md#the-dnsrecord-object) array | Always | Add every one; verification waits on them all. |
| `recommended` | [`DnsRecord`](/docs/platform/reference/sending-domain.md#the-dnsrecord-object) array | Always | Records that help delivery but that nothing waits on, such as DMARC when the domain has none. |
| `requestedAt` | `string` | Always | An ISO 8601 date and time. |
| `checkedAt` | `string` | When set | An ISO 8601 date and time. |
| `nextCheckAt` | `string` | When set | When Agentpost checks again. Set only while pending. |
| `verifiedAt` | `string` | When set | An ISO 8601 date and time. |

```json title="The SendingDomain object"
{
  "domain": "example.com",
  "address": "no-reply@example.com",
  "status": "pending",
  "waitingOn": ["DKIM is PENDING"],
  "records": [
    {
      "type": "CNAME",
      "name": "abc123._domainkey.example.com",
      "value": "abc123.dkim.amazonses.com"
    },
    {
      "type": "MX",
      "name": "mail.example.com",
      "value": "10 feedback-smtp.us-east-2.amazonses.com"
    },
    {
      "type": "TXT",
      "name": "mail.example.com",
      "value": "v=spf1 include:amazonses.com ~all"
    }
  ],
  "recommended": [
    {
      "type": "TXT",
      "name": "_dmarc.example.com",
      "value": "v=DMARC1; p=none;"
    }
  ],
  "requestedAt": "2026-11-13T09:30:00.000Z",
  "checkedAt": "2026-11-13T09:30:00.000Z",
  "nextCheckAt": "2026-11-13T09:35:00.000Z"
}
```

## The DnsRecord object

A record to add at a domain’s DNS provider.

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `type` | `"CNAME"`, `"MX"`, or `"TXT"` | Always |  |
| `name` | `string` | Always |  |
| `value` | `string` | Always |  |

```json title="The DnsRecord object"
{
  "type": "CNAME",
  "name": "abc123._domainkey.example.com",
  "value": "abc123.dkim.amazonses.com"
}
```
