Guides
Errors
Errors return a JSON body with a stable code you can branch on and a message for humans.
Format
{
"code": "VALIDATION_ERROR",
"message": "to.wa_id must be an international number of 8 to 15 digits"
}Branch on code, not on message. Messages are written for people and may be reworded.
Codes
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 400 | VALIDATION_ERROR | A field is missing or invalid: a bad phone number or email, an unapproved template, the wrong message type for the channel, a missing Idempotency-Key. | Fix the request. The message explains which field. |
| 401 | UNAUTHORIZED | The token is missing, unknown, rotated or revoked. | Check the token. Ask an admin to rotate it if it was lost. |
| 403 | CHANNEL_NOT_FOUND | The channel does not exist or is not bound to your consumer. | List your channels with GET /channels and use one of those ids. |
| 404 | NOT_FOUND | The message id is unknown, or the message was sent by another consumer. | Check the id. |
| 409 | IDEMPOTENCY_MISMATCH | The Idempotency-Key was already used with a different channel, recipient or message. | Use a new key for a new message, or resend the original payload. |
| 422 | WINDOW_CLOSED | WhatsApp free text was sent outside the 24-hour window. | Send an approved template instead. |
Failures after 202
A 202 only means the message was accepted. The channel provider can still refuse it later, for example an invalid number or a rejected template. That arrives as a status callback with status: "failed" and an error_code. Always handle failed events.
Which errors to retry
- Network errors and timeouts: retry with the same
Idempotency-Key. - 5xx: retry with backoff and the same key.
- 400, 401, 403, 404, 409: do not retry unchanged; the request needs fixing.
- 422 WINDOW_CLOSED: do not retry as text. Send a template.