รับอีเมล: ผู้ติดต่อและกลุ่มเป้าหมาย
List Segments
แสดงกลุ่มที่บันทึกไว้ของกล่องจดหมายนี้ พร้อมฟิลด์กำหนดเองและยอดรวม อ่านอย่างเดียว
POST
https://g.sendcorex.com/v1command: list_segmentsอาร์กิวเมนต์
endpoint นี้ไม่มีอาร์กิวเมนต์
เริ่มต้นอย่างรวดเร็ว
import axios from 'axios';
const response = await axios.post(
'https://g.sendcorex.com/v1',
{
commands: [
{
command: "list_segments"
}
]
},
{ 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_segments",
"id": "0",
"type": "SUCCESS",
"data": {
"segments": [
{
"segment_id": "seg_8Hq2",
"name": "Opened in 30 days",
"where": {
"last_open_at": {
"within_days": 30
}
},
"sort": null,
"created_at": "2026-11-21T10:00:00Z",
"updated_at": "2026-11-21T10:00:00Z"
}
],
"fields": [
{
"key": "plan",
"name": "Plan",
"type": "enum",
"options": [
"free",
"pro"
]
}
],
"stats": {
"total": 1240
}
}
}
]
}ฟิลด์การตอบกลับ
segments[]segment_id,name,where,sort,created_atและupdated_atfieldsฟิลด์กำหนดเองของบัญชี สร้างในแดชบอร์ด
statsยอดรวมผู้ติดต่อของกล่องจดหมายนี้
ข้อผิดพลาด
ข้อผิดพลาดระดับ HTTP ส่งกลับ type, code และ message ข้อผิดพลาดที่มีเครื่องหมาย CMD จะกลับมาในผลลัพธ์ของคำสั่ง พร้อม HTTP 200
- 401
TOKEN_EXPIREDaccess token หมดอายุแล้ว เรียก Refresh Token แล้วส่งคำขอซ้ำ
- 401
INVALID_TOKENโทเค็นผิดรูปแบบ ไม่รู้จัก หรือถูกเพิกถอน
- 429
RATE_LIMITEDเกิน 15 คำขอ/วินาที หรือ 15 คำขอพร้อมกันสำหรับ IP + กล่องจดหมายเดียวกัน รอจำนวนวินาทีใน Retry-After
- CMD
INTERNALข้อผิดพลาดของเซิร์ฟเวอร์ รายละเอียดเขียนเฉพาะในล็อกเซิร์ฟเวอร์