Check email sendability without sending
/v1/emails/checkRead-only 0–100 advisory score, not an inbox-placement probability or admission decision. Supply one draft (HTML or text), outbound email ID, or campaign ID. Uses visible retained content, cached From-domain facts, and workspace reputation for unrestricted readers. No DNS/asset fetches or paid screen. Scores use current evidence, not a historical delivery verdict. HTML has the preview lint’s 256 KiB UTF-8 and tree budgets. Marketing drafts are checked as supplied; Nightmail adds the unsubscribe headers, the link and the workspace’s postal address to campaigns and to marketing mail it sent, so those are checked as sent. Each finding’s fix is one plain sentence and fixIn says where it is made. MIME bytes are estimated.
Needs Sent mail: read for the sender domain.
Example
import { createClient } from '@nightmail/sdk/client';
import { checkEmail } from '@nightmail/sdk';
const client = createClient({
baseUrl: 'https://nightmail.dev',
auth: scheme => scheme.scheme === 'bearer'
? process.env.NIGHTMAIL_API_KEY
: undefined,
});
const result = await checkEmail({
client,
body: {
"from": "sender@example.com",
"subject": "Hello from Nightmail",
"stream": "transactional"
},
throwOnError: true,
});
console.log(result.data);curl --request POST \
--url 'https://nightmail.dev/v1/emails/check' \
--header "Authorization: Bearer $NIGHTMAIL_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"from": "sender@example.com",
"subject": "Hello from Nightmail",
"stream": "transactional"
}'Request body
EmailCheckInputOne of 3:
Variant 1: SendabilityDraftfrom, fromName, to, subject, html, text, stream, headers, attachments
fromrequiredstringfromNamestringtostring or string[]subjectrequiredstringhtmlstringtextstringstreamrequiredstringheadersobjectHeader name to value. May include observed or planned transport headers; not trusted as authentication evidence.
attachmentsobject[]Optional metadata only: decoded byte size, never attachment bytes or fetch URLs.
attachments[].filenamerequiredstringattachments[].contentTyperequiredstringattachments[].sizerequiredintegerVariant 2emailId
emailIdrequiredstringVariant 3campaignId
campaignIdrequiredstringResponses
200Success
EmailCheckResultscorerequiredintegergraderequiredstringdomainIdrequiredstring or nullThe From domain’s ID (getDomain) when it is one of this workspace’s domains: where a finding with fixIn domain is fixed.
categoriesrequiredobject[]categories[].idrequiredstringcategories[].scorerequiredintegercategories[].weightrequiredintegerfindingsrequiredobject[]findings[].ruleIdrequiredstringfindings[].categoryrequiredstringfindings[].severityrequiredstringfindings[].titlerequiredstringfindings[].detailrequiredstringfindings[].fixrequiredstringWhat to do, in one short sentence of everyday words. The title and the detail name the header, record or standard.
findings[].fixInrequiredstringWhere the fix is made: the From domain’s DNS records and setup (domain), the workspace’s settings (workspace), how much and to whom you send (sending), or the message itself (message).
findings[].evidenceobject400, 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.