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

# Add a domain

`POST /email/domains`

## Request

- Base URL: `https://www.unitpost.com/api/v1`
- URL: `https://www.unitpost.com/api/v1/email/domains`
- Auth: HTTP bearer

Add a domain you'll send email from. The response includes the DNS `records` (SPF, DKIM, and so on) to publish with your DNS provider. Once they're published, trigger a check with [Verify a domain](#post-email-domains-id-verify) — sending from the domain is blocked until it verifies. Requires the `domains:write` capability.

## Request body

- DomainCreate
  - `name` string, required

## Response `201`

Created.

- Domain
  - `object` 'domain', required
  - `id` string, required
  - `name` string, required
  - `status` 'pending' | 'verifying' | 'verified' | 'degraded' | 'failed', required
  - `records` object[], nullable, required
    - `type` string, required
    - `name` string, required
    - `value` string, required
    - `priority` number
  - `dkim_selector` string, nullable, required
  - `open_tracking` boolean, nullable, required
  - `click_tracking` boolean, nullable, required
  - `tls` 'opportunistic' | 'enforced', required
  - `tracking_subdomain` string, nullable, required
  - `tracking_verified_at` string, nullable, required: When tracked links and open pixels started using the custom tracking host (`tracking_subdomain`). Non-null only while sends actually use it: the domain is verified (or degraded) and the host's last check proved it answers over HTTPS. Otherwise null, and links use the default tracking host. A host that stops answering, or a domain that's no longer verified, goes back to null.
  - `verified_at` string, nullable, required
  - `created_at` string, required
  - `updated_at` string, required

## Other responses

- `401`: Missing or invalid API key.
- `409`: Domain already exists.
- `422`: Validation error.

---

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