Read a visible message
/v1/inbound/messages/{messageId}Returns stored text, attachment metadata, and up to 100 stored addresses per field with exact header counts in toCount, ccCount, replyToCount and referencesCount. Each statement stops after 3 seconds: a request that needs longer is refused with 422 READ_TOO_LARGE. Narrow the dates or filters.
Needs Received mail: read for the address it reached, or a sender domain it was addressed to.
Example
import { createClient } from '@nightmail/sdk/client';
import { getInboundMessage } from '@nightmail/sdk';
const client = createClient({
baseUrl: 'https://nightmail.dev',
auth: scheme => scheme.scheme === 'bearer'
? process.env.NIGHTMAIL_API_KEY
: undefined,
});
const result = await getInboundMessage({
client,
path: {
"messageId": "message_123"
},
throwOnError: true,
});
console.log(result.data);curl --request GET \
--url 'https://nightmail.dev/v1/inbound/messages/message_123' \
--header "Authorization: Bearer $NIGHTMAIL_API_KEY"Parameters
messageIdrequiredpath · stringaddressIdquery · stringOpaque inbound address ID (mbx_…).
includeDeliveryquery · stringInclude delivery details for workspace logs (owner or admin sessions, and API keys with manage permission on all domains, only).
includeAuthenticationquery · stringInclude the sender authentication results (SPF, DKIM, DMARC) and whether the message is automated (auto-replies, bounces, bulk and list mail). Available to any reader of the message.
includeHtmlquery · stringincludeThreadquery · stringInclude the conversation it belongs to (thread): up to 50 messages around it that you can read, oldest first, and their count. A key limited to addresses or an inbox reads only the messages on its addresses.
Responses
200Success
InboundMessageDetailsimulatedbooleanidrequiredstringthreadIdrequiredstringaddressIdsrequiredstring[]directionrequiredstringstatusrequiredstringfromrequiredobjectfrom.namerequiredstring or nullfrom.addressrequiredstringtorequiredobject[]Addresses in the To header (at most 20 on conversation pages, up to 100 on getInboundMessage).
to[].namerequiredstring or nullto[].addressrequiredstringtoCountrequiredintegerTotal addresses in the To header (may exceed to.length when shortened).
ccrequiredobject[]Addresses in the Cc header (at most 20 on conversation pages, up to 100 on getInboundMessage).
cc[].namerequiredstring or nullcc[].addressrequiredstringccCountrequiredintegerTotal addresses in the Cc header (may exceed cc.length when shortened).
replyTorequiredobject[]Addresses in the Reply-To header (at most 20 on conversation pages, up to 100 on getInboundMessage).
replyTo[].namerequiredstring or nullreplyTo[].addressrequiredstringreplyToCountrequiredintegerTotal addresses in the Reply-To header (may exceed replyTo.length when shortened).
subjectrequiredstringsnippetrequiredstringtextrequiredstringreplyTextrequiredstringreceivedAtrequiredstringbodyTruncatedrequiredbooleanattachmentCountrequiredintegerreadrequiredbooleanerrorCoderequiredstring or nullsuppressionReasonstring or nullReason recorded when this send was suppressed. For a multi-recipient send blocked locally, this is the first blocked recipient in To, Cc, Bcc order.
emailIdrequiredstring or nullmessageIdrequiredstring or nullRFC Message-ID, not the Nightmail message ID (id).
inReplyTorequiredstring or nullreferencesrequiredstring[]Message-IDs in the References header (at most 20 on conversation pages, up to 100 on getInboundMessage).
referencesCountrequiredintegerTotal Message-IDs in the References header (may exceed references.length when shortened).
addressesobject[]addresses[].idrequiredstringaddresses[].addressrequiredstringenvelopeTostring[]SMTP envelope recipients (at most 20 on list pages, up to 100 on getInboundMessage).
envelopeToCountintegerTotal SMTP envelope recipients (may exceed envelopeTo.length when shortened).
regionstring or nullspambooleanrawUrlstring or nullrawExpiresAtstring or nullsentAtstring or nullsizeBytesinteger or nullheadersobject[]headers[].namerequiredstringheaders[].valuerequiredstringverdictsobjectthreadobject or nullWith includeThread=true: its conversation, as getEmailDetail shows it.
thread.idrequiredstringThe conversation (getInboundThread).
thread.countrequiredintegerMessages in it that the caller can read.
thread.messagesrequiredobject[]Up to 50 of them around this email, oldest first.
authenticationobjectWith includeAuthentication=true.
authentication.spfrequiredstring or nullauthentication.dkimrequiredstring or nullauthentication.dmarcrequiredstring or nullPASS when the From domain is aligned with a passing SPF or DKIM result.
automatedbooleanWith includeAuthentication=true: an auto-reply, bounce, delivery report, or bulk or list mail. Never answer it automatically.
htmlrequiredstring or nullhtmlTooComplexrequiredbooleanWith includeHtml=true: the HTML has more elements or deeper nesting than Nightmail parses (20,000 nodes, 256 levels deep). It is returned as stored; prefer text to rendering it.
attachmentsrequiredobject[]attachments[].idrequiredstringattachments[].filenamerequiredstringattachments[].contentTyperequiredstringattachments[].sizerequiredintegerattachments[].dispositionrequiredstringattachments[].contentIdrequiredstring or nullattachments[].urlstring or null400, 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.