---
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/vi/api-reference/errors

Tham chiếu API

# Mã lỗi

Mọi mã lỗi API có thể trả về, kèm trạng thái HTTP và cách xử lý. Send và Receive dùng định dạng lỗi khác nhau.

## Gửi email

Lỗi trả về một đối tượng JSON với `error`, `code` và `responseTime`. Xem [Gửi email](https://docs.sendcorex.com/vi/api-reference/email/send) .

- 401`MISSING_AUTH_HEADER`
Không có header Authorization.
- 401`INVALID_API_KEY`
API key không hợp lệ hoặc đã bị thu hồi.
- 401`ACCOUNT_BLOCKED`
Tài khoản đã bị khóa.
- 401`NO_CREDITS_LEFT`
Không đủ credit email cho mọi người nhận. Mỗi địa chỉ to, cc và bcc dùng 1 credit.
- 401`DOMAIN_NOT_VALIDATED`
Tên miền người gửi chưa xác minh.
- 401`LISTED_SPAM_HAUS`
Tên miền người gửi bị liệt kê trên Spamhaus.
- 401`ISP_DOMAIN_BLOCKED`
Không được gửi từ tên miền phổ biến (gmail.com, outlook.com, v.v.).
- 401`FROM_HEADER_DOMAIN_MISMATCH`
Tên miền trong header From không được phép cho người gửi này.
- 401`USER_NOT_FOUND`
Không tìm thấy người dùng.
- 401`MISSING_USER_PRIVILEGES`
Thiếu quyền người dùng.
- 401`EMAIL_CREDITS_NOT_FOUND`
Lỗi khi lấy credit email.
- 401`EMAIL_NOT_VALIDATED`
Địa chỉ email của tài khoản chưa được xác minh.
- 429`CREDENTIAL_TEMPORARILY_BLOCKED`
API key tạm thời bị chặn do vi phạm chính sách nhiều lần.
- 429`IP_TEMPORARILY_BLOCKED`
IP gửi yêu cầu tạm thời bị chặn do vi phạm chính sách nhiều lần.
- 429`TOO_MANY_CONCURRENT_CONNECTIONS`
Quá nhiều yêu cầu đồng thời từ IP này. Thử lại sau giây lát.
- 400`INVALID_JSON`
Body yêu cầu không phải JSON hợp lệ.
- 400`MISSING_FROM`
Trường from bị thiếu hoặc trống.
- 400`INVALID_FROM_FORMAT`
Trường from phải là địa chỉ email hợp lệ.
- 400`MISSING_SENDERNAME`
Trường senderName bị thiếu hoặc trống.
- 400`INVALID_SENDERNAME_FORMAT`
Trường senderName chứa ký tự không hợp lệ.
- 400`MISSING_SUBJECT`
Trường subject bị thiếu hoặc trống.
- 400`MISSING_BODY`
Trường body bị thiếu hoặc trống.
- 400`MISSING_TOADDRESS`
Trường to bị thiếu hoặc trống.
- 400`MISSING_TO`
Trường to bị thiếu hoặc trống.
- 400`INVALID_TOADDRESS`
Một hoặc nhiều địa chỉ người nhận sai định dạng.
- 400`TOADDRESS_LIMIT_EXCEEDED`
Hơn 50 người nhận trong mảng to.
- 400`INVALID_CCADDRESS`
Một hoặc nhiều địa chỉ cc sai định dạng.
- 400`INVALID_BCCADDRESS`
Một hoặc nhiều địa chỉ bcc sai định dạng.
- 400`RECIPIENT_LIMIT_EXCEEDED`
to, cc và bcc gộp lại có hơn 50 người nhận duy nhất.
- 400`INVALID_SCHEDULED_AT`
scheduled_at không phải ngày hợp lệ hoặc đã ở quá khứ.
- 400`INVALID_SENDER_FORMAT`
Định dạng email người gửi không hợp lệ.
- 400`HEADER_NOT_ALLOWED`
Khóa header tùy chỉnh không có trong danh sách cho phép (List-Unsubscribe, List-Id, X-*, v.v.).
- 400`INVALID_HEADER_VALUE`
Giá trị header chứa ký tự không hợp lệ (không cho phép CR/LF).
- 400`DANGEROUS_ATTACHMENT`
Một hoặc nhiều tệp đính kèm bị chặn vì lý do bảo mật.
- 400`INVALID_ATTACHMENT`
Nội dung tệp đính kèm không phải base64 hợp lệ.
- 400`MISSING_UNSUBSCRIBE_PLACEHOLDER`
unsubscribe là true nhưng body không có biến giữ chỗ hủy đăng ký ([unsubscribe_url], [unsubscribe], [unsub_url] hoặc [opt_out_url]).
- 403`ACCOUNT_RESTRICTED`
Tài khoản tạm thời bị hạn chế.
- 403`DAILY_LIMIT`
Đã đạt giới hạn gửi email hằng ngày.
- 403`MARKETING_LIMIT_REACHED`
Đã đạt giới hạn marketing hằng ngày của gói miễn phí: 30 email marketing hoặc cold outreach mỗi ngày, tính theo người nhận trong khung 24 giờ trượt. Phản hồi gồm limit, used, recipients và upgradeUrl. Email giao dịch vẫn được gửi; không có gì vào hàng đợi.
- 403`FORBIDDEN_HTML_CONTENT`
HTML chứa nội dung động không được phép trong email (script, iframe, form, input, button, embed, object, svg, handler on*, link javascript:, meta refresh…). Phản hồi liệt kê những gì phát hiện được. Dùng thẻ <a> có định dạng thay cho nút hay form.
- 403`SPAM_DETECTED`
Nội dung email bị gắn cờ spam. Phản hồi gồm quarantine_id và hướng dẫn giải phóng.
- 403`SENDER_NAME_MISMATCH`
Phát hiện nhiều tên người gửi cho cùng một địa chỉ.
- 403`FOLLOWUP_PATTERN_DETECTED`
Nội dung email bị gắn cờ là mẫu follow-up đáng ngờ lặp lại.
- 403`SCAM_PATTERN_DETECTED`
Nội dung email bị gắn cờ là mẫu lừa đảo.
- 403`SHARED_DOMAIN_REQUIRES_PAID_PLAN`
Tên miền gửi dùng chung này chỉ có ở gói trả phí. Phản hồi liệt kê trong allowedDomains các tên miền dùng chung bạn được dùng, kèm upgradeUrl. Dùng một trong số đó hoặc tên miền đã xác minh của bạn.
- 403`ACCOUNT_SUSPENDED_SPOOFING`
Tài khoản bị tạm ngưng do nhiều lần giả mạo header From.
- 400`INVALID_IDEMPOTENCY_KEY`
Header Idempotency-Key không hợp lệ. Dùng 1–255 ký tự: chữ cái, chữ số, _ - : .
- 409`IDEMPOTENCY_IN_PROGRESS`
Một yêu cầu với cùng Idempotency-Key vẫn đang xử lý. Chờ (Retry-After: 1) rồi thử lại với cùng key.
- 422`RECIPIENT_UNSUBSCRIBED`
Sent with unsubscribe enabled (unsubscribe: true) to someone who already unsubscribed through the Sendcorex link. The whole request is refused and the unsubscribed array lists them. This person unsubscribed from you: remove them and send again, and do not send to them again.
- 422`IDEMPOTENCY_KEY_REUSED`
Idempotency-Key này đã được dùng với body khác. Dùng key mới cho mỗi email mới.
- 500`INTERNAL_SERVER_ERROR`
Lỗi máy chủ không mong muốn. Thử lại.
- 500`PARSE_ERROR`
Không xử lý được nội dung email (lỗi phân tích MIME).
- 500`PERSIST_FAILED`
Không đưa được email vào hàng đợi (lỗi lưu cơ sở dữ liệu).
- 503`AUTH_UNAVAILABLE`
Hiện không xác thực được API key. Thử lại.
- 503`UNSUBSCRIBE_UNAVAILABLE`
Dịch vụ link hủy đăng ký tạm thời không khả dụng. Thử lại sau.

## Giới hạn gói miễn phí

Ở gói miễn phí, marketing và cold outreach giới hạn 30 email mỗi ngày, tính theo người nhận (một email gửi 5 người tính là 5) trong khung 24 giờ trượt. Email giao dịch không bị ảnh hưởng. Vượt giới hạn thì yêu cầu bị từ chối và không vào hàng đợi: gửi lại khi khung được đặt lại, hoặc nâng cấp.

403 `MARKETING_LIMIT_REACHED`

Trả về bởi `/v3.0/send` khi email này vượt giới hạn marketing gói miễn phí. `used` là số đã tính trong 24 giờ qua và `recipients` là số email này sẽ thêm vào.

```
{
  "code": "MARKETING_LIMIT_REACHED",
  "error": "Daily marketing limit reached for the free plan (30/30, 2 recipients in this email). Transactional emails still go out.",
  "limit": 30,
  "used": 30,
  "recipients": 2,
  "upgradeUrl": "https://app.sendcorex.com/dashboard/billing"
}
```

403 `SHARED_DOMAIN_REQUIRES_PAID_PLAN`

Trả về khi bạn tạo người gửi trên tên miền dùng chung chỉ có ở gói trả phí. `allowedDomains` liệt kê tên miền dùng chung gói của bạn được dùng; tên miền đã xác minh của bạn luôn dùng được.

```
{
  "code": "SHARED_DOMAIN_REQUIRES_PAID_PLAN",
  "error": "This shared domain is available on paid plans. Use inboxtaken.com or your own domain.",
  "allowedDomains": ["inboxtaken.com"],
  "upgradeUrl": "https://app.sendcorex.com/dashboard/billing"
}
```

Quy định đầy đủ: [Acceptable Use Policy — Gói miễn phí](https://sendcorex.com/terms-condition#free-plan)

## Receive: lỗi HTTP

Các lỗi này từ chối toàn bộ yêu cầu. Body là `{ "type": "ERROR", "code": "...", "message": "..." }`. Với `RATE_LIMITED`, hãy chờ số giây trong header `Retry-After`.

- 400`INVALID_JSON`
The body is not {"commands":[...]} or has more than 20 commands.
- 401`MISSING_AUTH_HEADER`
No Authorization header was sent.
- 401`INVALID_TOKEN`
The token is malformed, unknown or revoked.
- 401`TOKEN_EXPIRED`
The access token has expired. Call Refresh Token and repeat the request.
- 401`INVALID_REFRESH_TOKEN`
The refresh token is invalid, expired, revoked or already used. Generate a new token in the dashboard.
- 429`RATE_LIMITED`
More than 15 requests/s or 15 in flight for the same IP + mailbox. Wait the number of seconds in Retry-After.
- 503`AUTH_UNAVAILABLE`
Authentication is temporarily unavailable. Try again.

## Receive: lỗi lệnh

Các lỗi này trả về trong kết quả lệnh, với HTTP `200`, nên một lệnh lỗi không dừng các lệnh khác trong cùng yêu cầu. Kiểm tra `results[].type`. Xem [Chạy lệnh](https://docs.sendcorex.com/vi/api-reference/receive-emails/routes/run-commands) .

- CMD`INVALID_ARGS`
A required argument is missing or invalid.
- CMD`UNKNOWN_COMMAND`
The command name does not exist.
- CMD`NOT_FOUND`
The message, thread or folder does not exist for this token.
- CMD`INVALID_CURSOR`
The cursor is malformed or belongs to another account or folder.
- CMD`ALREADY_EXISTS`
A folder or label with this name already exists.
- CMD`NOT_IN_TRASH`
delete only works on messages in Trash or Spam. Use move to send a message to Trash first.
- CMD`SENDER_NOT_FOUND`
The sender behind the token is not registered.
- CMD`SENDER_NO_DOMAIN`
The sender behind the token has no domain.
- CMD`NO_CREDITS`
The account has fewer email credits than recipients (1 credit per copy).
- CMD`NO_RECIPIENT`
The conversation has no recipient to reply to.
- CMD`INVALID_RULE`
The rule is not valid. The message says which condition or action and why.
- CMD`LIMIT`
The mailbox reached the limit (100 rules, 200 templates or 100 labels).
- CMD`INVALID_TOADDRESS`
The to address is not a valid email.
- CMD`INVALID_CCADDRESS`
One of the cc addresses is not a valid email.
- CMD`INVALID_BCCADDRESS`
One of the bcc addresses is not a valid email.
- CMD`INVALID_RECIPIENT`
The recipient is missing or not a valid email.
- CMD`RECIPIENT_LIMIT_EXCEEDED`
to, cc and bcc together have more than 50 addresses.
- CMD`INVALID_ATTACHMENT`
An attachment content is not valid base64.
- CMD`FILE_BLOCKED`
A file was blocked by the security scan.
- CMD`ATTACHMENTS_TOO_LARGE`
The attachments of the email add up to more than 25 MB, or the mailbox already has 500 MB of uploads waiting to be sent.
- CMD`TOO_MANY_OPEN_COMPOSES`
The mailbox has 50 emails with uploads that were not sent yet. Send them, or wait for the unused ones to be deleted after 48 hours.
- CMD`ATTACHMENT_MISSING`
An uploaded attachment no longer exists (uploads not sent within 48 hours, and not used by a draft or scheduled email, are deleted). Upload it again.
- CMD`ALREADY_SENT`
The compose_uid belongs to an email that was already sent.
- CMD`INVALID_TIME`
send_at is missing, less than 1 minute away or more than 1 year away.
- CMD`MISSING_SUBJECT`
A new email needs a subject.
- CMD`MISSING_TARGET`
Reply and forward need the original email, and it must still exist.
- CMD`DRAFT_NOT_FOUND`
The draft does not exist anymore: it was sent, deleted, or saved again (every save returns a new draft_id).
- CMD`NOT_SCHEDULED`
The email was already sent or canceled.
- CMD`SEND_FAILED`
The send was refused. The email is back in Drafts and the message says why.
- CMD`NO_UNSUBSCRIBE`
The email has no List-Unsubscribe header.
- CMD`RECIPIENT_UNSUBSCRIBED`
One or more recipients unsubscribed from this mailbox. `recipients` lists them: remove them or send again with `unsubscribe: false`.
- CMD`PAID_PLAN_REQUIRED`
More than one address in `to` needs a paid plan.
- CMD`TOO_MANY_RECIPIENTS`
`to` has more than 30 addresses.
- CMD`INVALID_AUDIENCE`
The audience is not valid: unknown group, a segment of another mailbox or a message this mailbox didn’t send.
- CMD`AUDIENCE_OVER_LIMIT`
The audience has more people than you can send to (up to 5,000 per email and your daily limit). `total` and `allowed` say how many.
- CMD`EMPTY_AUDIENCE`
Nobody in this audience right now.
- CMD`BEST_TIME_NEEDS_AUDIENCE`
`best_time` needs an `audience` and `mode: new`.
- CMD`READ_ONLY_ACCESS`
The token or app has Read only access and the command writes. In the attachment upload route it is HTTP 403.
- CMD`INVALID_IDEMPOTENCY_KEY`
`idempotency_key` must have 1–255 characters: letters, numbers, `_ - : .`.
- CMD`IDEMPOTENCY_KEY_REUSED`
This `idempotency_key` was already used with different args. Use a new key for every new email.
- CMD`IDEMPOTENCY_IN_PROGRESS`
A call with the same `idempotency_key` is still running. Try again in 1 second with the same key.
- CMD`INTERNAL`
Server error. The detail is only written to the server log.
