メールの受信:読み取り
Get Thread
会話全体を開きます:概要と、時系列のすべてのメッセージ。本文を含めることもできます。
POST
https://g.sendcorex.com/v1command: get_thread引数
thread_idstring任意会話のid。
idstring任意会話内の任意のメッセージのid。これか
thread_idを使います。include_bodyboolean任意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[].directioninboundまたは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[].bodyinclude_body: trueの場合のみ:{ html, text }。
エラー
HTTPレベルのエラーはtype、code、messageを返します。CMDと表示されたエラーは、HTTP 200でコマンドの結果内に返ります。
- 401
TOKEN_EXPIREDaccess tokenの有効期限が切れました。Refresh Tokenを呼んでリクエストを繰り返してください。
- 401
INVALID_TOKENトークンの形式が不正、不明、または取り消されています。
- 429
RATE_LIMITED同じIP + メールボックスで毎秒15リクエストまたは同時15件を超えました。Retry-Afterの秒数だけ待ってください。
- CMD
INVALID_ARGS必須の引数がないか不正です。
- CMD
NOT_FOUNDこのトークンでは、そのメッセージ、スレッド、フォルダーは存在しません。
- CMD
INTERNALサーバーエラー。詳細はサーバーのログにのみ記録されます。