Domains API

Manage sending domains — create domain identities, verify DNS records, and check verification status.

GET /v1/domains

List all domain records grouped by domain, including their verification status.

cURL
curl https://api.yoursend.dev/v1/domains \
  -H "Authorization: Bearer ys_live_..."
Response
{
  "primary_domain": "example.com",
  "primary_status": "verified",
  "domains": {
    "example.com": {
      "status": "verified",
      "records": [
        {
          "id": "rec_abc",
          "type": "TXT",
          "host": "_dmarc.example.com",
          "value": "v=DMARC1; p=none",
          "purpose": "spf",
          "status": "verified",
          "checked_at": "2025-01-01T00:00:00Z"
        }
      ]
    }
  }
}

POST /v1/domains

Create a new domain identity. Returns DNS records you need to add to your domain registrar.

FieldTypeRequiredDescription
domainstringYesThe domain name (e.g. "example.com")
cURL
curl -X POST https://api.yoursend.dev/v1/domains \
  -H "Authorization: Bearer ys_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "domain": "example.com" }'
Response (201)
{
  "domain": "example.com",
  "status": "pending",
  "records": [
    { "type": "CNAME", "host": "abc._domainkey.example.com", "value": "abc.dkim.amazonses.com", "purpose": "dkim_1" },
    { "type": "CNAME", "host": "def._domainkey.example.com", "value": "def.dkim.amazonses.com", "purpose": "dkim_2" },
    { "type": "CNAME", "host": "ghi._domainkey.example.com", "value": "ghi.dkim.amazonses.com", "purpose": "dkim_3" }
  ]
}

POST /v1/domains/verify

Trigger an immediate verification check on a domain. Use this after adding DNS records.

cURL
curl -X POST https://api.yoursend.dev/v1/domains/verify \
  -H "Authorization: Bearer ys_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "domain": "example.com" }'
Response
{
  "domain": "example.com",
  "status": "verified",
  "spf_verified": true,
  "dkim_verified": true
}

DELETE /v1/domains

Remove a domain. Pass ?domain=example.com to delete a specific domain, or omit to delete all.

cURL
curl -X DELETE "https://api.yoursend.dev/v1/domains?domain=example.com" \
  -H "Authorization: Bearer ys_live_..."
Response
{ "deleted": true }