---
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/drafts/get-draft

メールの受信：下書き

# Get Draft

編集用に下書きを1件読み取ります：受信者、件名、本文、添付ファイル、フォローアップ。

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

## 引数

- `id` string 必須
`draft_id`。

## クイックスタート

```
import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1',
  {
    commands: [
      {
        command: "get_draft",
        args: {
          id: "Vj0xRFJBRlQx"
        }
      }
    ]
  },
  { 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_draft",
      "id": "0",
      "type": "SUCCESS",
      "data": {
        "draft_id": "Vj0xRFJBRlQx",
        "thread_id": "thr_9a1c4e72",
        "mode": "new",
        "to": "ana@client.com",
        "cc": [],
        "bcc": [],
        "subject": "Proposal",
        "html": "<p>Hi Ana, here is the proposal.</p>",
        "updated_at": "2026-10-27T02:10:00Z",
        "compose_uid": "Vj0xQ01QMDAx",
        "track_opens": true,
        "track_clicks": false,
        "unsubscribe": false,
        "attachments": [
          {
            "attachment_id": "6f1c2a9e-4b7d-4e21-9a3f-0c8d5e7b1a42",
            "file_name": "proposal.pdf",
            "mime_type": "application/pdf",
            "size_bytes": 182340
          }
        ]
      }
    }
  ]
}
```

### レスポンスの項目

- `mode`
`new`、`reply`、`forward`。
- `to_emails`
`to`のすべてのアドレス。`to`は引き続き最初のアドレスです。
- `id`
`reply`と`forward`の場合の元のメッセージ。`new`ではありません。
- `updated_at`
下書きを最後に保存した日時。
- `compose_uid / attachments`
下書きのファイル。追加するには、新しいアップロードと一緒に`compose_uid`を送り返します。
- `followup_after_hours`
フォローアップのリマインダー（ある場合）。
- `track_opens / track_clicks / unsubscribe`
下書きに保存されたトラッキングの選択。下書きにある場合のみ返されます。
- `last_send_error`
予約送信が拒否されて下書きに戻った場合のみ：拒否された理由。

## エラー

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`DRAFT_NOT_FOUND`
下書きはもう存在しません。送信、削除、または再保存されました（保存のたびに新しいdraft_idが返ります）。
- CMD`INTERNAL`
サーバーエラー。詳細はサーバーのログにのみ記録されます。
