# Add domain

`POST /v1/domains`

Adds a domain to the workspace and returns the DNS records to publish before it can send.

Needs the scope: `domains:write`

## Body parameters

- `name` (string, required): The domain to send from, such as `mail.example.com`. A subdomain keeps your main domain apart from your sending. Up to 120 characters.
- `region` (string): The region to send from: `us-east-1`, `eu-west-1` or `ap-northeast-1`. Without it the domain is in `us-east-1`. One of: `us-east-1`, `eu-west-1`, `ap-northeast-1`.
- `openTracking` (boolean): Whether to count opens for mail from this domain. Without it, yes. Default: `true`.
- `clickTracking` (boolean): Whether to count clicks for mail from this domain. Without it, no. Default: `false`.

## Returns

- `object` ("domain"): Always `domain`.
- `id` (string): The id of the domain.
- `name` (string): The domain name, such as `mail.example.com`.
- `status` (string): Where verification stands: `pending` until every record is found, `verified` after that, `failed` when a record is wrong. One of: `pending`, `verified`, `failed`.
- `region` (string): The region mail from this domain is sent from. One of: `us-east-1`, `eu-west-1`, `ap-northeast-1`.
- `openTracking` (boolean): Whether opens are counted for mail from this domain.
- `clickTracking` (boolean): Whether clicks are counted for mail from this domain.
- `records` (object[]): The DNS records to publish, each with whether it was found.
- `records[].id` (string): The id of the record.
- `records[].type` (string): The type of DNS record: `MX`, `TXT` or `CNAME`. One of: `MX`, `TXT`, `CNAME`.
- `records[].host` (string): The name to publish the record under.
- `records[].value` (string): What the record has to hold.
- `records[].priority` (integer | null): The priority of an `MX` record, and `null` for the other types.
- `records[].ttl` (string): How long resolvers may keep the record, as your DNS provider writes it.
- `records[].status` (string): Whether the record was found: `pending`, `verified` or `failed`. One of: `pending`, `verified`, `failed`.
- `events` (object[]): What has happened to the domain since it was added.
- `events[].id` (string): The id of the event.
- `events[].title` (string): What happened, in a few words.
- `events[].at` (string): When it happened.
- `events[].status` (string): Where verification stood after it. One of: `pending`, `verified`, `failed`.
- `events[].detail` (string): More about what happened.
- `createdAt` (string): When the domain was added.

## Example

cURL:

```bash
curl -X POST "$OPENSEND_API_URL/v1/domains" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "updates.example.com",
  "region": "us-east-1"
}'
```

TypeScript:

```ts
await opensend.domains.create({
  name: 'updates.example.com',
  region: 'us-east-1',
})
```

CLI:

```bash
opensend domains create --name updates.example.com --region us-east-1
```

MCP:

```json
{
  "name": "domains_create",
  "arguments": {
    "name": "updates.example.com",
    "region": "us-east-1"
  }
}
```

Answer:

```json
{
  "object": "domain",
  "id": "dom_04",
  "name": "updates.example.com",
  "status": "pending",
  "region": "us-east-1",
  "openTracking": true,
  "clickTracking": false,
  "records": [
    {
      "id": "mx-0",
      "type": "MX",
      "host": "send",
      "value": "feedback.platform.test",
      "priority": 10,
      "ttl": "Auto",
      "status": "pending"
    },
    {
      "id": "txt-1",
      "type": "TXT",
      "host": "@",
      "value": "v=spf1 include:platform.test ~all",
      "priority": null,
      "ttl": "Auto",
      "status": "pending"
    }
  ],
  "events": [
    {
      "id": "evt_1795771800000",
      "title": "Domain added",
      "at": "2026-11-27T09:30:00.000Z",
      "status": "pending",
      "detail": ""
    }
  ],
  "createdAt": "2026-11-27T09:30:00.000Z"
}
```
