Understand the Whats91 error envelope, the request correlation header, and how to react to each class of failure.
Errors
Summary
Understand the Whats91 error envelope, the request correlation header, and how to react to each class of failure.
Prerequisites
- A Whats91 account
Related documentation
Whats91 public API endpoints use one error envelope. Meta-compatible endpoints are the single exception: they return Meta-shaped error bodies so existing Cloud API clients keep working unchanged.
Error Envelope
Every non-Meta-compatible failure returns this body. success is always false, error_code is the stable machine-readable identifier to branch on, and message is human-readable text that may change.
{
"success": false,
"message": "Missing public API token",
"error_code": "MISSING_AUTH_TOKEN",
"details": {},
"metadata": {
"apiVersion": "v3",
"requestId": "request-uuid"
}
}| Field | Type | Description |
|---|---|---|
| success | boolean | Always false on an error response. |
| message | string | Human-readable summary. Do not branch on this value. |
| error_code | string | Stable identifier to branch on. Defaults to REQUEST_FAILED when no specific code applies. |
| details | object | Endpoint-specific context. Empty object when there is nothing extra to report. |
| metadata.apiVersion | string | The API version that produced the response, for example v3. |
| metadata.requestId | string | null | Correlation id. Quote this when contacting support. |
Response Headers
| Header | Meaning |
|---|---|
| X-Whats91-Request-Id | Request correlation id. Present on success and error responses, and mirrored in metadata.requestId. |
| X-Whats91-Phone-Number-Id | Sender phone number id, when a sender was resolved. |
| X-Whats91-Message-Id | Meta message id, when Meta accepted the send. |
| X-Whats91-Queued | Queue status, when the sender was reconnecting and the message entered the reconnect queue. |
| X-Whats91-Template-Uid | Local template UID, after a successful template create. |
Tip
Log X-Whats91-Request-Id for every request. It is the fastest way for Whats91 support to locate a specific call in platform logs.
Authentication and Authorization
| HTTP | error_code | Meaning and action |
|---|---|---|
| 401 | MISSING_AUTH_TOKEN | No bearer token and no compatibility fallback token was supplied. Add the Authorization header. |
| 401 | INVALID_AUTH_TOKEN | The token is invalid, expired, or revoked. Generate a new token from the dashboard. |
| 403 | CUSTOMER_TOKEN_REQUIRED | The token does not belong to a customer account. Use a customer public API token. |
| 403 | TOKEN_SCOPE_NOT_ALLOWED | A number-scoped token requested another sender. Use the bound sender or a global token. |
| 403 | FEATURE_NOT_AVAILABLE | The subscription plan does not include the requested feature. |
| 404 | SENDER_NOT_FOUND | The requested sender is not connected to this customer. |
| 400 | WHATSAPP_SETUP_INCOMPLETE | The sender has no usable WhatsApp number context. Finish WhatsApp setup in the dashboard. |
Request Shape
| HTTP | error_code | Meaning and action |
|---|---|---|
| 400 | VALIDATION_FAILED | A required field is missing or a supplied field is invalid. Inspect details and message. |
| 404 | NOT_FOUND | The route is not exposed on this mount, or the referenced record does not exist in your tenant scope. |
| 415 | UNSUPPORTED_CONTENT_TYPE | A JSON-only endpoint was called without Content-Type: application/json. |
Rate Limiting
HTTP 429 means a Whats91 platform limit window was exhausted. It is produced before the request reaches a handler and carries no Meta error code. Back off, then resume. Meta throughput limits are reported separately as Meta error codes inside a successful HTTP exchange with the provider.
| Signal | Source | Action |
|---|---|---|
| HTTP 429 | Whats91 platform limit | Retry with exponential backoff after the window resets. |
| Meta 130429 | Cloud API throughput exceeded | Queue and spread sends across time and senders. |
| Meta 131056 | Pair rate limit for one recipient | Slow down messages to that specific recipient. |
| Meta 131057 | Throughput upgrade in progress | Retry with backoff; the sender is being scaled. |
Meta-Compatible Endpoints
POST /api/v3/messages and POST /api/v3/{phoneNumberId}/messages return Meta-shaped errors rather than the Whats91 envelope, so a Cloud API client can be repointed at Whats91 without changing its error handling. The X-Whats91-Request-Id header is still present.
{
"error": {
"message": "Invalid parameter",
"type": "OAuthException",
"code": 100,
"error_subcode": null,
"fbtrace_id": "trace-id"
}
}Retry Guidance
- Never retry a 4xx other than 429 without changing the request; the same input produces the same result.
- Retry 429 and 5xx with exponential backoff and jitter.
- For sends, prefer idempotency-protected endpoints or a deduplication key in your own system: a retried send that already reached Meta creates a duplicate WhatsApp message.
- When a send returns an ambiguous provider outcome, read the message report before resending rather than sending again blindly.
- Treat a send response as an acceptance receipt, not a delivery receipt. Delivery, read, and failure arrive through webhooks and reports.
Related Documentation
Overview
Introduction to Whats91 public API v2 and its canonical endpoint surface.
Quick Start
Generate a v2 token and send your first WhatsApp text message through Whats91.
Authentication
Authenticate public v2 requests with managed Whats91 bearer tokens.
API Keys
Generate and manage managed w91_live_ API tokens from the Whats91 dashboard.