When a request to the Avox API doesn't go through, the response always has the same shape, so your code can handle every failure the same way:
{
"ok": false,
"error": {
"code": "invalid_recipient",
"message": "The \"to\" number isn't valid. Use the full international number with country code, digits only, like 15551234567.",
"docs_url": "https://docs.theavoxai.com/api/errors#invalid_recipient",
"request_id": "req_4f1c9a0b7e2d36a8c5b1f0e9",
"details": [
{ "path": "to", "message": "Use the full international number, digits only, like 15551234567" }
]
}
}
Error responses also carry Retry-After (whole seconds) when waiting will fix the problem.
Every request made with one of your keys, successful or not, is on the API logs page in the dashboard (Admins and Managers can open it):
request_id (req_...) into the search box, or pick a code in the error code filter
(Any error code) to see every request that failed the same way. Narrow it down by key, mode
(Live only or Test only), connection or date.A key's latest requests are also under Recent requests when you expand it in Settings > API Keys. See API logs.
Requests that never named a real key - no Authorization header, a mistyped key, or a request
refused by the per-address limits before the key was checked - can't be tied to your account,
so they aren't listed. Log X-Request-Id on your side for those.
When you retry, send the same Idempotency-Key header as the first attempt so a message is never
sent twice - except after a refusal from WhatsApp, which is kept against that key. See
Idempotency and Rate limits.
Some problems are found by WhatsApp only after it accepts a message, so they arrive later as a
failed status on Logs instead of as an error here (see
Delivery statuses and replies). The status
carries WhatsApp's own code - look it up on Meta error codes.
HTTP 401. The request had no API key.
Authorization header is missing, or your HTTP tool dropped it. Signing in
to the dashboard doesn't count - this endpoint only accepts an API key, never a browser session.Authorization: Bearer avx_live_... on every request, with your key read
from an environment variable on your server. See Authentication.HTTP 401. The key you sent isn't a key Avox recognises.
Bearer .Many failed key attempts from the same address in a short time are temporarily refused with
rate_limited. Fix the key before retrying.
HTTP 401. This key worked once but has been revoked.
HTTP 401. This key had an end date, and it has passed.
HTTP 403. This key only works from certain IP addresses, and the request came from somewhere else.
HTTP 403. API access is switched off for this account.
HTTP 403. The account's plan doesn't include API access.
HTTP 403. The account this key belongs to is suspended, so nothing can be sent with it.
HTTP 402. The account doesn't have an active plan.
Every key belongs to exactly one WhatsApp number. These errors are about that number.
HTTP 404. The number this key was made for has been removed.
HTTP 409. The number is paused, so it can't send.
HTTP 409. The number isn't connected right now.
HTTP 409. The number needs to be reconnected before it can send.
Idempotency-Key, it's freed, so the retry runs as
a new request.HTTP 409. The Switchboard this key belongs to is paused, so nothing can be sent from it.
HTTP 429. Too many requests in a short time.
Retry-After header, then retry. For bulk
sends, spread messages out instead of sending them all at once. See
Rate limits.Retry-After.HTTP 429. This key has used up its daily allowance.
Retry-After says how many seconds that is. If you
regularly need more, contact Support. The key also shows Hit its daily limit in
Settings > API Keys.HTTP 413. The request body is over 64 KB.
link or id rather than embedding it, and send one message
per request.HTTP 400. The body isn't valid JSON, isn't a JSON object, or a field is missing, the wrong type, or too long.
Content-Type: application/json), a
missing type, a text message over 4096 characters, a caption or a button or list message's
text over 1024, a media message with
both id and link (or neither), or a template parameter over 1024 characters.details - each entry names the field (path) and what's wrong with it.
Every limit is on Message types.HTTP 400. The to number isn't a valid phone number.
0, letters, or a local-format number.15551234567 or +44 7700 900123.
Spaces, dashes, dots, brackets and a leading + are fine; they're removed before sending.HTTP 400. The type field isn't one the API sends.
text, template, image, video, audio, document,
sticker, location, contacts, interactive or reaction. See
Message types.HTTP 400. The Idempotency-Key header isn't usable.
HTTP 409. This Idempotency-Key was already used in the last 24 hours with this API key for a
different message.
Idempotency-Key.HTTP 409. A request with this Idempotency-Key is still being processed.
Retry-After delay, then retry with the same key - once the first
request finishes you'll get its result.Retry-After, with the same key.These mean the request passed every Avox check and was handed to WhatsApp, which refused it.
meta_code carries WhatsApp's own code when there is one. With an Idempotency-Key, these results
are kept for 24 hours, so a retry with the same key returns the same error.
HTTP 422. WhatsApp has no approved template with that name in that language.
en and en_US are different).HTTP 422. The template exists but WhatsApp has paused or disabled it, usually because of negative feedback from recipients.
HTTP 422. The values you sent don't fit the template.
components with the template's placeholders, in order. See
Message types.HTTP 422. It's been more than 24 hours since this person last messaged you, so WhatsApp only allows a template.
template message. Once they reply, you can send other types
again for 24 hours. See Messaging window.HTTP 422. WhatsApp couldn't deliver to this number.
HTTP 429. WhatsApp is limiting how fast this number can send, or how often you can message one person.
Retry-After delay. See
Quality and limits.Retry-After. Because this result is kept against an Idempotency-Key,
retry with a new key.HTTP 422. WhatsApp refused the message for another reason.
meta_code on Meta error codes. WhatsApp's own
wording isn't passed through, so meta_code is the detail to go on.HTTP 502. WhatsApp didn't answer in time, so it's unclear whether the message went out.
Idempotency-Key is freed, so a retry - even with the same
key - sends the message again. If a duplicate would matter, check Logs for a status on
the message, or check with the person, first.HTTP 500. Something went wrong at Avox. Nothing was sent.
Idempotency-Key returns
idempotency_in_progress, wait the Retry-After delay and try again. If it keeps happening,
contact Support with the request_id.