---
title: "Add a sending domain"
method: POST
path: "/api/domains"
tags: ["Domains"]
---

# Add a sending domain

`POST /api/domains`

## Request

- Base URL: `https://api.sendly.now`
- URL: `https://api.sendly.now/api/domains`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `better-auth.session_token`
  - OAuth 2 (authorization code, authorization URL `https://app.sendly.now/api/auth/oauth2/authorize`, token URL `https://app.sendly.now/api/auth/oauth2/token`, scopes: `domains:write`)

Register a new domain with SES and persist its DKIM tokens.

Requires the `domains:write` scope — Add and remove sending domains, and trigger verification.

## Request body

- AddDomainBody: Body for POST /api/domains. `projectId` is optional for API-key auth (derived from key) and required for session auth. `region` pins the SES region; on the first domain it locks the project, after that it must match the project's region. `stream` assigns the identity to transactional or marketing traffic at creation; omit it to leave the identity serving both.
  - `domain` string, required
  - `projectId` string, uuid
  - `region` 'us-east-1' | 'us-west-2' | 'eu-west-1': Override SES region for this domain. Defaults to the project region or the env default. Required to match an existing project region.
  - `stream` 'TRANSACTIONAL' | 'MARKETING': Which traffic this identity carries. Omit to leave it unassigned, which lets it carry every stream — that is what every domain added before per-stream identities does.
  - `streamDefault` boolean: Make this the project's default identity for `stream`. Requires `stream`. Setting it demotes whichever identity held it.

## Response `201`

Domain added

- object
  - `data` Domain, required: A sending identity: one domain registered with SES, with its own DKIM keys, its own MAIL FROM and its own reputation.
    - `createdAt` string, date-time, required: ISO 8601 datetime string
    - `defaultFromAddress` string, nullable: The address a send on this stream uses when it names none. Always on this identity's own host.
    - `defaultFromName` string, nullable: The display name recipients see beside any address on this identity when a send names none, e.g. `Acme` in `Acme <receipts@mail.example.com>`. A send's own `name` and its template's from-name both win over it; `null` falls back to the project name.
    - `dkimStatus` 'NOT_CHECKED' | 'PENDING' | 'VERIFIED' | 'FAILED' | 'null', nullable: Result of the last DNS check for this record type.
    - `dkimTokens` string[], nullable: SES DKIM tokens to publish as CNAME records before the domain can verify.
    - `dmarcStatus` 'NOT_CHECKED' | 'PENDING' | 'VERIFIED' | 'FAILED' | 'null', nullable: Result of the last DNS check for this record type.
    - `domain` string, required: The bare domain, e.g. `mail.acme.com`.
    - `id` string, uuid, required
    - `lastHealthCheckAt` string, date-time, nullable: ISO 8601 datetime string
    - `mailFromDomain` string, nullable: Custom MAIL FROM subdomain SES has on record (normally `sendly.<domain>`).
    - `mailFromDomainStatus` 'Pending' | 'Success' | 'Failed' | 'TemporaryFailure' | 'NotConfigured' | 'null', nullable: SES custom MAIL FROM setup state. Only `Success` means SES is using it.
    - `projectId` string, uuid, required
    - `receivingEnabled` boolean, required: Whether inbound mail for this domain is routed to Sendly mailboxes.
    - `region` string, nullable
    - `spfStatus` 'NOT_CHECKED' | 'PENDING' | 'VERIFIED' | 'FAILED' | 'null', nullable: Result of the last DNS check for this record type.
    - `stream` 'TRANSACTIONAL' | 'MARKETING' | 'null', nullable: Which traffic this identity carries. `null` means unassigned, and an unassigned identity carries every stream — the behaviour of every domain added before per-stream identities. A send whose stream does not match an ASSIGNED identity is refused.
    - `streamDefault` boolean: Whether this is the project's default identity for its stream — the one a send picks when it names no from-address. At most one per (project, stream).
    - `updatedAt` string, date-time, required: ISO 8601 datetime string
    - `verified` boolean, required
  - `success` true, required

## Other responses

- `400`: Validation error
- `401`: Unauthorized — missing or invalid auth
- `403`: Forbidden — insufficient permissions or project disabled
- `429`: Rate limit or billing limit exceeded
- `500`: Internal server error
- `502`: AWS SES rejected the identity setup (unusable credentials, a missing IAM permission, or a refusal on Amazon's side). No domain row is written, and the request is not at fault — retrying it unchanged will not help.

---

[API](https://skmtc.dev/sendly/apis/sendly-api.md) · [All operations](https://skmtc.dev/sendly/apis/sendly-api/llms.txt) · [OpenAPI document](https://skmtc.dev/sendly/apis/sendly-api/revisions/ce7cfb7f7c7e?raw)
