Errors and limits
Every failure has the same shape and a stable code, so your code can tell what went wrong without reading the wording.
The error shape#
Error
{
"error": {
"code": "forbidden",
"message": "This API key is missing the 'messages:send' scope"
}
}code never changes, so branch on it. message is written for people and may be reworded. The HTTP status matches the kind of problem.
Codes#
| Code | Status | What to do |
|---|---|---|
bad_request | 400 | Fix the request. The message names the field, for example 'to' is required. |
template_not_found | 400 | Check the name, then run Sync from Meta in Settings → Templates. |
template_not_approved | 400 | Wait for Meta to approve the template, or use another one. |
whatsapp_not_configured | 400 | An admin connects (or reconnects) WhatsApp in Settings → WhatsApp. |
unauthorized | 401 | Check the key. Missing, wrong, revoked and expired keys all look the same. |
forbidden | 403 | Give the key the scope named in the message, or create a key that has it. |
account_not_approved | 403 | Sending starts once the business is approved. Reads and contacts already work. |
account_suspended | 403 | Messaging is paused for the business. Contact support. |
plan_limit | 403 | The plan’s contact limit is reached. Upgrade the plan or remove old contacts. |
not_found | 404 | The id doesn’t exist in this business. |
rate_limited | 429 | Slow down: wait the seconds in Retry-After, then try again. |
internal | 500 | Something failed on our side. Try again; if it keeps happening, contact support with the time of the call. |
meta_error | 502 | WhatsApp refused the message. The message carries Meta’s reason, for example the 24-hour window has closed. |
Rate limits#
Each key can make 120 requests a minute. Past that you get 429 rate_limited with these headers:
| Header | Meaning |
|---|---|
Retry-After | Seconds to wait before trying again. |
X-RateLimit-Limit | Requests allowed per minute. |
X-RateLimit-Remaining | Requests left in this minute. |
X-RateLimit-Reset | When the minute resets, in Unix seconds. |
Sending to many people
Use Send a broadcast for bulk messages: up to 1,000 numbers per request, sent at a steady pace for you, so you never need to rush the limit.
Other limits#
- Lists return up to 100 items per page (50 by default). Follow
meta.next_cursorfor more. - Broadcasts take up to 1,000 recipients per request, each with up to 60 template values.
- Media captions are up to 1,024 characters. Media links must be https.
- A business can have up to 50 active API keys and 20 webhook endpoints.
- Contacts take up to 50 tags in one request; tag names up to 64 characters.
Retrying safely#
- Retry
429,500and network errors after a pause. Don't retry400,401,403or404; they fail the same way again. - Adding a contact is safe to repeat: the same phone number returns the same contact.
- Sending is not: repeating a send sends the message again. Only retry a send that got no answer after checking the conversation's messages.