Messages

List and inspect received messages

Inbound messages are the emails delivered to an inbox. Use these endpoints to page through recent messages, fetch the full body and attachments, or delete a message you no longer need.

List messages

get

Returns inbound messages received by the inbox, ordered by received_at descending.

List responses use cursor pagination. When more results are available the response includes a last_id; pass it back as the last_id query parameter to get the next page. When last_id is null you have reached the end.

Authorizations
Api-TokenstringRequired

API token in Api-Token header

Path parameters
inbox_idintegerRequired

Inbound inbox ID

Example: 1
Query parameters
last_idstringOptional

ID of the last message from the previous page. Pass the last_id value returned by the previous response to fetch the next page. Omit on the first request.

Example: 1700000000000123
Responses
200

List of messages

application/json
total_countintegerRequired

Total number of messages within the retention window.

Example: 1
last_idstring · nullableRequired

Cursor for the next page. null when there are no more results.

get
/api/inbound/inboxes/{inbox_id}/messages
cURL

Get a message

get

Returns a single inbound message together with URLs for the raw .eml file and for each attachment, plus the decoded HTML and plain-text bodies. URLs expire after one hour.

Authorizations
Api-TokenstringRequired

API token in Api-Token header

Path parameters
inbox_idintegerRequired

Inbound inbox ID

Example: 1
idstringRequired

Inbound message ID

Example: 1700000000000123
Responses
200

Message details

application/json
idstringOptional

Mailtrap object ID for the message (not the Message-ID header value).

Example: 1700000000000123
inbox_idintegerOptionalExample: 1
fromstring · nullableOptionalExample: [email protected]
tostring[]OptionalExample: ["[email protected]"]
ccstring[]Optional
bccstring[]Optional
reply_tostring · nullableOptional
subjectstring · nullableOptionalExample: Hello
message_idstring · nullableOptional

Value of the original Message-ID header.

Example: <[email protected]>
in_reply_tostring · nullableOptional
referencesstring[]Optional
headersobject · nullableOptional

Selected headers from the original message, lowercased.

Example: {"mime-version":"1.0","return-path":"<[email protected]>"}
sizeinteger · nullableOptional

Total size of the raw message in bytes.

Example: 4096
html_sizeinteger · nullableOptional

Size of the HTML body in bytes. Zero if the message has no HTML part.

Example: 512
text_sizeinteger · nullableOptional

Size of the plain-text body in bytes. Zero if the message has no text part.

Example: 128
received_atstring · date-timeOptionalExample: 2026-05-08T10:30:00.000Z
raw_message_urlstring · nullableOptional

Presigned URL to download the raw .eml file. Expires after one hour.

Example: https://s3.amazonaws.com/inbound-mail/raw.eml?X-Amz-Signature=...
raw_message_expires_atstring · nullableOptionalExample: 2026-05-08T11:30:00.000Z
html_bodystring · nullableOptional

Decoded HTML body. null when the message has no HTML part.

Example: <html><body>Hello</body></html>
text_bodystring · nullableOptional

Decoded plain-text body. null when the message has no text part.

Example: Hello
get
/api/inbound/inboxes/{inbox_id}/messages/{id}
cURL

Delete a message

delete

Permanently delete an inbound message and its stored body and attachments.

Authorizations
Api-TokenstringRequired

API token in Api-Token header

Path parameters
inbox_idintegerRequired

Inbound inbox ID

Example: 1
idstringRequired

Inbound message ID

Example: 1700000000000123
Responses
delete
/api/inbound/inboxes/{inbox_id}/messages/{id}
cURL

No content

Last updated

Was this helpful?