Nhận email: quy tắc
List Rules
Các quy tắc của hộp thư theo thứ tự chạy, kèm số lần mỗi quy tắc khớp.
POST
https://g.sendcorex.com/v1command: list_rulesTham số
Endpoint này không có đối số.
Bắt đầu nhanh
import axios from 'axios';
const response = await axios.post(
'https://g.sendcorex.com/v1',
{
commands: [
{
command: "list_rules"
}
]
},
{ 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);Phản hồi
{
"type": "SUCCESS",
"results": [
{
"command": "list_rules",
"id": "0",
"type": "SUCCESS",
"data": {
"rules": [
{
"id": "Vj0xUlVMRTAx",
"rule_id": "Vj0xUlVMRTAx",
"name": "Clients always in Inbox",
"match": "all",
"conditions": [
{
"field": "from_domain",
"op": "in_list",
"value": "acme.com, globex.com"
},
{
"field": "provider",
"op": "is_any_of",
"value": [
"microsoft_365",
"google_workspace"
]
}
],
"except": [
{
"field": "subject",
"op": "contains",
"value": "newsletter"
}
],
"actions": [
{
"type": "keep_inbox"
},
{
"type": "label",
"value": "Clients"
},
{
"type": "star"
}
],
"stop": false,
"timezone": "Asia/Kuala_Lumpur",
"enabled": true,
"position": 0,
"hits": 128,
"last_hit_at": "2026-10-25T09:12:44Z",
"created_at": "2026-10-01T02:00:00Z",
"updated_at": "2026-10-20T08:30:00Z"
}
],
"max_rules": 100
}
}
]
}Trường phản hồi
rules[]Theo thứ tự thực thi (
position).hitsvàlast_hit_atcho thấy quy tắc nào thực sự được dùng.max_rulesTối đa 100 quy tắc mỗi hộp thư.
Lỗi
Lỗi ở mức HTTP trả về type, code và message. Lỗi đánh dấu CMD được trả về trong kết quả lệnh, với HTTP 200.
- 401
TOKEN_EXPIREDAccess token đã hết hạn. Gọi Refresh Token và lặp lại yêu cầu.
- 401
INVALID_TOKENToken sai định dạng, không xác định hoặc đã bị thu hồi.
- 429
RATE_LIMITEDHơn 15 yêu cầu/giây hoặc 15 yêu cầu đồng thời cho cùng IP + hộp thư. Chờ số giây trong Retry-After.
- CMD
INTERNALLỗi máy chủ. Chi tiết chỉ được ghi vào log máy chủ.