Before you can send from an address, its domain must be verified. Each domain gets its own 2048-bit DKIM key (with a selector like mbk3x9qa), an MX and an SPF record on a return-path subdomain (send.yourdomain.com by default) and a recommended DMARC record. The from domain of every email must exactly match a verified domain. All domain endpoints require a full_access key.
Add a domain
POST/domains
Body parameters
namerequiredstringThe domain, e.g. acme.com.returnPathSubdomainstringSubdomain used for the envelope sender and bounces. Defaults to send.
const { data } = await mailbit.domains.create({ name: "acme.com" });
{
"object": "domain",
"id": "dom_5NcX8qTzWm3bHf7K",
"name": "acme.com",
"status": "pending",
"returnPath": "send.acme.com",
"records": [
{
"purpose": "dkim", "type": "TXT", "name": "mbk3x9qa._domainkey.acme.com",
"value": "v=DKIM1; k=rsa; p=MIIBIjAN...", "required": true, "status": "pending"
},
{
"purpose": "return_path_mx", "type": "MX", "name": "send.acme.com",
"value": "smtp.mailbit.dev", "priority": 10, "required": true, "status": "pending"
},
{
"purpose": "spf", "type": "TXT", "name": "send.acme.com",
"value": "v=spf1 include:spf.mailbit.dev ~all", "required": true, "status": "pending"
},
{
"purpose": "dmarc", "type": "TXT", "name": "_dmarc.acme.com",
"value": "v=DMARC1; p=none; rua=mailto:dmarc@acme.com", "required": false, "status": "pending"
}
],
"createdAt": "2026-11-16T10:00:00.000Z",
"lastCheckedAt": null,
"verifiedAt": null
}
Start with p=none for DMARC, watch the aggregate reports, then move to quarantine or reject once all your legitimate mail is aligned.
List domains
GET/domains
Returns { "object": "list", "data": [...], "hasMore": false }.
const { data } = await mailbit.domains.list();
Retrieve a domain
GET/domains/:id
Returns the domain with its DNS records and the verification status of each.
const { data } = await mailbit.domains.get("dom_5NcX8qTzWm3bHf7K");
Verify a domain
POST/domains/:id/verify
Trigger a DNS check right away. We also re-check pending domains automatically in the background.
const { data } = await mailbit.domains.verify("dom_5NcX8qTzWm3bHf7K");
{ "object": "domain", "id": "dom_5NcX8qTzWm3bHf7K", "status": "verified", "...": "..." }
Delete a domain
DELETE/domains/:id
Removes the domain and its DKIM key. Emails from this domain will be rejected afterwards.
await mailbit.domains.remove("dom_5NcX8qTzWm3bHf7K");
{ "object": "domain", "id": "dom_5NcX8qTzWm3bHf7K", "deleted": true }