Receiving Errors: Synchronous and Asynchronous
WhatsApp API errors are returned either synchronously as a API response, asynchronously via Webhook, or sometimes through both methods.
It is a good practice when working with API that you monitor both the API response and the messages webhook for error handling. If you are subscribed to the messages webhook field, you will receive notification of errors as they occur for supported asynchronous error types.
YCloud failed to send messages
whatsappApiError in response body
whatsappApiError in response bodyYou may get an error response body including the field error.whatsappApiError when you send WhatsApp messages by the YCloud API, typically the Send a WhatsApp message directly API.
Here is a sample error response with HTTP status 429 when you send too many messages to the same phone number:
{
"error": {
"status": 429,
"code": "TOO_MANY_REQUESTS",
"message": "(#131056) (Business Account, Consumer Account) pair rate limit hit",
"target": "whatsappApiError",
"docUrl": "https://developers.facebook.com/docs/whatsapp/cloud-api/support/error-codes",
"requestId": "req_1KjtKI80IKoaJNa6n6p",
"whatsappApiError": {
"message": "(#131056) (Business Account, Consumer Account) pair rate limit hit",
"type": "OAuthException",
"code": "131056",
"fbtrace_id": "A4O5a8RAgePwbcGSu",
"error_data": {
"messaging_product": "whatsapp",
"details": "Message failed to send because there were too many messages sent from this phone number to the same phone number in a short period of time."
}
}
}
}In this case, we tried to request the WhatsApp Business API and got an error response. error.whatsappApiError is included to help you identify the error reason.
whatsappApiError in webhook payload
whatsappApiError in webhook payloadIf you are using the Enqueue a WhatsApp message API, you will never get an error response having error.whatsappApiError since we submit your messages to the WhatsApp Business API asynchronously. You can get it by configuring a webhook listening for whatsapp.message.updated events. Here is an example of the webhook payload:
{
"id": "evt_eEVCy8eNqD9EvcFI",
"type": "whatsapp.message.updated",
"apiVersion": "v2",
"createTime": "2023-02-22T12:00:00.000Z",
"whatsappMessage": {
"id": "63f5d602367ea403f8175a6c",
"wamid": "wamid.BgNODYxN...",
"status": "failed",
"errorCode": "131056",
"errorMessage": "(#131056) (Business Account, Consumer Account) pair rate limit hit",
"whatsappApiError": {
"message": "(#131056) (Business Account, Consumer Account) pair rate limit hit",
"type": "OAuthException",
"code": "131056",
"fbtrace_id": "A4O5a8RAgePwbcGSu",
"error_data": {
"messaging_product": "whatsapp",
"details": "Message failed to send because there were too many messages sent from this phone number to the same phone number in a short period of time."
}
},
"totalPrice": 0.0,
"currency": "USD",
"bizType": "whatsapp"
}Error Codes returned by the WhatsApp Business API
The whatsappApiError is exactly the WhatsApp Business Cloud API Error. Listed below are some possible error codes that may be returned through the YCloud API.
| Code | Description | Possible Solutions | Observed HTTP Status |
|---|---|---|---|
1 | Request data size should be reduced | Reduce the request payload or the amount of data requested, then retry. If the issue persists, contact YCloud Support with the requestId and fbtrace_id. | 500 Internal Server Error |
3 | Application lacks the required granular permission | Verify that the Meta app has the required WhatsApp permissions and is correctly associated with the WABA. Regenerate the access token after updating permissions. | 400 Bad Request |
10 | Missing permission to send messages on behalf of the WABA | Verify the access token, WABA assignment, system-user permissions, and phone-number access in Meta Business Manager. | 400 Bad Request |
190 | Authentication error | Refresh or regenerate the access token. Verify that it has not expired or been revoked and that it belongs to the correct Meta app and business. | 401 Unauthorized |
200 | Missing permission to send messages for the WABA | Grant the app or system user access to the WABA and phone number, then generate a token containing the required WhatsApp permissions. | 403 Forbidden |
368 | Message content was reported as abusive | Review the message content and remove abusive, misleading, or spam-like material. Check the business and phone-number quality status before retrying. | 400 Bad Request |
131005 | Access denied | Verify that the app, system user, and access token have access to the target WABA and business phone number. | 403 Forbidden |
131009 | Parameter value is not valid | Check the request against the API schema and correct the invalid field value, format, enum, or identifier. | 400 Bad Request |
131013 | User is not valid | Verify that the recipient identifier is valid and supported by the endpoint. For phone-number recipients, use a valid E.164 number. | 400 Bad Request |
131037 | Display name approval is required | Complete display-name approval and phone-number registration in WhatsApp Manager before sending messages. | 400 Bad Request |
131053 | Media upload error | Verify the media type, size, URL, and accessibility. Ensure that Meta can download the media over HTTPS without authentication or redirects that block access. | 400 Bad Request |
131055 | Method not allowed | Verify that the HTTP method and endpoint support the requested operation. Use the appropriate API endpoint for the message or resource type. | 400 Bad Request |
131057 | Business Account is in maintenance mode | Wait and retry after the maintenance period. Check the Meta platform status and contact support if the condition persists. | 500 Internal Server Error |
131062 | BSUID recipients are not supported for this message | Use a supported recipient identifier or message type. Do not use a BSUID with endpoints that only accept phone-number recipients. | 400 Bad Request |
132005 | Translated text is too long | Shorten the translated template content or parameter values so that the rendered message stays within WhatsApp limits. | 400 Bad Request |
135000 | Generic user error | Review message, error_data, and details for the specific invalid input. Correct the request and contact support with the trace information if no actionable detail is returned. | 400 Bad Request |
138000 | Calling API is not enabled | Enable WhatsApp Calling for the business phone number and verify that the account, number, region, and calling settings are eligible. | 400 Bad Request |
138017 | The business already has call permission | Do not send another call-permission request. Query or use the existing permission state instead. | 400 Bad Request |
139000 | Blocked by Integrity | Review the business, WABA, and phone-number integrity or policy status in WhatsApp Manager. Resolve restrictions or submit an appeal before retrying. | 400 Bad Request |
Error Codes returned by the YCloud API
Be aware that error.whatsappApiError is not included when errors were detected by YCloud and we didn't request the WhatsApp Business API. For example, you provide an invalid phone number and then get the error response:
{
"error": {
"status": 400,
"code": "PARAM_INVALID",
"message": "Invalid E.146 phone number: +001",
"target": "to",
"docUrl": "https://docs.ycloud.com/v2/reference/errors#param_invalid",
"requestId": "req_69UpMOaMHFrBMGZexYvUDw"
}
}The error.code is one of the YCloud server-defined error codes.
Listed below are some possible error codes returned by the YCloud API:
| Code | Description | Possible Solutions | HTTP Status |
|---|---|---|---|
BAD_REQUEST | The request could not be processed because it is invalid. It may also wrap an error returned by the WhatsApp Business API. | Check error.message, error.target, and error.whatsappApiError. Correct the request before retrying. | 400 Bad Request |
PARAM_INVALID | One or more request parameters are invalid. | Check error.target to identify the invalid field. Correct its value, format, enum, or identifier according to the API schema. | 400 Bad Request |
PARAM_MISSING | One or more required request parameters are missing. | Check error.target and provide the missing field. For template messages, verify the template name, language, components, and parameters. | 400 Bad Request |
MESSAGING_REGION_UNSUPPORTED | The recipient’s messaging region is not supported. | Verify that the recipient phone number is a valid E.164 number and belongs to a supported country or region. Use another supported delivery channel when necessary. | 400 Bad Request |
WHATSAPP_DIRECT_SEND_UNSUPPORTED_COMPONENT | A template component is not supported by the direct-send API. | Review error.target to identify the unsupported component. Modify or remove it, or use the asynchronous message endpoint if the component is supported there. | 400 Bad Request |
UNAUTHORIZED | Authentication failed. | Verify that the X-API-Key header contains a valid API key for the intended YCloud account and environment. Replace expired, revoked, or incorrect credentials. | 401 Unauthorized |
BALANCE_INSUFFICIENT | The account balance or available credit is insufficient. | Top up the account or verify the available credit balance before retrying. | 403 Forbidden |
FORBIDDEN | The caller is authenticated but is not allowed to perform the requested operation. | Verify tenant ownership, resource access, account permissions, and WABA authorization. Contact YCloud Support if access should already be available. | 403 Forbidden |
WHATSAPP_BUSINESS_ACCOUNT_UNAVAILABLE | The WhatsApp Business Account is unavailable to the current YCloud account. | Verify that the WABA is connected to the correct YCloud account, has an active credit line, and is not disabled, removed, or restricted. | 403 Forbidden |
WHATSAPP_PHONE_NUMBER_UNAVAILABLE | The WhatsApp business phone number is unavailable to the current YCloud account. | Verify that the phone number is registered, connected to the correct WABA and YCloud account, and available for messaging. | 403 Forbidden |
WHATSAPP_TEMPLATE_UNAVAILABLE | The requested WhatsApp message template is unavailable. | Verify the template name, language, WABA, and approval status. Synchronize templates if necessary. Paused, disabled, rejected, or deleted templates cannot be used. | 403 Forbidden |
NOT_FOUND | The requested resource or corresponding WhatsApp resource could not be found. | Verify the resource ID, template name, language, WABA, phone number, and tenant ownership. Synchronize the resource from Meta if necessary. | 404 Not Found |
TOO_MANY_REQUESTS | The request was rejected because a YCloud or WhatsApp rate limit was reached. | Reduce the sending rate and retry with exponential backoff. Check error.whatsappApiError when present to identify the specific Meta rate limit. | 429 Too Many Requests |
INTERNAL_SERVER_ERROR | YCloud or the upstream WhatsApp Business API encountered an unexpected error. | Retry with exponential backoff. If the error persists, contact YCloud Support and provide the requestId, timestamp, and fbtrace_id when available. | 500 Internal Server Error |
YCloud Error Codes conveyed by webhooks
If you are using the Enqueue a WhatsApp message endpoint, the message may fail due to a YCloud error. That is, the whatsappMessage.errorCode in webhook payload can also convey one of the YCloud Error Codes, such as BALANCE_INSUFFICIENT.
Here are some possible errors:
| Error Code | Description | Possible Solutions |
|---|---|---|
INTERNAL_SERVER_ERROR | Temporary due to downtime or due to being overloaded. | Wait and retry the operation. This error may be caused by a timeout in our call to the WhatsApp Business API. |
BALANCE_INSUFFICIENT | Your account balance is insufficient. | Top-up. |
RECIPIENT_UNSUBSCRIBED | The recipient has unsubscribed. | If you must deliver the message to the recipient, set the request parameter filterUnsubscribed to false, or go to Dashboard → Contact → Unsubscribe and remove them from the unsubscribe list. |
Meta failed to send messages
Not all of the error codes listed in the WhatsApp Business Cloud API Error page are returned through the YCloud API. Even if a message is successfully submitted to the WhatsApp Business API, it may also fail to send. Meta notifies YCloud about these errors via webhooks. You should Configure Webhooks listening for whatsapp.message.updated events to receive these notifications from YCloud. Here is an example of the webhook payload for submitted but finally failed messages:
{
"id": "evt_eEVCy8eNqD9EvcFI",
"type": "whatsapp.message.updated",
"apiVersion": "v2",
"createTime": "2023-02-22T12:00:00.000Z",
"whatsappMessage": {
"id": "63f5d602367ea403f8175a6c",
"wamid": "wamid.BgNODYxN...",
"status": "failed",
"errorCode": "131048",
"errorMessage": "Message failed to send because there are restrictions on how many messages can be sent from this phone number.This may be because too many previous messages were blocked or flagged as spam.",
"totalPrice": 0.0,
"currency": "USD",
"bizType": "whatsapp"
}
}The whatsappMessage.errorCode conveys the WhatsApp Business API Error code.
Meta Error Codes conveyed by webhooks
Listed below are some possible error codes conveyed by YCloud webhooks, that originated from Meta webhooks:
| Code | Description | Possible Solutions |
|---|---|---|
131000Something went wrong | Message failed to send due to an unknown error. | Try again. If the error persists, contact us to open a Direct Support ticket. |
131026Message Undeliverable | Unable to deliver message. Reasons can include: • The recipient phone number is not a WhatsApp phone number. • Recipient has not accepted our new Terms of Service and Privacy Policy. • Recipient using an old WhatsApp version; must use the following WhatsApp version or greater: • Android: 2.21.15.15 • SMBA: 2.21.15.15 • iOS: 2.21.170.4 • SMBI: 2.21.170.4 • KaiOS: 2.2130.10 • Web: 2.2132.6 | Using a non-WhatsApp communication method, ask the WhatsApp user to: • Confirm that they can actually send a message to your WhatsApp business phone number. • Confirm that they have accepted our latest Terms of Service (Settings > Help, or Settings > Application information will prompt them to accept the latest terms/policies if they haven't done so already) • Update to the latest version of the WhatsApp client. |
131031Account has been locked | The WhatsApp Business Account associated with the app has been restricted or disabled for violating a platform policy, or we were unable to verify data included in the request against data set on the WhatsApp Business Account (e.g, the two-step pin included in the request is incorrect). | See the Policy Enforcement document to learn about policy violations and how to resolve them. |
131047Re-engagement message | More than 24 hours have passed since the recipient last replied to the sender number. | Send the recipient a business-initiated message using a message template instead. |
131048Spam rate limit hit | Message failed to send because there are restrictions on how many messages can be sent from this phone number. This may be because too many previous messages were blocked or flagged as spam. | Check your quality status in the WhatsApp Manager and see the Quality-Based Rate Limits documentation for more information. |
131049 | This message was not delivered to maintain healthy ecosystem engagement. | Do not retry immediately if you do receive this error code and suspect it is due to the limit. Instead, retry in increasing larger time increments until the message is delivered, since the limit may be in effect for differing periods of time. See Per-User Marketing Template Message Limits for additional information. |
131053Media upload error | Unable to upload the media used in the message. | We were unable to upload the media for one or more reasons, such as an unsupported media type. |
131050Message Undeliverable | Unable to deliver the message. This recipient has chosen to stop receiving marketing messages on WhatsApp from your business |
