Verify domain
/v1/domains/{id}/verifyOn MX, request a background verification and return the current stored status, with what public DNS shows now for each pending sending and MAIL FROM record (dns[].publicDns), so a missing or mistyped record can be named, and where the domain's DNS is hosted (dnsHost). Read the domain again for updates.
Needs Configuration: write for the sender domain. A person needs to be an owner or admin.
Example
import { createClient } from '@nightmail/sdk/client';
import { verifyDomain } from '@nightmail/sdk';
const client = createClient({
baseUrl: 'https://nightmail.dev',
auth: scheme => scheme.scheme === 'bearer'
? process.env.NIGHTMAIL_API_KEY
: undefined,
});
const result = await verifyDomain({
client,
path: {
"id": "resource_123"
},
throwOnError: true,
});
console.log(result.data);curl --request POST \
--url 'https://nightmail.dev/v1/domains/resource_123/verify' \
--header "Authorization: Bearer $NIGHTMAIL_API_KEY"Parameters
idrequiredpath · stringResponses
200Success
DomainReadinessidrequiredstringnamerequiredstringregionrequiredstringverificationStatusrequiredstringverifiedrequiredbooleandkimStatusrequiredstringdmarcrequiredobject or nullLast DNS and SES observation for this From domain. Null when unchecked, unavailable or stale. Alignment describes configured identifiers, not a delivery verdict.
dmarc.statusrequiredstringdmarc.recordrequiredstring or nulldmarc.sourcerequiredstring or nullDomain publishing the effective TXT record; may be the organizational domain.
dmarc.adkimrequiredstringdmarc.aspfrequiredstringdmarc.alignmentrequiredobjectreadyrequiredbooleansendingrequiredstringreceivingrequiredstringmailFromDomainrequiredstring or nullmailFromStatusrequiredstring or nulldnsStatusrequiredstringdnsUnavailableReasonrequiredstring or nulldnsrequiredobject[]dns[].namerequiredstringdns[].typerequiredstringdns[].valuerequiredstringdns[].prioritynumberdns[].purposerequiredstringlinks: optional, the domain's own link host (links.<domain>) for the unsubscribe and other links Nightmail adds to campaign and marketing mail; shown when the installation has a link domain with Cloudflare for SaaS.
dns[].statusrequiredstringdns[].notestringdns[].publicDnsobject or nullFor pending sending and MAIL FROM records: what public DNS (Cloudflare 1.1.1.1) shows for this record. verifyDomain looks it up now (answers cached up to 30 seconds). Other reads show the last background check, which runs every 15 to 60 minutes for a Hosted domain still pending an hour after it was added. Null when DNS did not answer in time; absent before any check and on other records.
dnsHostobject or nullWhere this domain’s DNS is hosted, from its zone’s NS records, alongside publicDns: null when the provider is not one Nightmail recognizes.
dnsHost.namerequiredstringThe provider, e.g. Cloudflare, Vercel, Route 53, GoDaddy or Namecheap.
dnsHost.zonerequiredstringThe zone it hosts, which record names are relative to there.
dnsHost.urlrequiredstring or nullThe provider's DNS page for the zone, when it has a known address.
dnsIssueobject or nullSet when adding the domain (one bounded NS lookup), by Check now and by the background check: the domain has no DNS at all. Never set when DNS couldn’t be read. Fix the name (add the right domain and delete this one) or register the domain.
dnsIssue.coderequiredstringno_dns: no nameservers serve this domain: it is unregistered, lapsed or mistyped, so its records can’t be published and it can’t verify.
dnsIssue.messagerequiredstringreleasesAtstring or nullHosted only: when this domain is released if its records are still unproven (72 hours after it was added). Null once ownership has been proven.
receivingIssueobject or nullHosted only: receiving needs attention. Set by the DNS checks that run when a receiving host is suggested or chosen, on Check now and in the hourly recheck. Null when the receiving record is clear.
receivingIssue.coderequiredstringcname: the host is a CNAME, so it cannot have an MX (RFC 1034). foreign_mx: another provider receives its mail. split: other MX records share its mail. wildcard: a *.domain CNAME or MX answers for it. bane_record: it is one of Nightmail’s own names (custom MAIL FROM, ownership TXT, DKIM). host_taken: another claim, possibly in another workspace, receives on it. claimed: another workspace claimed it, or a name between it and this domain, in any scope. delegated: it is a delegated zone with its own NS records. claimed and delegated hosts never receive here. mx_missing: its MX disappeared after setup. wrong_region and null_mx: its MX points elsewhere in SES or refuses mail. proof_stale / identity_stale: the ownership TXT proof or the SES verification is out of date.
receivingIssue.hostrequiredstringreceivingIssue.blockingrequiredbooleanTrue when receiving there cannot work until DNS or the choice changes.
receivingIssue.messagerequiredstringreceivingIssue.providerstring or nullreceivingIssue.targetstring or nullThe existing CNAME target.
receivingIssue.suggestionstring or nullA free subdomain to use instead.
builtInbooleanHosted only: the workspace’s built-in domain, a subdomain of Nightmail’s own domain that needs no DNS. It sends until a domain of the workspace’s own verifies (limits here and connection.builtinDomain in GET /v1/me say what it sends), receives at every address, and can’t be deleted or changed (409 BUILTIN_DOMAIN).
limitsobjectBuilt-in domain only: what it sends, before a send finds out. GET /v1/domains/{id} and listDomains.
limits.scoperequiredstringWho it sends to: anyone, or the verified addresses of the workspace’s members.
limits.perDayrequiredintegerRecipients in a rolling 24 hours.
limits.perMinuterequiredintegerRecipients in a minute.
limits.unsupportedrequiredstring[]Request fields a send from it can’t use (refused together, as error.details[].unsupported of 422 BUILTIN_DOMAIN_UNSUPPORTED): from (a subdomain of it), replyTo (elsewhere), headers, attachments, template, scheduledAt, kind (marketing) and campaign.
limits.summaryrequiredstringThe same, in one sentence.
400, 401, 403, 404, 409, 413, 422, 429, 500, 503Request failed; use error.code and requestId to diagnose.
ApiErrorerrorrequiredobjecterror.coderequiredstringerror.messagerequiredstringerror.requestIdrequiredstringerror.fieldstringerror.retryablerequiredbooleanerror.resetAtstringNext capacity change for a Hosted rolling send limit.
error.detailsobject[]Every problem found, when there is more than one part, such as rule diagnostics with rule, line, column, message and hint, or a measurement, such as CONTENT_TOO_LARGE_TO_SCREEN with screenedBytes and limitBytes (and index in a batch).
error.requiredobjectOn a 403 permission refusal: what the request needs that this credential lacks. The Nightmail-Required-Permission header says the same.