Skip to content

Custom Email Domains

Send emails from your own domain (e.g., hello@mycompany.com) instead of the default sendapi.co domain. Custom domains improve deliverability, inbox placement, and brand trust.

Add a Domain

POST /v1/email/domains

Request Body

ParameterTypeRequiredDescription
domainstringYesThe domain you want to use for sending (e.g., mycompany.com).
bash
curl -X POST https://sendapi.co/v1/email/domains \
  -H "Authorization: Bearer sk_live_123456789" \
  -H "Content-Type: application/json" \
  -d '{"domain": "mycompany.com"}'
javascript
const domain = await client.email.domains.add({ domain: 'mycompany.com' });
// domain.records contains the DNS records you need to add

Response

json
{
  "id": "dom_01H9...CD",
  "domain": "mycompany.com",
  "verified": false,
  "records": {
    "dkim": {
      "type": "TXT",
      "name": "sendapi._domainkey.mycompany.com",
      "value": "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GN..."
    },
    "spf": {
      "type": "TXT",
      "name": "mycompany.com",
      "value": "v=spf1 include:sendgrid.net ~all"
    },
    "dmarc": {
      "type": "TXT",
      "name": "_dmarc.mycompany.com",
      "value": "v=DMARC1; p=none; rua=mailto:dmarc@sendapi.co"
    }
  }
}

DNS Setup

Add the DNS records shown in the response to your domain's DNS provider:

  1. DKIM — Proves the email was sent by an authorized server
  2. SPF — Lists servers allowed to send on your behalf
  3. DMARC — Tells receivers what to do with failing emails

DNS changes typically propagate in 15 minutes to 48 hours depending on your registrar.


Verify a Domain

POST /v1/email/domains/{id}/verify

Triggers a DNS record check. Call this after adding the DNS records to confirm they are live.

bash
curl -X POST https://sendapi.co/v1/email/domains/dom_01H9...CD/verify \
  -H "Authorization: Bearer sk_live_123456789"

Response

json
{
  "id": "dom_01H9...CD",
  "domain": "mycompany.com",
  "verified": true,
  "verified_at": "2026-03-09T15:00:00Z"
}

List Domains

GET /v1/email/domains

bash
curl https://sendapi.co/v1/email/domains \
  -H "Authorization: Bearer sk_live_123456789"
json
{
  "data": [
    {
      "id": "dom_01H9...CD",
      "domain": "mycompany.com",
      "verified": true,
      "verified_at": "2026-03-09T15:00:00Z"
    }
  ]
}

Remove a Domain

DELETE /v1/email/domains/{id}

Removes the domain from your account. Emails will fall back to the default sendapi.co domain.

WARNING

After deleting a domain, any scheduled sends referencing this domain will use the default sender address. Remove DNS records from your provider to prevent dangling configurations.

Released under the MIT License.