NightmailDocs
Docs

Read a visible message

get/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 · string
addressIdquery · string

Opaque inbound address ID (mbx_…).

includeDeliveryquery · string

Include delivery details for workspace logs (owner or admin sessions, and API keys with manage permission on all domains, only).

includeAuthenticationquery · string

Include 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 · string
includeThreadquery · string

Include 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
InboundMessageDetail
simulatedboolean
idrequiredstring
threadIdrequiredstring
addressIdsrequiredstring[]
directionrequiredstring
statusrequiredstring
fromrequiredobject
from.namerequiredstring or null
from.addressrequiredstring
torequiredobject[]

Addresses in the To header (at most 20 on conversation pages, up to 100 on getInboundMessage).

to[].namerequiredstring or null
to[].addressrequiredstring
toCountrequiredinteger

Total 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 null
cc[].addressrequiredstring
ccCountrequiredinteger

Total 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 null
replyTo[].addressrequiredstring
replyToCountrequiredinteger

Total addresses in the Reply-To header (may exceed replyTo.length when shortened).

subjectrequiredstring
snippetrequiredstring
textrequiredstring
replyTextrequiredstring
receivedAtrequiredstring
bodyTruncatedrequiredboolean
attachmentCountrequiredinteger
readrequiredboolean
errorCoderequiredstring or null
suppressionReasonstring or null

Reason 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 null
messageIdrequiredstring or null

RFC Message-ID, not the Nightmail message ID (id).

inReplyTorequiredstring or null
referencesrequiredstring[]

Message-IDs in the References header (at most 20 on conversation pages, up to 100 on getInboundMessage).

referencesCountrequiredinteger

Total Message-IDs in the References header (may exceed references.length when shortened).

addressesobject[]
addresses[].idrequiredstring
addresses[].addressrequiredstring
envelopeTostring[]

SMTP envelope recipients (at most 20 on list pages, up to 100 on getInboundMessage).

envelopeToCountinteger

Total SMTP envelope recipients (may exceed envelopeTo.length when shortened).

regionstring or null
spamboolean
rawUrlstring or null
rawExpiresAtstring or null
sentAtstring or null
sizeBytesinteger or null
headersobject[]
headers[].namerequiredstring
headers[].valuerequiredstring
verdictsobject
threadobject or null

With includeThread=true: its conversation, as getEmailDetail shows it.

thread.idrequiredstring

The conversation (getInboundThread).

thread.countrequiredinteger

Messages in it that the caller can read.

thread.messagesrequiredobject[]

Up to 50 of them around this email, oldest first.

authenticationobject

With includeAuthentication=true.

authentication.spfrequiredstring or null
authentication.dkimrequiredstring or null
authentication.dmarcrequiredstring or null

PASS when the From domain is aligned with a passing SPF or DKIM result.

automatedboolean

With includeAuthentication=true: an auto-reply, bounce, delivery report, or bulk or list mail. Never answer it automatically.

htmlrequiredstring or null
htmlTooComplexrequiredboolean

With 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[].idrequiredstring
attachments[].filenamerequiredstring
attachments[].contentTyperequiredstring
attachments[].sizerequiredinteger
attachments[].dispositionrequiredstring
attachments[].contentIdrequiredstring or null
attachments[].urlstring or null
400, 401, 403, 404, 409, 413, 422, 429, 500, 503Request failed; use error.code and requestId to diagnose.
ApiError
errorrequiredobject
error.coderequiredstring
error.messagerequiredstring
error.requestIdrequiredstring
error.fieldstring
error.retryablerequiredboolean
error.resetAtstring

Next 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.requiredobject

On a 403 permission refusal: what the request needs that this credential lacks. The Nightmail-Required-Permission header says the same.