---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://docs.sendcorex.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://docs.sendcorex.com/llms.txt"
---

Source: https://docs.sendcorex.com/api-reference/receive-emails/reading/get-thread

Receive Emails: Reading

# Get Thread

Open a whole conversation: its summary and every message in chronological order, optionally with the bodies.

POST `https://g.sendcorex.com/v1` command: get_thread

## Arguments

- `thread_id` string optional
The conversation id.
- `id` string optional
The id of any message in the conversation. Use this or `thread_id`.
- `include_body` boolean optional
`true` adds `body` (`html` and `text`) to every message.

## Quick start

```
import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1',
  {
    commands: [
      {
        command: "get_thread",
        args: {
          id: "Vj0xQUJDMTIz",
          include_body: true
        }
      }
    ]
  },
  { headers: { Authorization: process.env.SENDCOREX_TOKEN } },
);

const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);
```

## Response

```
{
  "type": "SUCCESS",
  "results": [
    {
      "command": "get_thread",
      "id": "0",
      "type": "SUCCESS",
      "data": {
        "thread": {
          "thread_id": "thr_9a1c4e72",
          "subject": "Invoice for September",
          "participants": [
            "ana@client.com",
            "you@yourdomain.com"
          ],
          "last_senders": [
            "ana@client.com"
          ],
          "message_count": 2,
          "unread_count": 1,
          "folders": [
            "INBOX",
            "Sent"
          ]
        },
        "messages": [
          {
            "message_uid": "Vj0xQUJDMDA5",
            "message_id": "<4c1d…@mail.client.com>",
            "in_reply_to": null,
            "parent_uid": null,
            "depth": 0,
            "folders": [
              "INBOX"
            ],
            "from_name": "Ana Costa",
            "from_email": "ana@client.com",
            "direction": "inbound",
            "to": [
              {
                "email": "you@yourdomain.com"
              }
            ],
            "reply_to": [],
            "subject": "Invoice for September",
            "preview": "Hi, attached is the invoice for September…",
            "is_read": true,
            "is_starred": false,
            "is_important": false,
            "has_attachments": false,
            "received_at": "2026-10-09T09:02:41Z",
            "body": {
              "html": "<p>Hi, attached is the invoice for September.</p>",
              "text": "Hi, attached is the invoice for September."
            }
          }
        ]
      }
    }
  ]
}
```

### Response fields

- `thread`
The conversation summary: `thread_id`, `subject`, `participants`, `last_senders`, `message_count`, `unread_count` and `folders`.
- `messages[]`
Messages in chronological order.
- `messages[].message_uid / message_id`
The mailbox id and the SMTP Message-ID.
- `messages[].in_reply_to / parent_uid / depth`
Where the message sits in the reply tree.
- `messages[].direction`
`inbound` or `outbound`.
- `messages[].from_name / from_email / to / reply_to`
Envelope data.
- `messages[].subject / preview`
Subject and preview.
- `messages[].is_read / is_starred / is_important / has_attachments`
Message state.
- `messages[].received_at`
When the message was received or sent.
- `messages[].body`
Only with `include_body: true`: `{ html, text }`.

## Errors

HTTP-level errors return `type`, `code` and `message`. Errors marked CMD come back inside the command result, with HTTP 200.

- 401`TOKEN_EXPIRED`
The access token has expired. Call Refresh Token and repeat the request.
- 401`INVALID_TOKEN`
The token is malformed, unknown or revoked.
- 429`RATE_LIMITED`
More than 15 requests/s or 15 in flight for the same IP + mailbox. Wait the number of seconds in Retry-After.
- CMD`INVALID_ARGS`
A required argument is missing or invalid.
- CMD`NOT_FOUND`
The message, thread or folder does not exist for this token.
- CMD`INTERNAL`
Server error. The detail is only written to the server log.
