Get your API key
API reference

Messages

Stored messages, with their deliveries and attachments.

Auth: Session token · Base URL: https://api.mailkite.dev

Endpoints

Each row expands to its request and response schema. The address bar follows along, so any endpoint can be linked to directly.

GET /api/messages List stored messages, newest first. Optionally filter with `search` (matches sender, recipient, or subject) and page with `before` (a `received_at` cursor) and `limit`; omit all for the default newest 100. Response is a bare array — paginate by passing the last row's `received_at` as the next `before`.

List stored messages, newest first. Optionally filter with `search` (matches sender, recipient, or subject) and page with `before` (a `received_at` cursor) and `limit`; omit all for the default newest 100. Response is a bare array — paginate by passing the last row's `received_at` as the next `before`.

Response body

array message.json

A stored message (msg_…), inbound or outbound. GET /api/messages returns list rows: the stored fields plus per-message delivery counters, without bodies. GET /api/messages/:id (see message-detail) returns the same resource with bodies (text_body/html_body/headers_json) and without the list counters.

FieldTypeNotes
id req stringMessage id (msg_…), stable across webhook retries and replays.
user_id req stringOwning account (usr_…).
route_idstring · nullThe route that handled an inbound message (rte_…); null for outbound sends.
mailbox_idstring · nullThe mailbox the message is anchored to for access control; null when the address isn't on an owned domain.
direction req "inbound" · "outbound"Whether MailKite received or sent the message.
from req objectStructured sender — the same shape the email.received webhook carries.
from.address req stringEmail address, from the SMTP envelope.
from.name req string · nullDisplay name decoded from the MIME header. null when the message carried none or the header names a different address. Sender-asserted and unverified.
to req object[]Structured recipients — the same shape the email.received webhook carries.
to[].address req stringEmail address, from the SMTP envelope.
to[].name req string · nullDisplay name decoded from the MIME header. null when the message carried none or the header names a different address. Sender-asserted and unverified.
from_addr req stringBare sender address from the SMTP envelope (MAIL FROM).
to_addr req stringBare recipient address from the SMTP envelope (RCPT TO).
subjectstring · nullDecoded subject line; null when the message had none.
text_bodystring · nullPlain-text body. Detail responses only — list rows never carry bodies.
html_bodystring · nullHTML body. Detail responses only — list rows never carry bodies.
headers_jsonstring · nullStored MIME headers as a JSON string. Detail responses only.
spfstring · nullSPF verdict for an inbound message ('pass', 'fail', …); null when not checked.
dkimstring · nullDKIM verdict for an inbound message; null when not checked.
dmarcstring · nullDMARC verdict for an inbound message; null when not checked.
spamstring · nullSpam verdict for an inbound message ('ham', 'spam'); null when not checked.
thread_idstring · nullConversation root id — pass it to send()'s inReplyTo to reply in-thread. null when the message carried no usable id.
send_statusstringOutbound send state: 'sending', 'sent', or 'failed'. Always 'sent' for inbound rows.
track_idstring · nullOpen-tracking token for an outbound message when tracking was on; null = off.
received_at req integerWhen MailKite accepted the message (arrival time — stable across retries and replays), in Unix epoch milliseconds (UTC).
size_bytesinteger · nullStored byte size (headers + bodies; attachments sized separately).
delivery_countintegerHow many webhook deliveries exist for this message. List rows only.
attemptsinteger · nullMax attempts across this message's deliveries. List rows only.
last_status_codeinteger · nullHTTP status of the most recent delivery. List rows only.
delivered_countintegerDeliveries in state 'delivered'. List rows only.
failed_countintegerDeliveries in state 'failed'. List rows only.
pending_countintegerDeliveries in state 'pending'. List rows only.
webhook_statusstring · nullRolled-up webhook state for the list pill ('delivered', 'failed', 'pending'); null when the message has no deliveries. List rows only.
GET /api/messages/:id Get a message with deliveries + attachments.

Get a message with deliveries + attachments.

Response body

message-detail.json

GET /api/messages/:id — the full message with its delivery history, pipeline events, per-attempt audit rows, recorded opens, and attachments.

FieldTypeNotes
message req messageThe message itself, with bodies (text_body/html_body/headers_json) and without the list-row counters.
message.id req stringMessage id (msg_…), stable across webhook retries and replays.
message.user_id req stringOwning account (usr_…).
message.route_idstring · nullThe route that handled an inbound message (rte_…); null for outbound sends.
message.mailbox_idstring · nullThe mailbox the message is anchored to for access control; null when the address isn't on an owned domain.
message.direction req "inbound" · "outbound"Whether MailKite received or sent the message.
message.from req objectStructured sender — the same shape the email.received webhook carries.
message.from.address req stringEmail address, from the SMTP envelope.
message.from.name req string · nullDisplay name decoded from the MIME header. null when the message carried none or the header names a different address. Sender-asserted and unverified.
message.to req object[]Structured recipients — the same shape the email.received webhook carries.
message.to[].address req stringEmail address, from the SMTP envelope.
message.to[].name req string · nullDisplay name decoded from the MIME header. null when the message carried none or the header names a different address. Sender-asserted and unverified.
message.from_addr req stringBare sender address from the SMTP envelope (MAIL FROM).
message.to_addr req stringBare recipient address from the SMTP envelope (RCPT TO).
message.subjectstring · nullDecoded subject line; null when the message had none.
message.text_bodystring · nullPlain-text body. Detail responses only — list rows never carry bodies.
message.html_bodystring · nullHTML body. Detail responses only — list rows never carry bodies.
message.headers_jsonstring · nullStored MIME headers as a JSON string. Detail responses only.
message.spfstring · nullSPF verdict for an inbound message ('pass', 'fail', …); null when not checked.
message.dkimstring · nullDKIM verdict for an inbound message; null when not checked.
message.dmarcstring · nullDMARC verdict for an inbound message; null when not checked.
message.spamstring · nullSpam verdict for an inbound message ('ham', 'spam'); null when not checked.
message.thread_idstring · nullConversation root id — pass it to send()'s inReplyTo to reply in-thread. null when the message carried no usable id.
message.send_statusstringOutbound send state: 'sending', 'sent', or 'failed'. Always 'sent' for inbound rows.
message.track_idstring · nullOpen-tracking token for an outbound message when tracking was on; null = off.
message.received_at req integerWhen MailKite accepted the message (arrival time — stable across retries and replays), in Unix epoch milliseconds (UTC).
message.size_bytesinteger · nullStored byte size (headers + bodies; attachments sized separately).
message.delivery_countintegerHow many webhook deliveries exist for this message. List rows only.
message.attemptsinteger · nullMax attempts across this message's deliveries. List rows only.
message.last_status_codeinteger · nullHTTP status of the most recent delivery. List rows only.
message.delivered_countintegerDeliveries in state 'delivered'. List rows only.
message.failed_countintegerDeliveries in state 'failed'. List rows only.
message.pending_countintegerDeliveries in state 'pending'. List rows only.
message.webhook_statusstring · nullRolled-up webhook state for the list pill ('delivered', 'failed', 'pending'); null when the message has no deliveries. List rows only.
actor_email req string · nullWhen a team member sent this message as the domain owner: the acting member's email. null otherwise.
actor_team_name req string · nullWhen a team member sent this message as the domain owner: the team's name. null otherwise.
deliveries req delivery[]Every webhook delivery of this message, newest last — retries and replays append.
deliveries[].id req stringDelivery id (dlv_…).
deliveries[].message_id req stringThe message this delivery carries (msg_…).
deliveries[].route_id req stringThe route whose webhook was targeted (rte_…).
deliveries[].url req stringThe webhook URL the body was POSTed to.
deliveries[].status req "pending" · "delivered" · "failed" · "paused"Current state of this delivery.
deliveries[].attempts req integerHow many attempts this delivery has made.
deliveries[].last_status_codeinteger · nullHTTP status of the most recent attempt.
deliveries[].next_retry_atinteger · nullWhen the auto-retry cron will re-attempt a failed delivery; null when nothing is due, in Unix epoch milliseconds (UTC); null when it has never happened.
deliveries[].retry_attemptsintegerHow many automatic retries have been scheduled so far.
deliveries[].created_at req integerWhen the delivery was created, in Unix epoch milliseconds (UTC).
deliveries[].updated_at req integerWhen the delivery last changed, in Unix epoch milliseconds (UTC).
events req object[]The pipeline timeline for this message (received → routed → webhook attempts → retries). Metadata only, never bodies.
events[].id req stringEvent id (evt_…).
events[].kind req stringEvent kind (e.g. 'email.received', 'webhook.delivered', 'webhook.failed', 'webhook.test').
events[].status req "ok" · "fail" · "info"Outcome facet.
events[].domainstring · nullDomain the event belongs to.
events[].route_idstring · nullRoute involved, when any.
events[].message_idstring · nullMessage involved, when any.
events[].delivery_idstring · nullDelivery involved, when any.
events[].targetstring · nullWebhook URL / forward address / recipient, when relevant.
events[].codeinteger · nullHTTP or provider status code, when relevant.
events[].messagestring · nullHuman-readable detail.
events[].created_at req integerWhen the event was recorded, in Unix epoch milliseconds (UTC).
deliveryAttempts req delivery-attempt[]Per-attempt audit rows (timing, request/response capture) behind the delivery inspector.
deliveryAttempts[].id req stringAttempt id (att_…).
deliveryAttempts[].delivery_id req stringThe delivery this attempt belongs to (dlv_…).
deliveryAttempts[].message_id req stringThe message delivered (msg_…).
deliveryAttempts[].attempt_number req integer1-based attempt counter within the delivery.
deliveryAttempts[].ok req 0 · 11 when the attempt succeeded.
deliveryAttempts[].reasonstring · nullFailure classification when not ok (e.g. 'http_5xx', 'timeout', 'no-ack').
deliveryAttempts[].request_headersstring · nullRequest headers we sent, as a JSON string (content-type, x-mailkite-signature, x-mailkite-timestamp). Null for attempts recorded before capture existed.
deliveryAttempts[].request_bodystring · nullThe JSON payload we POSTed, truncated to ~4KB. Null for attempts recorded before capture existed.
deliveryAttempts[].response_statusinteger · nullHTTP status the endpoint returned.
deliveryAttempts[].response_headersstring · nullResponse headers as a JSON string.
deliveryAttempts[].response_bodystring · nullResponse body, truncated to ~4KB.
deliveryAttempts[].duration_msinteger · nullRound-trip time of the attempt.
deliveryAttempts[].requested_at req integerWhen the attempt started, in Unix epoch milliseconds (UTC).
deliveryAttempts[].created_at req integerWhen the audit row was recorded, in Unix epoch milliseconds (UTC).
opens req object[]Recorded opens for an outbound message; empty when tracking was off or nothing was opened.
attachments req object[]Stored attachments with signed download URLs.
attachments[].id req stringAttachment id.
attachments[].filename req stringOriginal filename.
attachments[].contentTypestring · nullMIME type.
attachments[].size req integerSize in bytes.
attachments[].contentIdstring · nullMIME Content-ID for inline attachments.
attachments[].dispositionstring · null'inline' or 'attachment'.
attachments[].url req stringSigned, time-limited download URL — valid 7 days, no credential needed.