Errors
The error format, every status code the API returns, and which errors are worth retrying.
Error format
When a request fails, the API returns a 4xx or 5xx status and a JSON body with one field, error, a message written for people:
{
"error": "The 24-hour reply window is closed. Send a template instead."
}
Errors that come from Meta (WhatsApp's API) start with Meta: and also include Meta's numeric error code (or null if Meta didn't send one):
{
"error": "Meta: Recipient phone number not in allowed list",
"code": 131030
}
Branch on the HTTP status (and on code for 502 errors). The error text is meant for logs and people, and its wording can change.
Incoming webhooks (/hooks/...) use the same format.
Responses that aren't JSON
A few failures happen before a request reaches the API, and their body may be HTML or plain text instead of JSON:
- a request body that isn't valid JSON,
- requests refused because the servers are at capacity (
429or503), - network-level failures between you and the API.
Handle a non-JSON error body by looking at the status code alone.
Status codes
| Status | Meaning | Retry? |
|---|---|---|
200 |
Success. | |
400 |
The request couldn't be processed, for example a template that was deleted while an incoming webhook still uses it. | No. Fix the request or the setup. |
401 |
API key missing or invalid. | No. Check the key. |
403 |
The workspace is suspended, or its plan doesn't include the API (or sequences, for the enroll endpoint). | No. Contact support, or upgrade the plan. |
404 |
Unknown endpoint, or the template, sequence or incoming webhook doesn't exist. | No. |
405 |
An incoming webhook was called with a method other than POST. |
No. |
409 |
The request conflicts with the contact's state: opted out, suppressed, outside the 24-hour window, or template not approved. | No, not until the state changes. |
422 |
A field is missing or invalid. | No. Fix the request. |
429 |
The marketing frequency cap was reached, or the servers are at capacity. | Frequency cap: only after the cap window. Capacity: yes, with backoff. |
500 |
Unexpected error on our side. | Yes, with backoff. If it keeps happening, contact support. |
502 |
Meta rejected or failed the request. See code. |
Depends on Meta's code: throughput errors (such as 130429) yes, with backoff; most others no. |
503 |
WhatsApp isn't connected for this workspace, or the servers are at capacity. | Connect WhatsApp in Settings first. Capacity: yes, with backoff. |
The API doesn't use 405 for the REST endpoints: a wrong method on /messages, /contacts, /sequences/... or /templates returns 404 Unknown endpoint.
Error messages
Every error message the API returns, by status. ... stands for a value from your request.
401 Unauthorized
error |
Cause |
|---|---|
Missing API key. Send it as: Authorization: Bearer <key>. |
No Authorization: Bearer or X-API-Key header. |
Invalid API key. |
The key doesn't exist or was deleted. |
403 Forbidden
error |
Cause |
|---|---|
This workspace is suspended. |
The workspace has been suspended. All API calls are refused. |
The API needs the Starter plan or higher. See Settings → Plan. |
The workspace's plan doesn't include the API, for example the Free plan or a trial that has ended. All API calls are refused until you upgrade. |
Drip sequences need the Pro plan or higher. See Settings → Plan. |
Returned by POST /sequences/{sequenceId}/enroll when the plan doesn't include sequences. |
404 Not Found
error |
Cause |
|---|---|
Unknown endpoint. See Settings → Integrations for the API reference. |
The path or method doesn't match an endpoint. |
Not found. |
The URL isn't under /v1/ or /hooks/. |
No approved template named "..." (optionally in ...) |
No approved template with that name and language. Check GET /templates. |
Sequence not found. |
Wrong sequenceId. |
Unknown webhook. |
Incoming webhook URL is wrong or the webhook was deleted. |
The sequence for this webhook was deleted. |
The incoming webhook points to a deleted sequence. |
405 Method Not Allowed
error |
Cause |
|---|---|
Use POST. |
An incoming webhook was called with GET or another method. |
409 Conflict
error |
Cause |
|---|---|
This contact opted out of messages. |
The contact opted out. They can opt back in by sending the opt-in word (START by default). |
This number asked not to be contacted. |
The number's owner asked for their data to be erased and not to be contacted again. It can't be added or messaged. |
The 24-hour reply window is closed. Send a template instead. |
Text messages are only allowed within 24 hours of the contact's last message. |
Template ... is not approved. |
The template chosen for an incoming webhook isn't approved any more. |
422 Unprocessable Entity
error |
Cause |
|---|---|
A valid phone number with country code is required (e.g. +919876543210). |
to or phone is missing or not a valid number. |
Send "text", or "template": {"name": "...", "variables": [...]}. |
POST /messages without a text or a template.name. |
No value for {{1}}. |
A body variable has no value. The variable's name is in the message, for example {{first_name}} for named templates. |
No value for header variable. |
The template's text header has a variable and template.header is missing. |
No value for button link value. |
A URL button needs a value in template.buttons. |
No value for coupon code. |
A copy-code button needs a value in template.buttons. |
This template needs header media (headerMediaUrl). |
Image, video or document header without template.headerMediaUrl. |
"from" doesn't match any connected number. |
from isn't one of your connected numbers. |
That template belongs to a different WhatsApp account than the sending number. |
Send from a number in the same WhatsApp Business Account as the template. |
No valid phone number at "...". |
Incoming webhook: no valid number at the configured phone field(s). |
429 Too Many Requests
error |
Cause |
|---|---|
Frequency cap: this contact already got the maximum marketing messages for now. |
The contact reached the marketing frequency cap set in Settings → Sending & prices. |
500 Internal Server Error
error |
Cause |
|---|---|
Internal error. |
Something unexpected failed. Safe to retry with backoff. |
502 Bad Gateway
error |
Cause |
|---|---|
Meta: ... |
Meta returned an error. The rest of the message is Meta's explanation, and code is Meta's error code. |
Common Meta codes:
code |
Meaning |
|---|---|
130429 |
Throughput limit for the sending number reached. Retry with backoff. |
131030 |
The recipient isn't in the allowed list. Happens with test numbers in Meta's developer setup. |
132001 |
The template doesn't exist in that language on Meta's side. Sync templates in the app. |
Meta documents the full list in its WhatsApp Cloud API error code reference.
503 Service Unavailable
error |
Cause |
|---|---|
WhatsApp is not connected in Settings. |
The workspace has no connected WhatsApp number. Connect one in Settings → WhatsApp. |
Retrying safely
The API has no idempotency keys. If a POST /messages request times out or fails with a network error, the message may or may not have been sent. Before retrying, check the contact's conversation in the team inbox: messages sent through the API appear there. Retrying POST /contacts is always safe: it updates the same contact.