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

Get a thread

Returns a single thread with its messages embedded, ordered oldest first.

Each message carries a visibility_status:

  • available — the message is within your plan's retention window. The full envelope, subject, RFC headers, decoded bodies, and attachment download URLs are included; sent messages also carry their delivery lifecycle (delivery_status, delivered_at, bounced_at).

  • placeholder — the message is outside the retention window. Only visibility_status and direction are returned; every other field is omitted and no attachment download URLs are issued.

get
Authorizations
Api-TokenstringRequired

API token in Api-Token header

Path parameters
inbox_idintegerRequired

Inbound inbox ID

Example: 1
idstringRequired

Inbound thread ID

Example: 1700000000000123
Responses
200

Thread details

application/json

Summary of a thread. All aggregates are computed over the messages you can still access (those within the plan's retention window).

idstringOptionalExample: 1700000000000123
subjectstring · nullableOptional

Subject of the thread's root message.

Example: Support request
message_countintegerOptional

Number of accessible messages in the thread. Messages sent together (reply-all fan-out) count once.

Example: 3
sizeintegerOptional

Combined size of the accessible messages, in bytes.

Example: 24576
first_message_atstring · date-timeOptionalExample: 2026-05-08T10:30:00.000Z
last_received_atstring · nullableOptional

When the most recent inbound message arrived, if any.

Example: 2026-05-08T12:05:00.000Z
last_sent_atstring · nullableOptional

When the most recent message was sent, if any.

Example: 2026-05-08T11:40:00.000Z
last_activity_atstring · date-timeOptional

Timestamp of the most recent message in either direction.

Example: 2026-05-08T12:05:00.000Z
last_message_idstring · nullableOptional

ID of the most recent accessible message in the thread.

Example: 1700000000000789
sendersstring[]Optional

Distinct from addresses across the accessible messages.

Example: ["customer@example.com","support-tickets-1a2b3c4d@inbound-mailtrap.io"]
recipientsstring[]Optional

Distinct to/cc/bcc addresses across the accessible messages.

Example: ["support-tickets-1a2b3c4d@inbound-mailtrap.io","customer@example.com"]
get/api/inbound/inboxes/{inbox_id}/threads/{id}
curl -X GET https://mailtrap.io/api/inbound/inboxes/{inbox_id}/threads/{id} \
  -H 'Authorization: Bearer YOUR_API_KEY'
{
  "id": "1700000000000123",
  "subject": "Support request",
  "message_count": 3,
  "size": 24576,
  "first_message_at": "2026-05-08T10:30:00.000Z",
  "last_received_at": "2026-05-08T12:05:00.000Z",
  "last_sent_at": "2026-05-08T11:40:00.000Z",
  "last_activity_at": "2026-05-08T12:05:00.000Z",
  "last_message_id": "1700000000000789",
  "senders": [
    "customer@example.com",
    "support-tickets-1a2b3c4d@inbound-mailtrap.io"
  ],
  "recipients": [
    "support-tickets-1a2b3c4d@inbound-mailtrap.io",
    "customer@example.com"
  ],
  "attachments": [
    {
      "attachment_id": "att-1",
      "filename": "invoice.pdf",
      "size": 20480,
      "content_type": "application/pdf",
      "content_disposition": "attachment",
      "content_id": null,
      "download_url": "https://s3.amazonaws.com/inbound-mail/att-1?X-Amz-Signature=...",
      "download_url_expires_at": "2026-05-08T13:05:00.000Z"
    }
  ],
  "messages": [
    {
      "visibility_status": "available",
      "direction": "inbound",
      "id": "1700000000000123",
      "subject": "Support request",
      "rfc_message_id": "<abc@customer.example>",
      "in_reply_to": null,
      "references": [],
      "from": "customer@example.com",
      "to": [
        "support-tickets-1a2b3c4d@inbound-mailtrap.io"
      ],
      "cc": [],
      "bcc": [],
      "reply_to": null,
      "created_at": "2026-05-08T10:30:00.000Z",
      "email_size": 8192,
      "text_body": "I need help with my order.",
      "html_body": "<p>I need help with my order.</p>",
      "attachments": []
    },
    {
      "visibility_status": "available",
      "direction": "outbound",
      "id": "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
      "subject": "Re: Support request",
      "rfc_message_id": "<def@send.example>",
      "in_reply_to": "<abc@customer.example>",
      "references": [
        "<abc@customer.example>"
      ],
      "from": "support-tickets-1a2b3c4d@inbound-mailtrap.io",
      "to": [
        "customer@example.com"
      ],
      "cc": [],
      "bcc": [],
      "reply_to": null,
      "created_at": "2026-05-08T11:40:00.000Z",
      "email_size": 8192,
      "text_body": "Happy to help — could you share your order ID?",
      "html_body": "<p>Happy to help — could you share your order ID?</p>",
      "attachments": [],
      "delivery_status": "delivered",
      "delivered_at": "2026-05-08T11:40:05.000Z",
      "bounced_at": null
    },
    {
      "visibility_status": "placeholder",
      "direction": "inbound"
    }
  ]
}

Last updated

Was this helpful?