Delete Domain
Delete a domain by ID. A domain that was set up for sending is removed from Cloudflare first, which deletes the sending records Cloudflare created; if Cloudflare refuses, the domain is kept and the request fails with 502. The _dmarc record created during setup (v=DMARC1; p=reject;) is not removed: it stays on the domain's DNS, and keeps applying to any other mail from the domain, until it is removed there.
DELETE
/domains/{domain_id}Resend Compatibility: Compatible
Requires an API key with domains:write permission.
Path Parameters
domain_idstringrequiredThe ID of the domain to delete.
Response Fields
objectstringAlways "domain".
idstringThe domain ID.
deletedbooleanAlways true.
curl -X DELETE 'https://api.postflare.dev/domains/d91cd9bd-1176-453e-8fc1-35364d380206' \
-H 'Authorization: Bearer sk_xxxxxxxxx'// 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.remove(
'd91cd9bd-1176-453e-8fc1-35364d380206'
);Response
{
"object": "domain",
"id": "d91cd9bd-1176-453e-8fc1-35364d380206",
"deleted": true
}