---
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/th/api-reference/logs/reading/list-scheduled

บันทึก: การอ่าน

# List Scheduled

อีเมลที่คุณตั้งเวลาผ่าน Email API (`scheduledAt`) หรือแคมเปญที่ยังไม่ได้ส่ง อีเมลที่จะส่งถัดไปอยู่ก่อน

POST `https://g.sendcorex.com/v1/logs` command: list_scheduled

ต้องมี scope `logs:read` ใน API key ของคุณ

เมื่ออีเมลถูกส่งจะแสดงใน List Logs เมื่อถูกยกเลิกจะหายจากรายการนี้ ข้อความที่ตั้งเวลาในเว็บเมลไม่อยู่ที่นี่ แต่อยู่ในโฟลเดอร์ Scheduled ของกล่องจดหมาย

เมื่อ `scheduled_at` ผ่านไปแล้ว อีเมลกำลังถูกส่งอยู่ในขณะนี้และจะย้ายไปที่ List Logs ภายในไม่กี่วินาที

## อาร์กิวเมนต์

- `limit` number ไม่บังคับ
จำนวนอีเมลต่อหน้า 1 ถึง 50 ค่าเริ่มต้น 50
เช่น `50`
- `cursor` string ไม่บังคับ
`next_cursor` จากหน้าก่อนหน้า

## เริ่มต้นอย่างรวดเร็ว

```
import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1/logs',
  {
    commands: [
      {
        command: "list_scheduled",
        args: {
          limit: 50
        }
      }
    ]
  },
  { headers: { Authorization: process.env.SENDCOREX_API_KEY } },
);

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_scheduled",
      "id": "0",
      "type": "SUCCESS",
      "took_ms": 18,
      "data": {
        "scheduled": [
          {
            "id": "3f2a1b4c-8e9d-4f7a-b2c3-1a2b3c4d5e6f",
            "from": "news@yourdomain.com",
            "to": "ana@acme.com",
            "subject": "Your order shipped",
            "scheduled_at": "2026-12-01T09:00:00.000Z",
            "source": "api",
            "created_at": "2026-11-28T03:10:00.000Z"
          },
          {
            "id": "9b7e2c1a-4d5f-4e6a-8b9c-0d1e2f3a4b5c",
            "from": "hello@yourdomain.com",
            "to": "bruno@acme.com",
            "subject": "December news",
            "scheduled_at": "2026-12-02T14:30:00.000Z",
            "source": "campaign",
            "campaign_id": "c_4f2a91",
            "created_at": "2026-11-27T18:00:00.000Z"
          }
        ],
        "count": 2,
        "has_more": true,
        "next_cursor": "MDAwMDAwMDA4MzowOjgyMzkzMTU5OTg3OTU6M2YyYTFi"
      }
    }
  ]
}
```

### ฟิลด์การตอบกลับ

- `scheduled`
อีเมลที่ตั้งเวลาของหน้านี้ รายการที่จะส่งถัดไปก่อน
- `count`
จำนวนอีเมลในหน้านี้
- `has_more / next_cursor`
ขณะที่ `has_more` เป็น `true` ให้ส่ง `next_cursor` เป็น `cursor` เพื่อรับหน้าถัดไป ไม่มีจำนวนรวม
- `scheduled[].id`
ID อีเมล คือ `id` เดียวกับที่คุณได้รับตอนส่ง
- `scheduled[].from / scheduled[].to`
ที่อยู่ผู้ส่งและผู้รับ
- `scheduled[].subject`
หัวเรื่องของอีเมล
- `scheduled[].scheduled_at`
เวลาที่อีเมลจะถูกส่ง (ISO 8601, UTC)
- `scheduled[].source / scheduled[].campaign_id`
`api` สำหรับ Email API, `campaign` สำหรับแคมเปญ เมื่อเป็น `campaign` จะมีค่า `campaign_id`
- `scheduled[].created_at`
เวลาที่ตั้งเวลาอีเมล (ISO 8601, UTC)

## การอ่านทุกหน้า

เรียกต่อด้วย `next_cursor` จนกว่า `has_more` เป็น `false`

Node.js

```
const scheduled = [];
let cursor;

do {
  const [result] = await call({
    command: 'list_scheduled',
    args: { limit: 50, ...(cursor ? { cursor } : {}) },
  });
  scheduled.push(...result.data.scheduled);
  cursor = result.data.has_more ? result.data.next_cursor : null;
} while (cursor);
```

## ข้อผิดพลาด

ข้อผิดพลาดระดับ HTTP ส่งกลับ `type`, `code` และ `message` ข้อผิดพลาดที่มีเครื่องหมาย CMD จะกลับมาในผลลัพธ์ของคำสั่ง พร้อม HTTP 200

- 401`INVALID_API_KEY`
API key ไม่มีอยู่ ถูกเพิกถอน หรือถูกปิดในแดชบอร์ด
- 429`RATE_LIMITED`
เกิน 15 คำขอ/วินาที หรือ 15 คำขอพร้อมกันสำหรับ IP + API key เดียวกัน รอจำนวนวินาทีใน Retry-After
- CMD`MISSING_SCOPE`
API key ไม่มี `logs:read`
- CMD`INVALID_ARGS`
อาร์กิวเมนต์ไม่ถูกต้อง: สถานะที่ไม่รู้จัก ผู้รับที่ไม่ใช่อีเมลเต็ม limit อยู่นอกช่วง id ที่ไม่ใช่ UUID after อยู่หลัง before…
- CMD`INVALID_CURSOR`
cursor รูปแบบไม่ถูกต้อง หรือมาจากการค้นหาหรือบัญชีอื่น ให้เริ่มใหม่โดยไม่มี cursor
- CMD`INTERNAL`
ข้อผิดพลาดของเซิร์ฟเวอร์ รายละเอียดเขียนเฉพาะในล็อกเซิร์ฟเวอร์
