Messages

Inspect captured emails

Interactions with messages

Show email message

get

Get email message by ID.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns email message with its attributes.

application/json
Responseone of
or
get
/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}

Delete message

delete

Delete message from inbox.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns attributes of the deleted message.

application/json
delete
/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}

Update message

patch

Update message attributes (right now only the is_read attribute is available for modification).

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Body
Responses
200

Returns attributes of the updated message.

application/json
patch
/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}

Get messages

get

Get all messages in the inbox. The response contains up to 30 messages. Use last_id or page to retrieve more.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
Query parameters
searchstringOptional

Search query string. Matches subject, to_email, and to_name.

Example: welcome
last_idnumber · min: 1Optional

If specified, a page of records before last_id is returned. Overrides page if both are given.

Example: 123
pagenumber · min: 1Optional

Page number for paginated results.

Example: 5
Responses
200

lists messages

application/json
get
/api/accounts/{account_id}/inboxes/{inbox_id}/messages

Forward message

post

Forward message to an email address. The email address must be confirmed by the recipient in advance.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Body
emailstringOptionalExample: [email protected]
Responses
200

Returns confirmation about forwarding.

application/json
post
/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/forward

Get message spam score

get

Get a brief spam report by message ID.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns message spam analysis report.

application/json
get
/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/spam_report

Get message HTML analysis

get

Get a brief HTML report by message ID.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns message HTML analysis report.

application/json
get
/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/analyze

Get text message

get

Get text email body, if it exists.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns message body in txt format.

text/plain
ResponsestringExample: Congrats for sending test email with Mailtrap! Inspect it using the tabs above and learn how this email can be improved. Now send your email using our fake SMTP server and integration of your choice! Good luck! Hope it works.
get
/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/body.txt

Get raw message

get

Get raw email body.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns raw message body.

text/plain
ResponsestringExample: From: Magic Elves <[email protected]> To: Mailtrap Inbox <[email protected]> Subject: You are awesome! Content-Type: multipart/alternative; boundary="boundary-string" --boundary-string Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Congrats for sending test email with Mailtrap! Inspect it using the tabs above and learn how this email can be improved. Now send your email using our fake SMTP server and integration of your choice! Good luck! Hope it works. --boundary-string Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline <!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body style="font-family: sans-serif;"> <div style="display: block; margin: auto; max-width: 600px;" class="main"> <h1 style="font-size: 18px; font-weight: bold; margin-top: 20px"> Congrats for sending test email with Mailtrap! </h1> <p>Inspect it using the tabs you see above and learn how this email can be improved.</p> <img alt="Inspect with Tabs" src="https://assets-examples.mailtrap.io/integration-examples/welcome.png" style="width: 100%;" > <p>Now send your email using our fake SMTP server and integration of your choice!</p> <p>Good luck! Hope it works.</p> </div> <!-- Example of invalid for email html/css, will be detected by Mailtrap: --> <style> .main { background-color: white; } a:hover { border-left-width: 1em; min-height: 2em; } </style> </body> </html> --boundary-string--
get
/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/body.raw

Get message source

get

Get HTML source of email.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns HTML source of a message.

text/html
ResponsestringExample: <!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body style="font-family: sans-serif;"> <div style="display: block; margin: auto; max-width: 600px;" class="main"> <h1 style="font-size: 18px; font-weight: bold; margin-top: 20px">Congrats for sending test email with Mailtrap!</h1> <p>Inspect it using the tabs you see above and learn how this email can be improved. </p> <img alt="Inspect with Tabs" src="https://assets-examples.mailtrap.io/integration-examples/welcome.png" style="width: 100%;"> <p>Now send your email using our fake SMTP server and integration of your choice! </p> <p>Good luck! Hope it works.</p> </div> <!-- Example of invalid for email html/css, will be detected by Mailtrap: --> <style> .main { background-color: white; } a:hover { border-left-width: 1em; min-height: 2em; } </style> </body> </html>
get
/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/body.htmlsource

Get HTML message

get

Get formatted HTML email body. Not applicable for plain text emails.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns message body in html format.

text/html
ResponsestringExample: <!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body style="font-family: sans-serif;"> <div style="display: block; margin: auto; max-width: 600px;" class="main"> <h1 style="font-size: 18px; font-weight: bold; margin-top: 20px">Congrats for sending test email with Mailtrap!</h1> <p>Inspect it using the tabs you see above and learn how this email can be improved. </p> <img alt="Inspect with Tabs" src="https://assets-examples.mailtrap.io/integration-examples/welcome.png" style="width: 100%;"> <p>Now send your email using our fake SMTP server and integration of your choice! </p> <p>Good luck! Hope it works.</p> </div> <!-- Example of invalid for email html/css, will be detected by Mailtrap: --> <style> .main { background-color: white; } a:hover { border-left-width: 1em; min-height: 2em; } </style> </body> </html>
get
/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/body.html

Get message as .eml

get

Get email message in .eml format.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns .eml of the message.

message/rfc822
Responsestring · binaryExample: From: Magic Elves <[email protected]> To: Mailtrap Inbox <[email protected]> Subject: You are awesome! Content-Type: multipart/alternative; boundary="boundary-string" --boundary-string Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Congrats for sending test email with Mailtrap! Inspect it using the tabs above and learn how this email can be improved. Now send your email using our fake SMTP server and integration of your choice! Good luck! Hope it works. --boundary-string Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline <!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body style="font-family: sans-serif;"> <div style="display: block; margin: auto; max-width: 600px;" class="main"> <h1 style="font-size: 18px; font-weight: bold; margin-top: 20px"> Congrats for sending test email with Mailtrap! </h1> <p>Inspect it using the tabs you see above and learn how this email can be improved.</p> <img alt="Inspect with Tabs" src="https://assets-examples.mailtrap.io/integration-examples/welcome.png" style="width: 100%;" > <p>Now send your email using our fake SMTP server and integration of your choice!</p> <p>Good luck! Hope it works.</p> </div> <!-- Example of invalid for email html/css, will be detected by Mailtrap: --> <style> .main { background-color: white; } a:hover { border-left-width: 1em; min-height: 2em; } </style> </body> </html> --boundary-string--
get
/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/body.eml

Get mail headers

get

Get mail headers of a message

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns mail headers of the message

application/json
get
/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/mail_headers

Last updated

Was this helpful?