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

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

# ดูบันทึก

อ่านบันทึกสูงสุด 50 รายการตาม ID อีเมล ซึ่งคือ `id` ที่ได้ตอนส่ง เพิ่ม `include_content` เพื่อรับ HTML ที่ส่งถึง

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

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

การค้นหา ID มีต้นทุนเท่ากันไม่ว่าคุณจะส่งอีเมลมากแค่ไหน เพราะไม่มีการสแกนอยู่เบื้องหลัง

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

- `ids` string[] ไม่บังคับ
ID อีเมลสูงสุด 50 รายการ (UUID) id ที่ซ้ำนับครั้งเดียว
เช่น `["3f2a1b4c-8e9d-4f7a-b2c3-1a2b3c4d5e6f"]`
- `id` string ไม่บังคับ
ID อีเมลรายการเดียว ใช้ค่านี้หรือ `ids`
เช่น `"3f2a1b4c-8e9d-4f7a-b2c3-1a2b3c4d5e6f"`
- `include_content` boolean ไม่บังคับ
ส่งกลับ HTML ของแต่ละอีเมลด้วย เมื่อใช้ ขีดจำกัดคือ 10 id ต่อคำสั่ง
เช่น `true`

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

```
import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1/logs',
  {
    commands: [
      {
        command: "get_logs",
        args: {
          ids: [
            "3f2a1b4c-8e9d-4f7a-b2c3-1a2b3c4d5e6f",
            "00000000-0000-4000-8000-000000000000"
          ]
        }
      }
    ]
  },
  { 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": "get_logs",
      "id": "0",
      "type": "SUCCESS",
      "took_ms": 18,
      "data": {
        "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"
          }
        ],
        "not_found": [
          "00000000-0000-4000-8000-000000000000"
        ]
      }
    }
  ]
}
```

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

- `logs`
บันทึกที่พบ ตามลำดับที่คุณขอ
- `not_found`
id ที่ไม่มีในบัญชีของคุณ เก่ากว่า 60 วัน หรือเป็นของอีเมล warm-up
- `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
- `logs[].content.html`
HTML ที่ส่งถึง เฉพาะเมื่อ `include_content: true` เป็น `null` เมื่อไม่ได้เก็บเนื้อหาไว้

## การอ่านเนื้อหา

เนื้อหาเป็นส่วนที่หนักที่สุดของบันทึก จึงส่งกลับเฉพาะเมื่อขอ เป็น HTML ตามที่ส่งถึง หากเปิด tracking อยู่ อาจมีพิกเซล tracking และลิงก์ที่ถูกเขียนใหม่

body ของคำขอ

```
{
  "commands": [
    {
      "command": "get_logs",
      "args": {
        "id": "3f2a1b4c-8e9d-4f7a-b2c3-1a2b3c4d5e6f",
        "include_content": true
      }
    }
  ]
}
```

การแสดง HTML นั้นอาจโหลดพิกเซล tracking และนับเป็นการเปิด ให้แสดงใน iframe แบบ sandbox ที่บล็อกรูปภาพภายนอก แบบเดียวกับที่แดชบอร์ดทำ

## รายละเอียดของหน้าหนึ่งของ List Logs

เชื่อมสองคำสั่งด้วย `$ref`: id จากรายการจะส่งตรงเข้า Get Logs ในคำขอเดียว

body ของคำขอ

```
{
  "commands": [
    {
      "command": "list_logs",
      "id": "bounces",
      "args": {
        "status": "bounced",
        "limit": 10
      }
    },
    {
      "command": "get_logs",
      "args": {
        "ids": {
          "$ref": "bounces",
          "path": "logs/*/id"
        },
        "include_content": true
      }
    }
  ]
}
```

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

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