Every response contains an
X-Request-ID header and matching request_id JSON field. Keep this value when contacting support.Success responses
| HTTP | Meaning | Retry? |
|---|---|---|
202 | Validated, charged and queued for processing. | No. |
200 | An existing result was returned for the same Idempotency-Key. | No; use the returned message ID. |
Error responses
| HTTP | error_code | Meaning | Recommended action |
|---|---|---|---|
| 400 | INVALID_JSONINVALID_BODY | Malformed JSON or non-object body. | Correct the request; do not retry unchanged. |
| 401 | AUTH_MISSINGAUTH_INVALID | Missing, inactive or invalid API key. | Check or rotate the key. |
| 403 | ACCOUNT_NOT_FOUNDACCOUNT_DISABLEDACCOUNT_EXPIRED | The account cannot send. | Resolve the account status. |
| 404 | TEMPLATE_NOT_FOUND | Template is absent, inactive or owned by another account. | Use an active template belonging to the API-key owner. |
| 409 | INSUFFICIENT_CREDITSDEVICE_NOT_CONNECTEDMETA_NUMBER_UNAVAILABLETEMPLATE_NOT_APPROVED | The request conflicts with current account, sender or template state. | Correct the state, then retry with the same Idempotency-Key. |
| 413 | PAYLOAD_TOO_LARGE | Request exceeds 1 MB. | Reduce the request size. |
| 415 | UNSUPPORTED_MEDIA_TYPE | POST is not application/json. | Set the correct Content-Type. |
| 422 | INVALID_RECIPIENTINVALID_MESSAGEMESSAGE_TOO_LONGINVALID_TEMPLATE_PARAMETERSTEMPLATE_PARAMETERS_MISSINGINVALID_MEDIAINVALID_LOCATIONINVALID_SEND_TIME | One or more request fields failed validation. | Correct the identified field. |
| 429 | RATE_LIMITED | Too many requests for this API key. | Wait for Retry-After, then retry with the same Idempotency-Key. |
| 500 | INTERNAL_ERROR | Unexpected server/database failure. | Retry with exponential backoff and the same Idempotency-Key. |
Error example
HTTP/1.1 422 Unprocessable Content
{
"success": false,
"error": "A valid recipient number is required",
"error_code": "INVALID_RECIPIENT",
"request_id": "..."
}
Safe retry policy
- Create one unique Idempotency-Key for the logical message.
- Reuse that same key after timeouts, HTTP 429 or HTTP 500.
- Use exponential backoff, for example 2, 5, 15 and 30 seconds.
- Do not generate a new key for a retry; that may create another billable message.
Legacy response mode
Requests without X-API-Version: 1 retain the original JSON fields and HTTP-200 application-error behaviour. New fields such as error_code, request_id and message_id are additive and may safely be ignored by old clients.