WhatsApp API errors
A refused WhatsApp API call answers with an HTTP error status and a JSON error with a stable code, so your code can tell what went wrong and what to do next.
Error shape#
A refused call answers with an error status and this body:
{
"error": {
"code": "CONTACT_NOT_FOUND",
"message": "…",
"request_id": "req_5f0c2a9e8b7d6c4a3b2e1f0d"
}
}- Match on
codein your code.messageis written for people. request_idis the same id as the answer'sX-Request-Idheader. Quote it when you contact support.
Validation errors#
A 400 VALIDATION_FAILED adds details, one entry per field that failed:
{
"error": {
"code": "VALIDATION_FAILED",
"message": "…",
"details": [
{
"path": "phone",
"message": "…"
}
],
"request_id": "req_…"
}
}HTTP statuses#
400
Codes: VALIDATION_FAILED
What to do: Fix the request. details lists each field.
401
Codes: UNAUTHORIZED
What to do: Check the key and the Authorization header.
402
Codes: PLAN_LIMIT_REACHED, API_SUBSCRIPTION_REQUIRED
What to do: Check the workspace's plan and message allowance.
403
Codes: FORBIDDEN
What to do: The person the key belongs to cannot do this.
404
Codes: NOT_FOUND, CONTACT_NOT_FOUND, …
What to do: Check the id. It must belong to this workspace.
409
Codes: WINDOW_CLOSED, CONTACT_OPTED_OUT, NO_CONNECTION, PHONE_DUPLICATE, IDEMPOTENCY_IN_PROGRESS
What to do: The request clashes with the current state. Read the code.
422
Codes: IDEMPOTENCY_KEY_REUSED
What to do: Use a new Idempotency-Key for a new request.
429
Codes: RATE_LIMITED
What to do: Wait the seconds in Retry-After, then retry.
500
Codes: INTERNAL
What to do: Retry later. If it keeps failing, contact support with the request_id.
| Status | Codes | What to do |
|---|---|---|
| 400 | VALIDATION_FAILED | Fix the request. details lists each field. |
| 401 | UNAUTHORIZED | Check the key and the Authorization header. |
| 402 | PLAN_LIMIT_REACHED, API_SUBSCRIPTION_REQUIRED | Check the workspace's plan and message allowance. |
| 403 | FORBIDDEN | The person the key belongs to cannot do this. |
| 404 | NOT_FOUND, CONTACT_NOT_FOUND, … | Check the id. It must belong to this workspace. |
| 409 | WINDOW_CLOSED, CONTACT_OPTED_OUT, NO_CONNECTION, PHONE_DUPLICATE, IDEMPOTENCY_IN_PROGRESS | The request clashes with the current state. Read the code. |
| 422 | IDEMPOTENCY_KEY_REUSED | Use a new Idempotency-Key for a new request. |
| 429 | RATE_LIMITED | Wait the seconds in Retry-After, then retry. |
| 500 | INTERNAL | Retry later. If it keeps failing, contact support with the request_id. |
Error codes#
VALIDATION_FAILED
Status: 400
What it means: An input failed its schema. The details list each field.
UNAUTHORIZED
Status: 401
What it means: The key is missing, wrong or no longer valid.
API_SUBSCRIPTION_REQUIRED
Status: 402
What it means: This action needs an active WhatsApp API plan.
PLAN_LIMIT_REACHED
Status: 402
What it means: The monthly message allowance or a plan cap is used up, or the plan does not include the API. It is included in API Growth and API Ultra.
INBOX_SEAT_REQUIRED
Status: 402
What it means: The person this key belongs to has no inbox seat on the plan.
FORBIDDEN
Status: 403
What it means: The person this key belongs to is not an owner or admin, and the action needs one.
OPT_IN_DASHBOARD_ONLY
Status: 403
What it means: Opting a contact back in is done by a person in the dashboard.
NOT_FOUND, CONTACT_NOT_FOUND, …
Status: 404
What it means: Nothing with that id exists in this workspace.
PHONE_DUPLICATE
Status: 409
What it means: That number is already a contact.
DUPLICATE_AUTO_REPLY
Status: 409
What it means: Another auto reply already answers that word.
WINDOW_CLOSED
Status: 409
What it means: Free text is only allowed within 24 hours of the customer's last message. Use a template.
NO_CONNECTION
Status: 409
What it means: No WhatsApp number is connected.
CONTACT_OPTED_OUT
Status: 409
What it means: The contact unsubscribed, so it cannot be sent to.
IDEMPOTENCY_IN_PROGRESS
Status: 409
What it means: The first call with this Idempotency-Key is still running.
IDEMPOTENCY_KEY_REUSED
Status: 422
What it means: This Idempotency-Key was already used for a different request.
RATE_LIMITED
Status: 429
What it means: Too many requests or sends for this key. Wait for Retry-After seconds.
INTERNAL
Status: 500
What it means: Something failed on SheetWA's side.
| Code | Status | What it means |
|---|---|---|
| VALIDATION_FAILED | 400 | An input failed its schema. The details list each field. |
| UNAUTHORIZED | 401 | The key is missing, wrong or no longer valid. |
| API_SUBSCRIPTION_REQUIRED | 402 | This action needs an active WhatsApp API plan. |
| PLAN_LIMIT_REACHED | 402 | The monthly message allowance or a plan cap is used up, or the plan does not include the API. It is included in API Growth and API Ultra. |
| INBOX_SEAT_REQUIRED | 402 | The person this key belongs to has no inbox seat on the plan. |
| FORBIDDEN | 403 | The person this key belongs to is not an owner or admin, and the action needs one. |
| OPT_IN_DASHBOARD_ONLY | 403 | Opting a contact back in is done by a person in the dashboard. |
| NOT_FOUND, CONTACT_NOT_FOUND, … | 404 | Nothing with that id exists in this workspace. |
| PHONE_DUPLICATE | 409 | That number is already a contact. |
| DUPLICATE_AUTO_REPLY | 409 | Another auto reply already answers that word. |
| WINDOW_CLOSED | 409 | Free text is only allowed within 24 hours of the customer's last message. Use a template. |
| NO_CONNECTION | 409 | No WhatsApp number is connected. |
| CONTACT_OPTED_OUT | 409 | The contact unsubscribed, so it cannot be sent to. |
| IDEMPOTENCY_IN_PROGRESS | 409 | The first call with this Idempotency-Key is still running. |
| IDEMPOTENCY_KEY_REUSED | 422 | This Idempotency-Key was already used for a different request. |
| RATE_LIMITED | 429 | Too many requests or sends for this key. Wait for Retry-After seconds. |
| INTERNAL | 500 | Something failed on SheetWA's side. |
Which errors to retry#
- 429: wait the seconds in
Retry-After, then retry. - 500: retry with a growing wait. Send writes with the same
Idempotency-Keyso nothing runs twice. - 409
IDEMPOTENCY_IN_PROGRESS: retry shortly with the same key. - Any other 4xx: fix the request first. Sending it again gives the same answer.