error.code field is stable: use it in your logic, not the text of message. When a code has more than one cause, error.details.reason can tell you which one it is. See the error format.
Authentication and permission
| Code | Status | Cause and fix |
|---|---|---|
api_key_invalid | 401 | Missing, malformed, revoked or expired key, or a request from an IP outside the allowlist. A partner key (rt_partner_…) also gets this error on data routes. See API keys. |
insufficient_scope | 403 | The key lacks the scope the route requires. Create a key with the scope you need. |
Billing
| Code | Status | Cause and fix |
|---|---|---|
message_quota_exceeded | 402 | The message allowance for the period is used up. details carries limit, used and resets_at. Wait for the renewal, turn on overage or change plans. See Plans and allowance. |
free_messages_exhausted | 402 | The organization never subscribed to a plan and has used its 10 free messages, which are granted only once. details carries limit and used, without resets_at, because this allowance does not renew. Choose a plan in the dashboard. Test projects are not affected. See Plans and allowance. |
subscription_required | 402 | The subscription is not in good standing (canceled, unpaid, or set to cancel at the end of a period that has already ended), and the organization cannot send from live projects. Subscribe to a plan in the dashboard. It also appears briefly when the billing period of a new subscription has not opened yet: try again. Those who never subscribed get free_messages_exhausted after the free messages. |
payment_failed | 402 | The subscription payment failed and the grace period ended, or a subscription paid with Pix went past the end of its period without renewing and the grace period ended. Update the payment method in the dashboard. |
Do not retry a
402 hoping it goes away on its own. Waiting does not increase the allowance. Fix the cause in the plan and then resend.Resource not found (404)
A resource of another project also returns404, so its existence is not revealed.
| Code | Cause |
|---|---|
channel_not_found | The channel does not exist in this project. |
message_not_found | The message does not exist in this project. |
event_not_found | The ID used in after matches no event of the project. |
template_not_found | The template does not exist in this project. |
template_media_not_found | The header media you named does not exist. |
media_not_found | The media object does not exist, or the header_parameter.media_id of a send is not a file of this project. |
webhook_endpoint_not_found | The webhook endpoint does not exist. |
webhook_delivery_not_found | The webhook delivery does not exist. |
Conflicts (409)
| Code | Cause and fix |
|---|---|
idempotency_in_progress | A request with the same Idempotency-Key is still in progress. Try again after Retry-After. |
idempotency_key_reuse | The key was already used with a different body. Use a new key for a new message. |
webhook_delivery_not_replayable | Only exhausted deliveries can be replayed. |
Rate and capacity limits (429)
| Code | Cause and fix |
|---|---|
rate_limit_exceeded | Request limit of the project. Wait for Retry-After. See Rate limits. |
channel_backlog_exceeded | The send queue of the channel is above capacity. Try again in a moment. |
Invalid request (422)
Request format
| Code | Cause and fix |
|---|---|
request_invalid | A field of the body, query or path is missing or does not have the documented format. error.param names the field, such as template.button_parameters.0.index, when the API can. message never repeats the value received. It also applies to partner routes. |
Messages
| Code | Cause and fix |
|---|---|
channel_inactive | The channel is not active: it is pending, degraded or disabled. A disabled channel was disabled by your team, disconnected by the customer in the WhatsApp Business app or removed by the provider. Check the status in the dashboard. See Channels. |
capability_unsupported | The channel does not support this content type. |
invalid_recipient | The number format is valid, but the number cannot exist: the country code is not recognized, or the number is not valid in that country. A value outside the E.164 format gets request_invalid. |
content_rejected | The content cannot be sent. The causes: neither text nor template; an empty text or one over 4096 characters; a template parameter that is missing, extra, mismatched or empty; a value WhatsApp refuses; or a received file used as a header. message states the cause without repeating the value. See Refused values. |
message_direction_invalid | The operation only applies to inbound messages, such as marking as read. |
invalid_cursor | The cursor is not valid. Use the next_cursor returned by the API. |
media_not_found (404), media_not_ready or media_content_type_rejected. See Media.
Templates
| Code | Cause and fix |
|---|---|
template_not_approved | The template is not approved yet, or was rejected or disabled. |
template_paused | The provider paused the template. |
template_not_sendable | The template is read-only (read_only: true), because it was imported from WhatsApp and uses something Routa cannot send, or it is being deleted (deletion_requested: true). Use another template. See Imported templates. |
template_name_invalid | The name can only have lowercase letters, digits and _, up to 512 characters. param is name. |
template_variables_invalid | The {{n}} variables or their examples are wrong: numbering out of sequence, a variable at the start or end of the body, an example that is missing, extra or empty. On an example error, param points at the field. |
template_components_invalid | The body, header, footer or buttons break the component rules. param points at the part. See Validation rules. |
template_media_invalid | The header file is missing, has no Content-Type or has an invalid type or size. |
error.param names it:
param | Source |
|---|---|
name | template_name_invalid. |
body_text | template_components_invalid because of the body. |
components.header | template_components_invalid because of the header. |
components.footer | template_components_invalid because of the footer. |
components.buttons | template_components_invalid because of a button or the combination of buttons. |
variable_examples | template_variables_invalid: the list of examples is missing or has the wrong count. |
variable_examples.<position> | template_variables_invalid: a body example is empty. The position starts at 0. |
components.header.example | template_variables_invalid: the header example is missing, empty or extra. |
components.buttons.<position>.example | template_variables_invalid: the example of the button at that position is missing, empty or extra. |
template_components_invalid, param points at the component, not the item inside it: with components.buttons, read message to find out which button. Variable numbering errors and variable-at-the-edge errors carry no param.
Media
| Code | Cause and fix |
|---|---|
media_not_ready | The media is still pending or is unavailable, for example when you use it in the header of a send. |
media_source_url_invalid | A JSON body needs a non-empty source_url. |
media_source_blocked | The URL points to a private or reserved address. |
media_source_unreachable | Routa could not download the URL (timeout or error response). |
media_content_type_rejected | Unsupported file type, the file bytes do not match the declared Content-Type, or the header file of a send has a type the template format does not accept. See Media. |
media_size_limit_exceeded | The file exceeds the limit of its type. |
Webhooks
| Code | Cause and fix |
|---|---|
invalid_webhook_url | The URL is not HTTPS, points to a private address or does not resolve. |
invalid_subscribed_types | subscribed_types must be a non-empty list of valid types or wildcards such as message.*. |
too_many_webhook_endpoints | The project reached the maximum of 5 endpoints. |
Usage
| Code | Cause and fix |
|---|---|
usage_range_invalid | The from/to range is invalid. Use YYYY-MM-DD dates, with from before to. |
Partner API
These codes come from the/v1/partner/* routes, which use the partner key. request_invalid and the scope, rate limit and not found codes (insufficient_scope, rate_limit_exceeded, channel_not_found, webhook_endpoint_not_found) are the same ones described above.
| Code | Status | Cause and fix |
|---|---|---|
partner_key_invalid | 401 | The key is not an active partner key: it does not exist, was revoked, expired, comes from an IP outside the allowlist or is a project key. The response is always the same. |
partner_api_not_available | 404 | The organization’s plan does not include the Partner API. |
project_not_found | 404 | The project does not exist, or was not created through the Partner API. Projects created in the dashboard are not reachable through this API. |
api_key_not_found | 404 | The project API key does not exist. |
project_limit_exceeded | 402 | The plan reached its maximum number of projects. details.limit carries the maximum. Delete an abandoned project to free the slot. |
invalid_project_name | 422 | The project name is empty, is longer than 200 characters or has a control character. |
invalid_external_ref | 422 | The external_ref must have 1 to 128 characters among A-Z a-z 0-9 . _ : -. |
external_ref_immutable | 422 | The external_ref of a project does not change once set. |
invalid_api_key_name | 422 | The key name is longer than 80 characters or has a control character. |
invalid_cursor | 422 | The cursor is not valid. Use the next_cursor returned by the API. |
invalid_webhook_url | 422 | The organization webhook URL is not HTTPS or does not resolve to a public address. |
invalid_subscribed_types | 422 | subscribed_types must be a non-empty list of valid types or wildcards such as message.*. |
project_not_deletable | 409 | The project cannot be deleted. details.reason is has_enabled_channel (disable the channel in the dashboard first) or last_project (it is the last project of the organization). |
channel_not_disabled | 409 | Only a disabled channel can be deleted. |
Reasons for each code
Some codes group different causes. For them,error.details.reason says which cause it is, and other details fields carry the values quoted in the message. A new code or value can appear: handle what you do not know by its code.
| Code | reason | Other fields in details |
|---|---|---|
content_rejected | text_empty, text_too_long. The other causes carry no details. | max_length on text_too_long |
invalid_recipient | unknown_country_code, invalid_for_country | country_calling_code on invalid_for_country |
template_variables_invalid | See the table below. | expected and got, depending on the reason |
template_components_invalid | body_too_long, header_too_long, footer_too_long, button_text_too_long, url_too_long, phone_number_too_long | max_length |
template_components_invalid | header_too_many_variables, too_many_buttons, too_many_phone_buttons, too_many_url_buttons, url_button_too_many_variables | max |
template_components_invalid | whatsapp_link | host |
template_components_invalid | header_empty, footer_empty, button_text_empty, phone_number_missing, url_missing, quick_replies_interleaved, url_variable_not_at_end, authentication_buttons | n/a |
template_media_invalid | unsupported_content_type, content_mismatch, too_large, missing_body | content_type or max_bytes, depending on the reason |
invalid_webhook_url | not_a_url, https_required, http_local_only, http_localhost_live | n/a |
invalid_webhook_url | private_address, unresolvable, resolves_to_private | host, and address on resolves_to_private |
usage_range_invalid | order, too_long. A badly formatted date carries no reason. | max (days) on too_long |
invalid_project_name | empty, control_character, too_long | max_length on too_long |
invalid_api_key_name | control_character, too_long | max_length on too_long |
invalid_external_ref | length, characters | max_length on length |
project_not_deletable | has_enabled_channel, last_project | n/a |
template_variables_invalid:
reason | Cause | Other fields |
|---|---|---|
numbering | The variables do not form a sequence from {{1}}. | expected, got |
body_edge_variable | The body starts or ends with a variable. | n/a |
body_examples_required | variable_examples is missing. | expected |
body_examples_count_mismatch | The number of body examples is wrong. | expected, got |
body_example_empty | A body example is empty. | n/a |
header_example_missing, button_example_missing | There is a variable but no example. | n/a |
header_example_empty, button_example_empty | The example is empty. | n/a |
header_example_not_expected, button_example_not_expected | There is an example where there is no variable. | n/a |
HTTP boundary
| Code | Status | Cause and fix |
|---|---|---|
payload_too_large | 413 | The body exceeds the route limit. |
length_required | 411 | The route requires Content-Length. Chunked bodies are not accepted. |
Server errors
| Code | Status | Cause and fix |
|---|---|---|
service_unavailable | 503 | Routa cannot process the request right now, because the infrastructure is unavailable for example. Nothing was stored. Try again in a moment, with the same Idempotency-Key. |