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.
/domainsResend 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
namestringrequiredThe domain name to add (e.g. example.com).
regionstringSending regions are not supported. Any value is rejected.
custom_return_pathstringCloudflare manages the return path (cf-bounce.<domain>). Any value is
rejected.
capabilitiesobjectsending may be omitted or set to "enabled"; receiving may be
omitted or set to "disabled". Other values are rejected.
open_trackingbooleanEnable or disable open tracking.
click_trackingbooleanEnable or disable click tracking.
tlsstringNot configurable. Any value is rejected.
tracking_subdomainstringNot supported yet. Any value is rejected.
Response Fields
objectstringAlways "domain".
idstringThe domain ID.
namestringThe domain name.
statusstringThe domain verification status (e.g. pending, verified).
created_atstringISO 8601 timestamp.
regionstringSending region; currently global.
capabilitiesobjectSending and receiving capability states, each enabled or disabled.
open_trackingbooleanWhether open tracking is enabled.
click_trackingbooleanWhether click tracking is enabled.
messagestringWhat to do next. Not a Resend field; the Resend SDK ignores it.
recordsarrayThe DNS records to publish: one TXT at _postflare-verify.<domain>.
recordstringRecord kind (for example, Ownership).
typestringDNS record type — TXT for the ownership record.
namestringDNS record name.
valuestringExpected DNS record value.
ttlstringDNS record time to live.
statusstringpending, verified, or failed.
prioritynumber | nullDNS record priority (if applicable).
Errors
| Status | When |
|---|---|
400 | The 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. |
502 | A Cloudflare request failed. Retry. |
503 | Sending 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
{
"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
}
]
}