Create Domain

Add a sending domain to the organization. The domain's DNS must be hosted in postflare's Cloudflare account; the response carries one TXT record to publish, proving the domain belongs to your organization. Once it is published, verify the domain and it is set up for sending — the sending records (SPF, DKIM, bounce MX) are created and managed by Cloudflare, not by you.

Once the domain is verified, you can send from any address on exactly this domain. A from on any other domain — including a subdomain of a verified domain, or a domain verified by a different organization — is refused with 403 validation_error. The response's message says so.

POST/domains

Resend Compatibility: Compatible

Requires an API key with domains:write permission. On production, a key adding a domain on a Postflare-managed zone must be full access, must not be a capture key, and the organization must have at least one platform admin; every other member must be a platform admin or the platform service user.

Body Parameters

namestringrequired

The domain name to add (e.g. example.com).

regionstring

Sending regions are not supported. Any value is rejected.

custom_return_pathstring

Cloudflare manages the return path (cf-bounce.<domain>). Any value is rejected.

capabilitiesobject

sending may be omitted or set to "enabled"; receiving may be omitted or set to "disabled". Other values are rejected.

open_trackingboolean

Enable or disable open tracking.

click_trackingboolean

Enable or disable click tracking.

tlsstring

Not configurable. Any value is rejected.

tracking_subdomainstring

Not supported yet. Any value is rejected.

Response Fields

objectstring

Always "domain".

idstring

The domain ID.

namestring

The domain name.

statusstring

The domain verification status (e.g. pending, verified).

created_atstring

ISO 8601 timestamp.

regionstring

Sending region; currently global.

capabilitiesobject

Sending and receiving capability states, each enabled or disabled.

open_trackingboolean

Whether open tracking is enabled.

click_trackingboolean

Whether click tracking is enabled.

messagestring

What to do next. Not a Resend field; the Resend SDK ignores it.

recordsarray

The DNS records to publish: one TXT at _postflare-verify.<domain>.

recordstring

Record kind (for example, Ownership).

typestring

DNS record type — TXT for the ownership record.

namestring

DNS record name.

valuestring

Expected DNS record value.

ttlstring

DNS record time to live.

statusstring

pending, verified, or failed.

prioritynumber | null

DNS record priority (if applicable).

Errors

StatusWhen
400The domain's DNS is not hosted in postflare's Cloudflare account, its zone is not active yet, the name is outside this deployment's allowed domain namespace or on a reserved testing/platform domain, the production managed-zone eligibility rules are not met, or the organization already has this domain.
502A Cloudflare request failed. Retry.
503Sending domains cannot be set up on this deployment.
curl -X POST 'https://api.postflare.dev/domains' \
  -H 'Authorization: Bearer sk_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "example.com"
  }'
// Set RESEND_BASE_URL=https://api.postflare.dev in the environment before
// the process starts. Without it the SDK sends to api.resend.com, silently.
import { Resend } from 'resend';

const resend = new Resend('sk_xxxxxxxxx');

const { data, error } = await resend.domains.create({
  name: 'example.com',
});

Response

Response
{
  "object": "domain",
  "id": "d91cd9bd-1176-453e-8fc1-35364d380206",
  "name": "example.com",
  "status": "pending",
  "created_at": "2026-01-01T00:00:00.000Z",
  "region": "global",
  "capabilities": { "sending": "enabled", "receiving": "disabled" },
  "open_tracking": true,
  "click_tracking": true,
  "message": "Publish the TXT record in `records` to prove this domain is yours, then verify it; …",
  "records": [
    {
      "record": "Ownership",
      "type": "TXT",
      "name": "_postflare-verify.example.com",
      "value": "postflare-verify=5f0c7e2a-8d1b-4c3e-9a6f-2b7d4e1c9a30",
      "status": "pending",
      "ttl": "Auto",
      "priority": null
    }
  ]
}