Building
Errors and retries
# Errors and retries
Every error has the same shape, and its `code` never changes. Handle errors by `code`, never by the message text.
```json
{
"error": {
"code": "outside_window",
"message": "The customer has not written to you in the last 24 hours, and WhatsApp lets free text through only as a reply. Send an approved template.",
"message_id": "0199c5e2-7b3a-7c51-9f0e-3a1d2b4c5e6f",
"request_id": "req_01k75q3x8f2m9c4v6b7n1d0e5a"
}
}
```
## What to do
| Codes | Situation | What to do |
| --- | --- | --- |
| `invalid_request`, `invalid_phone`, `template_parameters` | The request is wrong | Fix the request. Sending it again gets the same response. |
| `outside_window` | The 24 hours passed | Send a template. |
| `no_consent` | The customer has not agreed | Record consent, then send. |
| `rate_limited` | Too many requests | Wait as many seconds as `Retry-After` says, then retry. |
| `server_error`, a timeout | Our side or the network failed | Retry with the same `Idempotency-Key`. |
| `channel_unavailable`, `meta_payment`, `payment_required` | The channel cannot send | Ask the client to reconnect or add a card at Meta, or pay the invoice. |
## Retrying safely
Retry only after a network error, `429` or `5xx`, with the same `Idempotency-Key` and body, and wait longer each time. A `4xx` response does not change on its own.
## Errors after the response
A message can also fail once it was accepted: the channel did not deliver it, or Meta refused it. It turns `failed` or `refused`, a `message.status` or `message.refused` event arrives, and `error.code` says why. [Errors](https://airbox.kz/en/docs/api/errors) lists every code.
## Asking us
Every response carries `X-Request-Id`, and an error body repeats it as `request_id`. Log it. The workspace's **Requests** page lists its calls of the last 30 days, each with its id. When something looks wrong, send it to us with your question.
Updated 4 December 2026
Every error has the same shape, and its code never changes. Handle errors by code, never by the message text.
{
"error": {
"code": "outside_window",
"message": "The customer has not written to you in the last 24 hours, and WhatsApp lets free text through only as a reply. Send an approved template.",
"message_id": "0199c5e2-7b3a-7c51-9f0e-3a1d2b4c5e6f",
"request_id": "req_01k75q3x8f2m9c4v6b7n1d0e5a"
}
}
What to do
| Codes | Situation | What to do |
|---|---|---|
invalid_request, invalid_phone, template_parameters |
The request is wrong | Fix the request. Sending it again gets the same response. |
outside_window |
The 24 hours passed | Send a template. |
no_consent |
The customer has not agreed | Record consent, then send. |
rate_limited |
Too many requests | Wait as many seconds as Retry-After says, then retry. |
server_error, a timeout |
Our side or the network failed | Retry with the same Idempotency-Key. |
channel_unavailable, meta_payment, payment_required |
The channel cannot send | Ask the client to reconnect or add a card at Meta, or pay the invoice. |
Retrying safely
Retry only after a network error, 429 or 5xx, with the same Idempotency-Key and body, and wait longer each time. A 4xx response does not change on its own.
Errors after the response
A message can also fail once it was accepted: the channel did not deliver it, or Meta refused it. It turns failed or refused, a message.status or message.refused event arrives, and error.code says why. Errors lists every code.
Asking us
Every response carries X-Request-Id, and an error body repeats it as request_id. Log it. The workspace's Requests page lists its calls of the last 30 days, each with its id. When something looks wrong, send it to us with your question.