---
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-logs

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

# แสดงรายการบันทึก

บันทึกการส่งของคุณ ล่าสุดก่อน สูงสุด 50 รายการต่อหน้า กรองตามสถานะ ผู้รับ หัวเรื่อง โดเมน ผู้ส่ง และวันที่ ผสมกันได้ทุกแบบ

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

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

ตัวกรองรวมกันแบบ AND หากไม่มี `after` จะได้ 60 วันล่าสุด ซึ่งเป็นระยะเวลาที่เก็บบันทึก

อีเมล warm-up จะไม่แสดงที่นี่ และเนื้อหาอีเมลจะไม่อยู่ในรายการ ใช้ Get Logs พร้อม `include_content` เพื่ออ่าน

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

- `status` string | string[] ไม่บังคับ
`delivered`, `bounced`, `spam`, `rate_limited` หรือ `not_sent` หรือรายการของค่าเหล่านี้ หากไม่ระบุจะได้ทั้งห้าแบบ
เช่น `"bounced"`
- `recipient` string ไม่บังคับ
ที่อยู่อีเมลแบบเต็ม ไม่สนตัวพิมพ์ใหญ่เล็กและช่องว่างรอบข้าง
เช่น `"ana@acme.com"`
- `subject` string ไม่บังคับ
คำในหัวเรื่อง เป็นคำเต็ม และต้องมีทุกคำ: `order shipped` พบ "Your order #1042 has shipped" แต่ `ord` ไม่พบ ไม่สนวรรณยุกต์และตัวพิมพ์ใหญ่เล็ก
เช่น `"order shipped"`
- `search` string ไม่บังคับ
ข้อความอิสระ สำหรับช่องค้นหา หากมี `@` จะเป็นผู้รับ ไม่เช่นนั้นเป็นคำในหัวเรื่อง
เช่น `"ana@acme.com"`
- `domain` string ไม่บังคับ
โดเมนของผู้รับ แบบตรงทุกตัว
เช่น `"gmail.com"`
- `from` string ไม่บังคับ
ที่อยู่ของผู้ส่ง แบบตรงทุกตัว
เช่น `"noreply@yourdomain.com"`
- `after` string | number ไม่บังคับ
เฉพาะบันทึกที่ส่งตั้งแต่เวลานี้ ISO 8601, `YYYY-MM-DD` (เที่ยงคืน UTC) หรือมิลลิวินาที epoch ค่าเริ่มต้นคือ 60 วันก่อน
เช่น `"2026-10-01"`
- `before` string | number ไม่บังคับ
เฉพาะบันทึกที่ส่งก่อนเวลานี้ รูปแบบเดียวกัน
เช่น `"2026-10-17T00:00:00Z"`
- `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_logs",
        args: {
          status: "bounced",
          after: "2026-10-01",
          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_logs",
      "id": "0",
      "type": "SUCCESS",
      "took_ms": 18,
      "data": {
        "logs": [
          {
            "id": "9b7e4c21-0d3a-4e8f-a6b1-5c2d7e9f1a30",
            "to": "old.address@gmail.com",
            "from": "noreply@yourdomain.com",
            "domain": "gmail.com",
            "from_domain": "yourdomain.com",
            "subject": "Your order #1042 has shipped",
            "status": "bounced",
            "status_code": 6,
            "response": "550 5.1.1 The email account that you tried to reach does not exist.",
            "message": null,
            "blocked": false,
            "block_reason": null,
            "retries": 0,
            "tracking_id": "7CK-JDL-Z2M-20261017",
            "sent_at": "2026-10-17T05:58:44.031Z",
            "updated_at": "2026-10-17T05:58:45.600Z"
          }
        ],
        "count": 1,
        "has_more": true,
        "next_cursor": "MDAwMDAwMDA4MzowOjgyMzkzMTU5OTg3OTU6M2YyYTFi",
        "partial": false,
        "total": 1240,
        "total_exact": true
      }
    }
  ]
}
```

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

- `logs`
บันทึกของหน้านี้ ล่าสุดก่อน แต่ละรายการมีฟิลด์ด้านล่าง
- `count`
จำนวนบันทึกในหน้านี้
- `has_more / next_cursor`
ขณะที่ `has_more` เป็น `true` ให้ส่ง `next_cursor` เป็น `cursor` พร้อมตัวกรองเดิม
- `partial`
`true` เมื่อการค้นหาถึงขีดจำกัดเวลาก่อนเติมหน้าเต็ม หน้าอาจมีบันทึกน้อยลง หรือไม่มีเลย และ `next_cursor` จะทำต่อจากจุดที่หยุด
- `total / total_exact`
จำนวนบันทึกที่ตรงกับตัวกรอง เฉพาะหน้าแรก (คำขอที่ไม่มี `cursor`) ในหน้าถัดไปทั้งสองค่าเป็น `null` จึงควรเก็บค่าแรกไว้ `total` เป็นตัวเลขเฉพาะเมื่อแม่นยำ (`total_exact: true`) เมื่อ `total: null` และ `total_exact: false` แปลว่ามีมากเกินกว่าจะนับ เมื่อทั้งสองเป็น `null` การค้นหานั้นนับไม่ได้ (เช่น หัวเรื่องที่ไม่มีคำที่ทำดัชนีได้) ไม่ว่ากรณีใดให้แบ่งหน้าต่อด้วย `has_more`
- `logs[].id`
ID อีเมล (UUID) คือ `id` ที่ได้ตอนส่ง และเป็นค่าที่ส่งให้ Get Logs
- `logs[].to / logs[].domain`
ผู้รับและโดเมนของผู้รับ
- `logs[].from_domain`
โดเมนของผู้ส่ง (ส่วนหลัง @ ใน `from`)
- `logs[].from`
ที่อยู่ผู้ส่ง
- `logs[].subject`
บรรทัดหัวเรื่อง
- `logs[].status`
`delivered`, `bounced`, `spam`, `rate_limited` หรือ `not_sent` `status_code` คือค่าเดียวกันในรูปตัวเลข
- `logs[].response`
คำตอบของเซิร์ฟเวอร์ผู้รับ เช่น `250 2.0.0 OK` หรือเหตุผลการตีกลับ `550`
- `logs[].message`
รายละเอียดเพิ่มเติมจาก Sendcorex เกี่ยวกับการส่ง หากมี
- `logs[].blocked / logs[].block_reason`
`true` เมื่อ Sendcorex ไม่ได้ส่งถึงผู้รับนี้ (ถูกระงับหรือถูกจำกัด) พร้อมเหตุผล
- `logs[].retries`
จำนวนครั้งที่ลองส่งใหม่
- `logs[].tracking_id`
id ภายในของการส่ง webhook การตีกลับและการร้องเรียนมีค่าเดียวกัน
- `logs[].sent_at / logs[].updated_at`
เวลาที่ส่งอีเมล และเวลาที่สถานะเปลี่ยนล่าสุด ISO 8601, UTC

## สถานะ

- `delivered`
เซิร์ฟเวอร์ผู้รับรับอีเมลแล้ว
- `bounced`
เซิร์ฟเวอร์ผู้รับปฏิเสธอย่างถาวร: ไม่มีที่อยู่นี้ โดเมนไม่รับอีเมล…
- `spam`
เซิร์ฟเวอร์ผู้รับปฏิเสธเพราะเป็นสแปม
- `rate_limited`
เซิร์ฟเวอร์ผู้รับเลื่อนรับไปเรื่อย ๆ และการลองใหม่หมดลง
- `not_sent`
ไม่ได้ส่งเพราะบัญชีของคุณ (เช่น เครดิตหมด บัญชีถูกบล็อกหรือจำกัด โดเมนผู้ส่งอยู่ใน Spamhaus หรือไม่มี DKIM หรือ From ไม่ถูกต้อง) นี่ไม่ใช่การตีกลับ เหตุผลที่แน่นอนอยู่ใน `response`

อีเมลที่ยังรอการลองใหม่ยังไม่อยู่ที่นี่ จะแสดงเมื่อถึงหนึ่งในห้าสถานะนี้

## การแบ่งหน้า

ทำต่อขณะที่ `has_more` เป็น `true` อย่าหยุดที่หน้าสั้นหรือหน้าว่าง เมื่อ `partial` เป็น `true` แปลว่าการค้นหาหมดเวลาในการเรียกนั้น ไม่ใช่บันทึกหมด

Node.js

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

do {
  const [result] = await call({
    command: 'list_logs',
    args: { status: 'bounced', after: '2026-10-01', ...(cursor ? { cursor } : {}) },
  });
  logs.push(...result.data.logs);
  cursor = result.data.has_more ? result.data.next_cursor : null;
} while (cursor);
```

`call` คือ helper ใดก็ได้ที่ส่ง `{ commands: [...] }` ไปที่ `/v1/logs` แล้วส่งกลับ `results` เหมือนใน Run Commands

cursor ใช้ได้เฉพาะกับตัวกรองที่ได้มาเท่านั้น หากเปลี่ยนตัวกรองจะได้ `INVALID_CURSOR` ให้เริ่มใหม่โดยไม่มี cursor

## เฝ้าดูการตีกลับใหม่

หากต้องการตอบสนองต่อการตีกลับ (หรือเหตุการณ์อื่น) ทันทีที่เกิด ให้ poll โดยตั้ง `after` เป็น `sent_at` ล่าสุดที่คุณเห็น `after` รวมเวลานั้นด้วย บันทึกล่าสุดจึงกลับมาอีกครั้ง ให้ข้าม id ที่มีอยู่แล้ว

Node.js

```
const seen = new Set();
let since = new Date(Date.now() - 3600_000).toISOString(); // start with the last hour

setInterval(async () => {
  let cursor;
  do {
    const [result] = await call({
      command: 'list_logs',
      args: { status: 'bounced', after: since, ...(cursor ? { cursor } : {}) },
    });
    for (const log of result.data.logs) {
      if (seen.has(log.id)) continue;
      seen.add(log.id);
      if (log.sent_at > since) since = log.sent_at;
      await removeFromMyList(log.to, log.response); // your code
    }
    cursor = result.data.has_more ? result.data.next_cursor : null;
  } while (cursor);
}, 10_000);
```

การอ่านที่เหมือนกันภายใน 1.5 วินาทีจะใช้ผลลัพธ์ร่วมกัน worker หลายตัวที่ poll สิ่งเดียวกันจึงไม่เพิ่มโหลด หากต้องการอีเวนต์ทันทีที่เกิด ให้ใช้ webhook `bounced` แทน

## ตัวอย่างเพิ่มเติม

body ของคำขอ

```
{
  "commands": [
    {
      "command": "list_logs",
      "id": "ana",
      "args": {
        "recipient": "ana@acme.com"
      }
    },
    {
      "command": "list_logs",
      "id": "shipped",
      "args": {
        "subject": "order shipped",
        "status": "delivered",
        "after": "2026-10-10"
      }
    },
    {
      "command": "list_logs",
      "id": "gmail_spam",
      "args": {
        "domain": "gmail.com",
        "status": [
          "spam",
          "bounced"
        ]
      }
    },
    {
      "command": "list_logs",
      "id": "one_day",
      "args": {
        "after": "2026-10-16",
        "before": "2026-10-17",
        "limit": 20
      }
    }
  ]
}
```

## บันทึก

List Logs และ Get Logs ส่งกลับรูปแบบเดียวกัน

บันทึก

```
{
  "id": "3f2a1b4c-8e9d-4f7a-b2c3-1a2b3c4d5e6f",
  "to": "ana@acme.com",
  "from": "noreply@yourdomain.com",
  "domain": "acme.com",
  "from_domain": "yourdomain.com",
  "subject": "Your order #1042 has shipped",
  "status": "delivered",
  "status_code": 2,
  "response": "250 2.0.0 OK 1760684401 a1si123456",
  "message": null,
  "blocked": false,
  "block_reason": null,
  "retries": 0,
  "tracking_id": "7CK-JDL-Y1L-20261017",
  "sent_at": "2026-10-17T06:00:01.204Z",
  "updated_at": "2026-10-17T06:00:02.913Z"
}
```

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

ข้อผิดพลาดระดับ 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`
ข้อผิดพลาดของเซิร์ฟเวอร์ รายละเอียดเขียนเฉพาะในล็อกเซิร์ฟเวอร์
