---
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/ja/api-reference/receive-emails/reading/get-thread

メールの受信：読み取り

# Get Thread

会話全体を開きます：概要と、時系列のすべてのメッセージ。本文を含めることもできます。

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

## 引数

- `thread_id` string 任意
会話のid。
- `id` string 任意
会話内の任意のメッセージのid。これか`thread_id`を使います。
- `include_body` boolean 任意
`true`で各メッセージに`body`（`html`と`text`）を追加します。

## クイックスタート

```
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);
```

## レスポンス

```
{
  "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."
            }
          }
        ]
      }
    }
  ]
}
```

### レスポンスの項目

- `thread`
会話の概要：`thread_id`、`subject`、`participants`、`last_senders`、`message_count`、`unread_count`、`folders`。
- `messages[]`
時系列順のメッセージ。
- `messages[].message_uid / message_id`
メールボックス内のidとSMTPのMessage-ID。
- `messages[].in_reply_to / parent_uid / depth`
返信ツリー内でのメッセージの位置。
- `messages[].direction`
`inbound`または`outbound`。
- `messages[].from_name / from_email / to / reply_to`
エンベロープのデータ。
- `messages[].subject / preview`
件名とプレビュー。
- `messages[].is_read / is_starred / is_important / has_attachments`
メッセージの状態。
- `messages[].received_at`
メッセージを受信または送信した日時。
- `messages[].body`
`include_body: true`の場合のみ：`{ html, text }`。

## エラー

HTTPレベルのエラーは`type`、`code`、`message`を返します。CMDと表示されたエラーは、HTTP 200でコマンドの結果内に返ります。

- 401`TOKEN_EXPIRED`
access tokenの有効期限が切れました。Refresh Tokenを呼んでリクエストを繰り返してください。
- 401`INVALID_TOKEN`
トークンの形式が不正、不明、または取り消されています。
- 429`RATE_LIMITED`
同じIP + メールボックスで毎秒15リクエストまたは同時15件を超えました。Retry-Afterの秒数だけ待ってください。
- CMD`INVALID_ARGS`
必須の引数がないか不正です。
- CMD`NOT_FOUND`
このトークンでは、そのメッセージ、スレッド、フォルダーは存在しません。
- CMD`INTERNAL`
サーバーエラー。詳細はサーバーのログにのみ記録されます。
