API reference

อีเมลและเธรด

ส่ง ดึง ค้นหา ตอบกลับ และตรวจสอบอีเวนต์การส่งถึง

POST/emails
API key

ส่งอีเมลหนึ่งฉบับ

ส่งเนื้อหา HTML ข้อความ หรือเทมเพลตแบบโฮสต์ประเภท transactional จากโดเมนเวิร์กสเปซที่ยืนยันแล้ว การส่งโดยตรงสามารถตั้ง message_class เป็น marketing ได้เมื่อเปิดใช้สำหรับโดเมนผู้ส่งที่ยืนยันแล้ว Marketing จะเพิ่มเฮดเดอร์ยกเลิกการรับที่จัดการให้ เว้นแต่การเชื่อมต่อ first-party ที่ตั้งค่าไว้จะจัดหา URL แบบคลิกเดียว HTTPS ที่มองเห็นได้ของตนเอง

เฮดเดอร์ที่ไม่บังคับIdempotency-Key
คำขอ
curl https://sendhq.cc/api/v1/emails \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"from":"Acme <hello@example.com>","to":["customer@example.net"],"subject":"Welcome aboard","html":"<h1>Welcome</h1><p>Your workspace is ready.</p>","text":"Welcome. Your workspace is ready."}'
การตอบกลับ 201
{
  "id": "em_…",
  "providerMessageId": "provider-id",
  "threadId": "em_…"
}
POST/emails/batch
API key

ส่งข้อความที่ปรับแต่งเฉพาะรายได้สูงสุด 100 ฉบับ

ส่งข้อความที่ปรับแต่งเฉพาะรายได้สูงสุด 100 ฉบับ

เฮดเดอร์ที่ไม่บังคับIdempotency-Key
คำขอ
curl https://sendhq.cc/api/v1/emails/batch \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"emails":[{"from":"Acme <hello@example.com>","to":["customer@example.net"],"subject":"Welcome aboard","html":"<h1>Welcome</h1><p>Your workspace is ready.</p>","text":"Welcome. Your workspace is ready."}]}'
การตอบกลับ 201
{
  "data": [
    {
      "index": 0,
      "ok": true,
      "id": "em_…"
    }
  ],
  "count": 1,
  "successful": 1,
  "failed": 0
}
GET/emails
API key

แสดงรายการอีเมลที่ส่งและได้รับ

Newest-first list with filters. `query` searches subjects, bodies, participants, and attachment filenames. `label`, `domain`, and `category` accept one value or a comma-separated list (matches any); labels may be IDs or names. `outcome` filters sent mail to `bounced`, `complained`, `failed`, or `rejected` (comma-separated, matches any). `archived=false` returns the Inbox view for received mail. Received mail is classified as `primary`, `updates` (newsletters, bulk, and automated mail), or `spam`, and flagged `important`; spam is excluded unless `category=spam` or `include_spam=true`.

Query parametersdirectionstatusoutcomedomaininbox_idlabelarchivedcategoryimportantinclude_spamfromtounreadafterbeforequerylimitoffset
คำขอ
curl https://sendhq.cc/api/v1/emails \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
การตอบกลับ 200
{
  "data": [],
  "count": 0
}
GET/emails/:id
API key

ดึงอีเมลและไฟล์แนบ

ดึงอีเมลและไฟล์แนบ

คำขอ
curl https://sendhq.cc/api/v1/emails/id_value \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
การตอบกลับ 200
{
  "id": "em_…",
  "direction": "out",
  "status": "sent",
  "attachments": []
}
PATCH/emails/:id
API key

อัปเดตสถานะอ่านแล้ว การเก็บถาวร สแปม หมวดหมู่ หรือความสำคัญ

ตั้งค่า `read`, `archived`, `category` (`primary`, `updates` หรือ `spam` เฉพาะอีเมลที่ได้รับ) และ `important` การเปลี่ยน `category` หรือ `important` เป็นการสอนให้ SendHQ รู้จักผู้ส่ง คือ การรายงานสแปมจะทำให้อีเมลในอนาคตของผู้ส่งรายนั้นไปอยู่ในสแปม `Not spam` จะแทนที่การตรวจสอบสแปมอัตโนมัติสำหรับผู้ส่งนั้น และความสำคัญจะผูกกับผู้ส่ง ส่ง `learn: false` เพื่อเปลี่ยนเฉพาะข้อความนี้

คำขอ
curl https://sendhq.cc/api/v1/emails/id_value \
  -X PATCH \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"category":"spam"}'
การตอบกลับ 200
{
  "id": "em_…",
  "readAt": "2026-08-23T12:00:00.000Z",
  "archivedAt": null,
  "category": "spam",
  "important": false,
  "classification": "you moved it here"
}
DELETE/emails/:id
API key

ลบอีเมลที่เก็บรักษาไว้

ลบอีเมลที่เก็บรักษาไว้

คำขอ
curl https://sendhq.cc/api/v1/emails/id_value \
  -X DELETE \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
การตอบกลับ 200
{
  "ok": true
}
GET/emails/:id/events
API key

แสดงรายการอีเวนต์การส่งของอีเมลฉบับหนึ่ง

แสดงรายการอีเวนต์การส่งของอีเมลฉบับหนึ่ง

คำขอ
curl https://sendhq.cc/api/v1/emails/id_value/events \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
การตอบกลับ 200
{
  "data": [],
  "count": 0
}
GET/threads/:id
API key

ดึงบทสนทนาเรียงตามลำดับเวลา

ดึงบทสนทนาเรียงตามลำดับเวลา

คำขอ
curl https://sendhq.cc/api/v1/threads/id_value \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
การตอบกลับ 200
{
  "id": "em_…",
  "data": [],
  "count": 0
}
GET/emails/:id/delivery
API key

Delivery timeline for one email, with bounce and complaint reasons

Delivery timeline for one email, with bounce and complaint reasons

คำขอ
curl https://sendhq.cc/api/v1/emails/id_value/delivery \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
การตอบกลับ 200
{
  "emailId": "em_123",
  "status": "bounced",
  "timeline": [],
  "count": 0,
  "limit": 50,
  "offset": 0
}
GET/threads/:id/delivery
API key

Per-thread delivery counts and per-message failure reasons

Per-thread delivery counts and per-message failure reasons

คำขอ
curl https://sendhq.cc/api/v1/threads/id_value/delivery \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
การตอบกลับ 200
{
  "threadId": "thr_123",
  "delivered": 0,
  "bounced": 0,
  "complained": 0,
  "failed": 0,
  "messages": []
}