Using the API well
Errors
Every error has the same shape, a stable code you can branch on, and a docUrl that links to its entry on this page.
The error object
HTTP/1.1 422 Unprocessable Entity
{
"error": {
"code": "SERVICE_WINDOW_CLOSED",
"type": "policy_error",
"message": "Free-form messages require an open 24-hour service window.",
"retryable": false,
"retryAfterSeconds": null,
"docUrl": "https://toutye.com/docs/errors#SERVICE_WINDOW_CLOSED",
"requestId": "req_FjLKGlzDxsiDKsIz",
"providerCode": 131047,
"details": [{ "path": "type", "issue": "…" }]
}
}retryableis the only thing that says whether retrying can help. When it is true, waitretryAfterSeconds(or theRetry-Afterheader) and retry with the same Idempotency-Key.providerCodeis WhatsApp’s own error code, when the refusal came from WhatsApp.detailslists each invalid field for validation errors.- Quote
requestIdwhen you contact support; it also finds the call in your request log.
The same list is available as JSON at GET /v1/errors (no key needed). Failed messages carry the same codes in data.error on message.failed.
Error codes
API error messages below are shown exactly as returned by the API. The explanations are translated.
| Code | Message and what to do |
|---|---|
AUTHENTICATION_ERROR | The API key is missing, mistyped, revoked, or used from an address outside its allow-list. Send |
API_KEY_DISABLED | The key was disabled in the console or by an administrator. Re-enable it or create a new key. |
SIGNATURE_REQUIRED | This key is configured to require signed requests. Turn on request signing in your SDK (the |
SIGNATURE_INVALID | The signature did not match. Sign the exact bytes you send, with the path and query in canonical order, and keep your clock within 5 minutes of real time. |
SIGNATURE_REPLAYED | The nonce was already used. Every signed request needs a new random nonce; the SDKs generate one per attempt. |
CAPTCHA_REQUIRED | Several failed sign-ins in a row: the next sign-in must include a solved challenge. |
CAPTCHA_INVALID | The challenge answer was rejected or expired. Solve a new challenge and sign in again. |
AUTHORIZATION_ERROR | The key or user lacks the permission (scope) this endpoint needs, or the resource belongs to another account or environment. Check the key's scopes and that a sandbox key is used with sandbox resources. |
STEP_UP_REQUIRED | This action is sensitive and needs a fresh second-factor confirmation from a signed-in user. It cannot be done with an API key alone. |
APPROVAL_REQUIRED | Your account requires a second person to approve this action. It has been queued for approval; it runs once approved. |
VALIDATION_ERROR | A field is missing, has the wrong type or is out of range. |
NOT_FOUND | No such resource in this account and environment. Check the SID, and that sandbox and live resources are not mixed. |
METHOD_NOT_ALLOWED | This path exists, but does not support the requested HTTP method. Use a method listed in the Allow response header and the API reference; do not retry the same method. |
CAPABILITY_UNAVAILABLE | The sender cannot send this kind of message (for example a Flow or a product message) until the capability is enabled on its WhatsApp Business Account. |
MEDIA_NOT_READY | The uploaded media is still being scanned or processed. Wait until its |
MEDIA_REJECTED | The media failed the safety scan or is an unsupported type or size. Upload a different file. |
RECIPIENT_ADDRESSING_UNSUPPORTED | This message type cannot be sent to that kind of address (for example a username instead of a phone number). Address the recipient by phone number. |
RECIPIENT_USERNAME_INVALID | The WhatsApp username is not in a valid format. |
STATUS_CALLBACK_NOT_VERIFIED | A per-message status callback must point at a webhook endpoint that has passed verification. Verify the endpoint first. |
TEMPLATE_NAME_LOCKED | A template with this name was deleted recently; WhatsApp does not allow reusing the name for 30 days. Pick another name. |
TEMPLATE_CAP_REACHED | The WhatsApp Business Account has reached its template limit. Delete unused templates. |
IDEMPOTENCY_KEY_REUSED | The Idempotency-Key was already used within 24 hours for a different request body or endpoint. Use a new key for a new request. |
IDEMPOTENCY_IN_PROGRESS | The first request with this key is still running. Wait a moment and retry with the same key; you will receive its result. |
RATE_LIMITED | A rate limit was exceeded. Wait |
PROVIDER_RATE_LIMITED | WhatsApp is throttling this sender. The message is retried automatically when queued; for direct calls, wait and retry. |
ACCOUNT_SUSPENDED | The account is suspended, so it cannot send. The console explains why and what is needed to lift it. |
PLAN_MESSAGE_QUOTA_EXCEEDED | The account has used the message allowance in its contracted plan for this period. Nothing was sent. Wait for the allowance to renew, or ask your account owner to change the plan. |
INSUFFICIENT_FUNDS | The prepaid balance cannot cover this message. Top up the wallet or change the billing mode. |
SENDER_NOT_READY | The sender (phone number) is not connected or verified yet. Finish onboarding, or use a sender whose status is CONNECTED. |
SENDER_RESTRICTED | WhatsApp has restricted this number, usually after quality problems. Sending resumes when the restriction ends. |
SENDER_TEMPLATE_RESTRICTED | The number may not send template messages for now. Replies inside an open service window still work. |
TEMPLATE_NOT_APPROVED | The template does not exist in that language, or WhatsApp has not approved it. Check its name, language and status. |
TEMPLATE_PAUSED | WhatsApp paused the template because recipients reported or blocked it. Edit it or wait for the pause to end. |
SERVICE_WINDOW_CLOSED | Free-form messages (text, media, interactive) are allowed only within 24 hours of the customer's last message. Send an approved template instead. |
CONSENT_REQUIRED | Your account requires recorded opt-in before this kind of message. Record the contact's consent first. |
CONTACT_SUPPRESSED | The number is on a suppression list for this kind of message (for example after a hard failure or a manual block). |
RECIPIENT_OPTED_OUT | The contact opted out of this kind of message. Do not send it again unless they opt back in. |
RECIPIENT_MARKETING_CAP | WhatsApp limits how many marketing messages one person receives. Send later; with |
DESTINATION_POLICY_BLOCKED | Your account's policy blocks this destination (a country or number range). |
MARKET_EXCLUDED | Messages to this country are not available for this account or message category. |
PORTFOLIO_LIMIT_EXHAUSTED | The business has used its daily limit of new conversations. It resets on a rolling 24-hour basis and grows as quality stays high. |
TRANSPORT_CATEGORY_MISMATCH | The chosen transport cannot carry this template category (for example a non-marketing template on the Marketing Messages API). |
RISK_BLOCKED | The message was held back by fraud and abuse checks. Contact support if you think this is wrong. |
COEXISTENCE_DEREGISTER_UNSUPPORTED | A number shared with the WhatsApp Business app cannot be deregistered from the API; disconnect it from the app side. |
PHONE_NUMBER_CAP_REACHED | The WhatsApp Business Account already has the maximum number of phone numbers. |
ONBOARDING_NOT_PERMITTED | Connecting live numbers is not open yet on this platform. Use the sandbox until it is. |
RESIDENCY_POLICY_MISMATCH | The data region you chose conflicts with the account's data residency policy. Pick an allowed region. |
FLOW_BLOCKED | WhatsApp has blocked this Flow. Check its health in the console. |
CONFLICT | The resource changed or is in the wrong state for this action. Read it again and retry against its current state. |
REGION_OWNERSHIP_CONFLICT | More than one region claims this account. Contact support with the requestId so ownership can be corrected; do not create another account or change regions to retry the operation. |
MESSAGE_NOT_CANCELABLE | The message has already been handed to WhatsApp, so it can no longer be canceled. |
MESSAGE_EXPIRED | The message passed its validity period before it could be sent, so it was not sent. |
OPERATION_NOT_RETRYABLE | This operation cannot be retried; check |
ONBOARDING_CODE_EXPIRED | The onboarding code has expired. Start the connection again to get a new one. |
WABA_NOT_CONNECTED | The WhatsApp Business Account is not connected to Toutye. Reconnect it in the console. |
CONVERSATION_VERSION_CONFLICT | Someone else changed the conversation after you loaded it. Reload it and try again. |
COMPOSER_CLAIM_CONFLICT | Another agent is replying in this conversation right now. |
COMPOSER_CLAIM_REQUIRED | Take the conversation's reply claim before replying from an inbox. |
FLOW_NOT_PUBLISHED | Only published Flows can be sent. Publish the Flow first. |
FLOW_ENCRYPTION_KEY_MISSING | Data-exchange Flows need the sender's Flow encryption public key to be uploaded and verified. |
MARKETING_MESSAGES_NOT_ONBOARDED | The WhatsApp Business Account has not accepted the Marketing Messages API terms. Complete that step, or send through the Cloud API transport. |
ANALYTICS_RANGE_UNAVAILABLE | Detailed analytics are limited to the last 7 days right now. Ask for a shorter range. |