For the complete documentation index, see llms.txt. This page is also available as Markdown.

Get a message

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.

get
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: sender@example.com
tostring[]OptionalExample: ["support-tickets-1a2b3c4d@inbound-mailtrap.io"]
ccstring[]Optional
bccstring[]Optional
reply_tostring · nullableOptional
subjectstring · nullableOptionalExample: Hello
rfc_message_idstring · nullableOptional

Value of the original Message-ID header.

Example: <abc@sender.example>
in_reply_tostring · nullableOptional
referencesstring[]Optional
headersobject · nullableOptional

Selected headers from the original message, lowercased.

Example: {"mime-version":"1.0","return-path":"<sender@example.com>"}
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
thread_idstring · nullableOptional

ID of the thread this message belongs to. Use it with the Threads endpoints to fetch the full conversation.

Example: 1700000000000124
raw_message_urlstring · nullableOptional

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 -X GET https://mailtrap.io/api/inbound/inboxes/{inbox_id}/messages/{id} \
  -H 'Authorization: Bearer YOUR_API_KEY'
{
  "id": "1700000000000123",
  "inbox_id": 1,
  "from": "sender@example.com",
  "to": [
    "support-tickets-1a2b3c4d@inbound-mailtrap.io"
  ],
  "cc": [],
  "bcc": [],
  "reply_to": null,
  "subject": "Hello",
  "rfc_message_id": "<abc@sender.example>",
  "in_reply_to": null,
  "references": [],
  "headers": {
    "mime-version": "1.0",
    "return-path": "<sender@example.com>"
  },
  "size": 4096,
  "html_size": 512,
  "text_size": 128,
  "received_at": "2026-05-08T10:30:00.000Z",
  "thread_id": "1700000000000124",
  "attachments": [
    {
      "attachment_id": "att-1",
      "size": 1024,
      "filename": "logo.png",
      "content_type": "image/png",
      "content_disposition": "inline",
      "content_id": "logo@example.com",
      "download_url": "https://s3.amazonaws.com/inbound-mail/att-1?X-Amz-Signature=...",
      "download_url_expires_at": "2026-05-08T11:30:00.000Z"
    }
  ],
  "raw_message_url": "https://s3.amazonaws.com/inbound-mail/raw.eml?X-Amz-Signature=...",
  "raw_message_expires_at": "2026-05-08T11:30:00.000Z",
  "html_body": "<html><body>Hello</body></html>",
  "text_body": "Hello"
}

Last updated

Was this helpful?