# Error Codes

Canonical: https://docs.bluehola.com/docs/guides/error-codes
OpenAPI: https://docs.bluehola.com/openapi.yaml

## The HTTP error envelope

Every API error uses the same envelope and returns the same request trace ID in a response header:

```http
HTTP/1.1 429 Too Many Requests
X-Request-Id: req_01923abc
Content-Type: application/json

{
  "error": {
    "code": "RATE_LIMITED",
    "message": "rate limit exceeded",
    "retryable": true,
    "httpStatus": 429,
    "requestId": "req_01923abc"
  }
}
```

Write `requestId` into your own logs; when you need a human to investigate, supply it along with the request time and the endpoint path. `details` and `upstream` appear only on the relevant errors — for the complete structure see [OpenAPI & Agent Access](../reference/openapi.md).

## Error codes

| code | httpStatus | retryable | Description |
| --- | --- | --- | --- |
| UNAUTHENTICATED | 401 | No | Missing or invalid Bearer token |
| FORBIDDEN | 403 | No | The request was refused |
| TENANT_FORBIDDEN | 403 | No | Insufficient account, role or scope |
| VALIDATION_FAILED | 400 / 409 | No | Invalid parameters or a state conflict |
| NOT_FOUND | 404 | No | The resource does not exist, or does not belong to the current account |
| IDEMPOTENCY_CONFLICT | 409 | No | The same Idempotency-Key was used with different request content |
| INSUFFICIENT_FUNDS | 402 | No | The credit account's available balance is too low; top up or adjust the credit line |
| BM_BUDGET_EXCEEDED | 402 | No | The account balance is fine, but the Business Portfolio this message belongs to has exhausted its budget; raise that Portfolio's budget cap. `details` carries portfolioId / remainingMinor |
| CUSTOMER_BUDGET_EXCEEDED | 402 | No | The account balance is fine, but the customer entity this message belongs to has exhausted its budget; raise that customer entity's budget cap |
| WHATSAPP_24H_WINDOW_EXPIRED | 409 | No | More than 24 hours have passed since the customer last replied, so only template messages can be sent; `details.customerAction` gives the next step |
| RATE_LIMITED | 429 | Yes | Back off and retry |
| PRICE_IMPORT_INVALID | 400 / 409 | No | The rate table CSV failed validation, or the current state does not permit this operation (for example publishing an already-published import). `details.issues` lists each problem with its **line number**; when high-severity warnings exist, `details.warnings` gives the list needing confirmation |
| PRICING_UNAVAILABLE | 409 | No | No rate found for the market + category combination (or that currency has no published version for the day). **It will not silently fall back to charging 0** — a missing price is a fault and someone needs to fill the rate table in |
| ENGAGEMENT_COOLDOWN | 429 | No | This recipient recently tripped Meta's per-person engagement ceiling (131049) from this number, and the platform refuses further templates locally during a 24h cooldown — retrying within those 24h extends Meta's block (and not only for marketing). Wait or switch recipients; do **not** treat this as a back-off-and-retry case |
| MARKETING_OPT_OUT | 403 | No | This recipient has turned off marketing messages from this business inside WhatsApp (the `stop` from the `user_preferences` webhook). The opt-out is recorded against both the phone number and the BSUID Meta reports, and a send matching either `to` or `toUserId` is blocked. **There is no expiry** — only the user turning it back on lifts it, so remove the number from your marketing lists. Forcing it through means Meta accepts the message and then rules 131050 at delivery, burning a reservation and leaving a failed mark against the number's quality rating |
| UPSTREAM_META_ERROR | 502 | Depends on the response | Meta returned an error. **`message` is Meta's own wording, passed through unchanged**; `upstream` holds the entire native envelope: `code` (Meta's numeric code — the official advice is to drive error handling from it), `details` (`error_data.details`, the other officially recommended basis), `userTitle` / `userMsg` (Meta often writes "how to fix it" only here), `type`, `traceId` (`fbtrace_id`, the only credential you can attach when opening a Direct Support ticket) and `subcode` (officially no longer returned as of v16.0+ — do **not** write logic against it) |
| INTERNAL | 500 | Usually | Record the request details, then retry or alert |

`BM_BUDGET_EXCEEDED` is no longer returned for new requests: budgets are now set per customer entity, and an exhausted budget returns `CUSTOMER_BUDGET_EXCEEDED`. The old code stays listed because historical message records can still carry it; handle the two the same way.

## Message failure codes (`error.code` from `GET /v1/messages/{id}`)

These are a **separate system** from the HTTP error codes above: the codes here describe why a message that was already accepted ultimately failed to arrive. They are returned through the message detail endpoint and the status webhooks, not as the `error.code` of an HTTP response.

**When the failure comes from Meta, `error.code` is the number in the "Meta code" column below** (so it maps straight onto Meta's official error code table), `error.message` is Meta's own wording, and `error.meta` is the entire native envelope (including `details` and `fbtrace_id`). For locally determined message failures, such as insufficient account balance, an exhausted customer budget, and exhausted retries, `error.code` is the platform classification in the left-hand column. `ENGAGEMENT_COOLDOWN` is different: the request is rejected with HTTP 429 before a message record is created. The "Description" column is our categorisation, not Meta's wording.

`retryable` / `customerAction` / `stage` are **the platform's judgement**, not fields Meta supplies: retrying a code marked `retryable: false` gets you an identical result, and `customerAction` says who has to fix it (`fix_template_params` is something the caller can correct in five seconds; `contact_platform_admin` is on us).

| Platform classification | Meta code | Stage | Retryable | customerAction | Description |
| --- | --- | --- | --- | --- | --- |
| BM_BUDGET_EXCEEDED | — | Submission | No | raise_bm_budget | This Business Portfolio has exhausted its budget; raise its budget cap and retry. |
| BSUID_NOT_SUPPORTED_FOR_MESSAGE | 131062 | Submission | No | check_recipient | This message cannot be delivered by BSUID: Max Price templates and one-tap/zero-tap/copy-code authentication templates require the recipient phone number. Pass the phone number in `to` instead. |
| CUSTOMER_BUDGET_EXCEEDED | — | Submission | No | raise_customer_budget | This customer entity has exhausted its budget; raise its budget cap and retry. |
| CREDIT_LINE_NOT_READY | 131042 | Delivery | No | authorize_credit_line | This WABA's payment method or BlueMedia credit line is unavailable. If the credit line is already attached, check whether the **allocation shared to that Business Portfolio is 0** — the allocation must be set under "Billing & payments → Credit lines" in Meta Business Suite (the API cannot set it). |
| DISPLAY_NAME_NOT_APPROVED | 131037, 2388103 | Submission | No | approve_display_name | This 555 test number's display name has not passed review; change it in the Meta console and wait for approval. |
| FLOW_BLOCKED | 132068 | Submission | No | fix_flow | This Flow is blocked and must be corrected first. |
| FLOW_THROTTLED | 132069 | Submission | No | fix_flow | This Flow is throttled (10 messages using it have already gone out in the last hour); the Flow must be corrected first. |
| INSUFFICIENT_FUNDS | — | Submission | No | contact_platform_admin | The local credit account balance is too low; top up or adjust the credit line first. |
| INTERNAL | — | Submission | Yes (platform retries automatically) | contact_platform_admin | An internal platform error, currently being retried automatically; if it keeps failing, contact BlueMedia support with the message ID. |
| MARKETING_DISABLED_ON_CLOUD_API | 131063 | Submission | No | use_marketing_messages_api | This WABA has marketing messages disabled on the Cloud API (disable_marketing_messages_on_cloud_api=true). BlueMedia routes marketing templates through the Marketing Messages API automatically; if this error still occurs, check the WABA's Meta configuration and share the message ID with support. You do not need to change the BlueMedia request endpoint. |
| MARKETING_EXPERIMENT_EXCLUDED | 130472 | Delivery | No | none | The message was not sent because of a marketing message experiment grouping (Meta-side control group behaviour); this is not a configuration problem. |
| MARKETING_OPT_OUT | 131050 | Delivery | No | stop_marketing_to_recipient | The recipient has turned off marketing messages from this business inside WhatsApp. Do not resend (it will not arrive either); remove the number from your marketing lists. If they turn it back on, Meta notifies you through the user_preferences webhook. |
| MAX_PRICE_REQUIRES_MM_API | 131061 | Submission | No | use_marketing_messages_api | This template has a Max Price and must be sent through the Marketing Messages API, not the Cloud API. BlueMedia routes marketing templates automatically; if this error still occurs, share the message ID with support. |
| MAX_PRICE_UNSUPPORTED_COUNTRY | 131065 | Submission | No | check_recipient | Max Price delivery is not supported in this country. Use a template without a bid (rate-card billing), or choose a recipient in a supported country. |
| MEDIA_DOWNLOAD_FAILED | 131052 | Delivery | No | check_media | The media file the user sent could not be downloaded; see error.meta.details for the reason, and consider asking the user to send the file another way. |
| MEDIA_UPLOAD_FAILED | 131053 | Submission | No | check_media | The media file in the message could not be uploaded (commonly an unsupported format); see error.meta.details for the reason. |
| MESSAGE_TYPE_UNSUPPORTED | 131051 | Submission | No | fix_request_params | Unsupported message type; use a supported one. |
| MESSAGE_UNDELIVERABLE | 131026 | Delivery | No | check_recipient | The message cannot be delivered: the recipient number may not be a WhatsApp user, or may not have accepted the latest terms of service. |
| META_ENGAGEMENT_LIMIT | 131049 | Delivery | No | wait_24h | Meta did not deliver the message in order to protect ecosystem engagement quality; wait at least 24 hours before trying the same user again. |
| META_PERMISSION_DENIED | 10, 200 | Submission | No | fix_app_credentials | Meta denied permission for this request; check the App permissions and the token's authorization scope. |
| META_RATE_LIMIT | 4, 80007 | Submission | Yes (platform retries automatically) | retry_automatically | Meta API rate limit; the platform backs off and retries automatically. |
| META_SERVICE_UNAVAILABLE | 131016, 133004 | Submission | Yes (platform retries automatically) | retry_automatically | Meta's service is temporarily unavailable; the platform backs off and retries automatically. |
| META_THROUGHPUT_LIMIT | 130429 | Submission | Yes (platform retries automatically) | retry_automatically | The Cloud API throughput ceiling has been reached; the platform backs off and retries automatically. |
| META_TOKEN_INVALID | 190 | Submission | No | fix_app_credentials | The Meta access token is invalid or expired; re-authorize. |
| PAIR_RATE_LIMIT | 131056 | Submission | Yes (platform retries automatically) | retry_automatically | Too many messages in a short period from one sending number to one recipient; the platform backs off and retries automatically. |
| PAYMENTS_TOS_PENDING | 134011 | Submission | No | contact_platform_admin | This WABA has not accepted the WhatsApp Payments terms of service; accept them via the link in the error message before sending. |
| PHONE_NOT_REGISTERED | 131045, 133010 | Submission | No | register_phone_number | Something is wrong with the sending number's registration; complete its registration on the WhatsApp Business Platform first. |
| PHONE_NOT_VERIFIED | 133006 | Submission | No | register_phone_number | This number must be verified before it can be registered and used. |
| PHONE_SEND_RESTRICTED | 131048 | Submission | Yes (platform retries automatically) | retry_automatically | This number's send volume is restricted (earlier messages were blocked or marked as spam in large numbers). The platform backs off and retries; if it keeps failing, check the number's quality rating in WhatsApp Manager. |
| RECIPIENT_BLOCKED_BY_BUSINESS | 130403 | Delivery | No | unblock_recipient | The business has blocked this user on WhatsApp; unblock them before messaging again. |
| RECIPIENT_IS_SENDER | 131021 | Submission | No | fix_request_params | The recipient number is the same as the sending number; send to a different number. |
| REQUEST_PARAM_INVALID | 131009, 135000 | Submission | No | fix_request_params | One or more parameters in the request have an invalid value; check the permitted ranges against the endpoint documentation. |
| REQUEST_PARAM_MISSING | 131008 | Submission | No | fix_request_params | The request is missing a required parameter; add it per the endpoint documentation. |
| RETRIES_EXHAUSTED | — | Submission | No | contact_platform_admin | Still unsuccessful after repeated retries; check the last failure reason. |
| TEMPLATE_CLASSIFICATION_LIMIT | 131064 | Submission | No | contact_platform_admin | This account has hit a sending cap due to template classification violations (both template and direct messages are restricted). Check that your template categories are correct; the restriction lifts automatically once the enforcement period ends. |
| TEMPLATE_DISABLED | 132016 | Submission | No | fix_template | This template has been permanently disabled after repeated pauses; create a new template with different content. |
| TEMPLATE_NOT_FOUND | 132001 | Submission | No | sync_template | The template does not exist or is out of sync with Meta; sync templates first and confirm the name and language. |
| TEMPLATE_PARAM_FORMAT_INVALID | 132012 | Submission | No | fix_template_params | A template parameter's format does not match the template definition (for example a malformed structured parameter such as a date or currency). |
| TEMPLATE_PARAM_MISMATCH | 132000 | Submission | No | fix_template_params | The number of template parameters does not match the template definition; send components matching the declared placeholders in count and order. |
| TEMPLATE_PAUSED | 132015 | Submission | No | fix_template | This template is paused because its quality rating is too low; change its content and resubmit for review. |
| TEMPLATE_POLICY_VIOLATION | 132007 | Submission | No | fix_template | The template content violates WhatsApp policy; change it and resubmit for review. |
| TEMPLATE_TEXT_TOO_LONG | 132005 | Submission | No | fix_template | The template translation is too long; shorten the template content in WhatsApp Manager. |
| UPSTREAM_META_ERROR | — | Submission | Yes (platform retries automatically) | retry_automatically | Upstream is temporarily unavailable; the platform retries automatically. |
| WABA_MAINTENANCE_MODE | 131057 | Submission | Yes (platform retries automatically) | retry_automatically | This WABA is in maintenance mode (for example a throughput upgrade); the platform backs off and retries automatically. |
| WABA_RESTRICTED | 131031 | Submission | No | contact_platform_admin | The WABA is restricted for policy violations or unverifiable data; BlueMedia support needs to handle it in the Meta console. |
| WHATSAPP_24H_WINDOW_EXPIRED | 131047 | Submission | No | use_template_or_wait_for_reply | More than 24 hours have passed since the customer last replied; send an approved template message, or wait for the customer to write first. |

### What the 24-hour guidance for `131049` means

The 24 hours is the **minimum wait after a `131049` failure before retrying**. It is not a promise that a marketing message will be deliverable once 24 hours have passed since this business last messaged the recipient.

Meta applies an adaptive per-user marketing limit based on factors including the recipient's recent marketing-message read rate, overall inbox activity, and marketing messages received from **any business** during a period determined by Meta. Therefore, a recipient can still receive `131049` even when this business's previous successful delivery was several days ago. Meta does not expose the recipient's current cap or its exact reset time.

Meta does explicitly state that every delivered marketing template outside an open customer-service window counts toward the limit, while marketing messages sent after the user replies and within that 24-hour window do not count. What Meta does **not** publish is a fixed number of messages, a fixed calculation period, a remaining-quota query, or an exact reset time. The threshold varies by user and changes with engagement, so it cannot be predicted from this business's send history alone.

When the failure record has `stage: delivery`, a Meta `wamid`, and `error.code: 131049`, the platform successfully submitted the message and Meta rejected it during delivery under this recipient-level policy. Do not retry automatically. Wait at least 24 hours from the failed attempt; the adaptive limit may remain in effect for longer.
