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

Get messages

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

get
Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
sandbox_idinteger · int64 · min: 1Required

Unique sandbox 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

Email message captured in a Sandbox. Body URLs are often under /api/testing_message_parts/... rather than nested under /api/accounts/.../messages/.... blacklists_report_info may contain only result or the full report. template_variables is set when the message was sent from a template.

idintegerOptional
sandbox_idintegerOptional
subjectstringOptional
sent_atstringOptional
from_emailstringOptional
from_namestringOptional
to_emailstringOptional
to_namestringOptional
email_sizeintegerOptional
is_readbooleanOptional
created_atstringOptional
updated_atstringOptional
template_idintegerOptional
html_body_sizeintegerOptional
text_body_sizeintegerOptional
human_sizestringOptional
html_pathstringOptional
txt_pathstringOptional
raw_pathstringOptional
download_pathstringOptional
html_source_pathstringOptional
get/api/sandboxes/{sandbox_id}/messages
curl -X GET https://mailtrap.io/api/sandboxes/{sandbox_id}/messages \
  -H 'Authorization: Bearer YOUR_API_KEY'
[
  {
    "id": 92,
    "sandbox_id": 342,
    "subject": "Test email",
    "sent_at": "2022-08-19T11:34:33.839Z",
    "from_email": "per667son25@feeney.biz",
    "from_name": "Ela Marks",
    "to_email": "per688son26@donnelly.info",
    "to_name": "Edmund Maggio",
    "email_size": 300,
    "is_read": false,
    "created_at": "2022-08-19T11:34:33.841Z",
    "updated_at": "2022-08-19T11:34:33.841Z",
    "template_id": 0,
    "template_variables": null,
    "html_body_size": 150,
    "text_body_size": 100,
    "human_size": "300 Bytes",
    "html_path": "/api/accounts/336/sandboxes/342/messages/92/body.html",
    "txt_path": "/api/accounts/336/sandboxes/342/messages/92/body.txt",
    "raw_path": "/api/accounts/336/sandboxes/342/messages/92/body.raw",
    "download_path": "/api/accounts/336/sandboxes/342/messages/92/body.eml",
    "html_source_path": "/api/accounts/336/sandboxes/342/messages/92/body.htmlsource",
    "blacklists_report_info": {
      "result": "pending"
    },
    "smtp_information": {
      "ok": true,
      "data": {
        "mail_from_addr": "per667son25@feeney.biz",
        "client_ip": "75.180.183.201",
        "rcpt_to_addrs": [
          "per688son26@donnelly.info"
        ]
      }
    }
  }
]

Last updated

Was this helpful?