---
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/list-drafts

メールの受信：下書き

# List Drafts

メールボックスの下書きを新しい順に一覧表示します。下書きフォルダーでのlist_messagesと同じ結果です。

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

Webmailで保存した下書きもここに表示されます。本文と添付ファイル付きで読むにはget_draftを使います。

## 引数

- `limit` number 任意
1ページあたりの件数（1〜100）。デフォルトは25。
- `cursor` string 任意
前のページの`next_cursor`。
- `after` string 任意
この時刻より後に保存された下書きのみ（RFC 3339、`YYYY-MM-DD`、エポックミリ秒）。
- `before` string 任意
この時刻より前に保存された下書きのみ。

## クイックスタート

```
import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1',
  {
    commands: [
      {
        command: "list_drafts",
        args: {
          limit: 25
        }
      }
    ]
  },
  { 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": "list_drafts",
      "id": "0",
      "type": "SUCCESS",
      "data": {
        "messages": [
          {
            "message_uid": "Vj0xRFJBRlQx",
            "thread_id": "thr_9a1c4e72",
            "folder": "Drafts",
            "subject": "Proposal",
            "preview": "Hi Ana, here is the proposal.",
            "from_name": "Marcos",
            "from_email": "marcos@yourdomain.com",
            "has_attachments": true,
            "size_bytes": 2210,
            "is_read": true,
            "is_starred": false,
            "is_important": false,
            "is_spam": false,
            "snoozed_until": null,
            "received_at": "2026-10-27T02:10:00Z"
          }
        ],
        "has_more": false,
        "next_cursor": null
      }
    }
  ]
}
```

### レスポンスの項目

- `messages[].message_uid`
`draft_id`。
- `messages[].received_at`
下書きを最後に保存した日時。
- `has_more / next_cursor`
次のページを取得するには`next_cursor`を`cursor`として送ります。

## エラー

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`INVALID_CURSOR`
カーソルが不正か、別のアカウントまたはフォルダーのものです。
- CMD`INTERNAL`
サーバーエラー。詳細はサーバーのログにのみ記録されます。
