Error Codes
The DEP API uses standard HTTP status codes and returns a JSON body on every error response. This page explains each error code, its common causes, and the correct handling strategy.
Error Response Format
Section titled “Error Response Format”Most error responses return a flat JSON object with the following structure:
{ "code": 400, "error": "validation_error", "message": "Validation error: Exactly one message type must be provided"}| Field | Type | Description |
|---|---|---|
code | integer | HTTP status code (e.g. 400, 402, 429). |
error | string | Error category in lowercase with underscores (e.g. validation_error, payment_required). This value is derived from the error type on the server. |
message | string | Human-readable message explaining the cause of the error. |
details | object | Optional. Top-level field (not inside error) that only appears on some errors — mainly 409 conflicts. Completely omitted when absent. |
Error Code Catalog
Section titled “Error Code Catalog”400 — validation_error
Section titled “400 — validation_error”The request is invalid due to an incorrect body, parameter, or format.
{ "code": 400, "error": "validation_error", "message": "Validation error: Exactly one message type must be provided"}Common causes:
- A required field is missing (
messaging_product,to,type). - More than one or no main message type (template, text, image, etc.) is provided in a single request.
- The phone number does not match E.164 format.
- The JSON body is malformed or a field has the wrong data type.
- No routing rule matches the destination — this error also returns
400witherror=no_route_found.
Handling: Fix the request and resend. Do not retry automatically because this error is deterministic — the same request will always fail.
401 — Authentication / Authorization Failed
Section titled “401 — Authentication / Authorization Failed”Authentication failed, or the API key is not authorized for the requested resource.
{ "code": 401, "error": "api_key_unauthorized_for_this_entry_point", "message": "API Key unauthorized for this entry point"}Common causes:
- The
Authorizationheader is missing or is not inBearer <token>format. - The API key is invalid, has been revoked, or belongs to a deactivated account.
- The API key is not permitted for the
phone_number_idused in the request (API Key unauthorized for this entry point). - Attempting to read a resource owned by another account — for example, calling
GET /v1/messages/{message_id}for another account’s message (Forbidden).
Handling: Check your API key in cpaas.id > Settings > API. Ensure the key is authorized for the phone_number_id being used. Do not retry automatically.
402 — payment_required
Section titled “402 — payment_required”Balance, message quota, or budget plan is exhausted when sending a message. This is one of the most common error responses from POST /v1/{phone_number_id}/messages.
{ "code": 402, "error": "payment_required", "message": "Payment required: Insufficient funds to send message."}Returned error messages (message):
"Payment required: Insufficient funds to send message."— the billing account balance is exhausted or below the message cost."Payment required: Message quota exhausted."— the message quota is exhausted."Payment required: Budget plan exhausted for this category."— the budget plan for this message category is exhausted.
Handling: Top up your balance or update your quota/budget plan, then resend. Do not retry automatically before updating your balance or quota — the same request will continue to fail.
403 — channel_not_owned_by_this_account
Section titled “403 — channel_not_owned_by_this_account”The request is authenticated (the API key is valid) but not authorized for the requested resource.
{ "code": 403, "error": "channel_not_owned_by_this_account", "message": "Channel not owned by this account"}Common causes:
phone_number_id(channel) is registered on the platform but does not belong to your account.
Handling: Verify that phone_number_id is correct and belongs to your account. Do not retry automatically.
404 — resource_not_found
Section titled “404 — resource_not_found”The requested resource was not found.
{ "code": 404, "error": "resource_not_found", "message": "Resource not found: Message not found."}Common causes:
message_idis invalid or has been deleted.- The agent or sender (e.g., RCS/SMS) was not found or does not belong to your account.
- The endpoint path is incorrect.
Handling: Verify the resource ID and endpoint path. Do not retry automatically.
409 — conflict_with_existing_resource.
Section titled “409 — conflict_with_existing_resource.”The request conflicts with existing state.
{ "code": 409, "error": "conflict_with_existing_resource.", "message": "Template with this name already exists.", "details": { "name": "welcome_template" }}Common causes:
- Creating a template with a name that already exists.
- A concurrent duplicate operation on the same resource.
- On the Sync API (
POST /api/v1/{phone_number_id}/messages),409is also returned when a send is rejected by Meta (with the error body of the account’s Sync API profile).
Handling: Use a different name or check whether the resource already exists. Do not retry 409 responses automatically.
429 — capacity_exceeded (Async) & Sync API Throttling
Section titled “429 — capacity_exceeded (Async) & Sync API Throttling”- Asynchronous API (
POST /v1/{phone_number_id}/messages): Rare; returned when the platform’s global capacity is reached (error=capacity_exceeded). This response has noRetry-Afterheader. Per-number sending is queued (~80 messages/second for standard numbers, ~1,000 messages/second for high-throughput numbers) rather than rejected with per-number429responses. - Sync API (
POST /api/v1/{phone_number_id}/messages): Returns429with aRetry-Afterheader (in seconds) when the sender number is above its throughput, or error typeoverloadedwithRetry-After: 2when the Sync API gateway is at capacity.
{ "code": 429, "error": "capacity_exceeded", "message": "Capacity exceeded: Message rejected due to global capacity limits"}Handling: On the asynchronous API, retry after a short delay. On the Sync API, wait for the Retry-After duration before retrying. See Rate Limits and Sync API for details.
500 — an_unexpected_internal_error_occurred.
Section titled “500 — an_unexpected_internal_error_occurred.”An unexpected internal error occurred on the DEP server.
{ "code": 500, "error": "an_unexpected_internal_error_occurred.", "message": "An unexpected internal error occurred."}Common causes:
- An unexpected server-side error (rare).
- An internal configuration error or temporary dependency disruption.
Handling: Retry with exponential backoff. If it persists after several retries, contact support@cpaas.id.
503 — Service Unavailable (Sync API Reports)
Section titled “503 — Service Unavailable (Sync API Reports)”The Sync API report endpoint (GET /report-dashboard) returns HTTP 503 with a Retry-After header in the following cases:
overloaded— busy (Retry-After:2or10seconds).report_preparing— the report is being built; retry after the given seconds inRetry-After.report_unavailable— temporary unavailability (Retry-After:10seconds).
Handling: Wait for the number of seconds in Retry-After before calling the endpoint again.
Error Code Summary
Section titled “Error Code Summary”| HTTP | error / Type | Retryable? | Strategy |
|---|---|---|---|
| 400 | validation_error / no_route_found | No | Fix the request. |
| 401 | per message (e.g. api_key_unauthorized_for_this_entry_point) | No | Check the API key and its permissions. |
| 402 | payment_required | No | Top up balance, message quota, or budget plan. |
| 403 | per message (e.g. channel_not_owned_by_this_account) | No | Verify ownership of phone_number_id. |
| 404 | resource_not_found | No | Check the resource ID. |
| 409 | conflict_with_existing_resource. (or Meta rejection on Sync API) | No | Resolve conflict / do not retry. |
| 429 | capacity_exceeded (async) / overloaded (Sync API) | Yes | Respect Retry-After if present; otherwise retry after a short delay. |
| 500 | an_unexpected_internal_error_occurred. (varies) | Yes | Exponential backoff. |
| 503 | overloaded / report_preparing / report_unavailable (Sync API) | Yes | Retry after Retry-After. |
Retry Strategy
Section titled “Retry Strategy”Only retry 429, 503, and 500 (5xx server error) responses. Other 4xx errors are deterministic and will not succeed without modifying the request.
- When the response includes a
Retry-Afterheader (such as Sync API429and503), wait for the given seconds before retrying. - When no
Retry-Afterheader is present (such as429 capacity_exceededor500on the asynchronous API), retry after a short delay with exponential backoff and jitter. - Include the same
Idempotency-Keyheader when retrying a WhatsApp send so a retry never sends or bills twice.
Idempotency (Idempotency-Key)
Section titled “Idempotency (Idempotency-Key)”The WhatsApp send endpoint (POST /v1/{phone_number_id}/messages) supports the Idempotency-Key header to prevent duplicate sends when retrying.
- Sending the same
Idempotency-Keywithin 24 hours returns HTTP202 Acceptedwith the firstmessage_id(messages[0].id) and the response headerIdempotent-Replayed: true. - The replayed request is not sent or billed again.
- A different
Idempotency-Key(or a request without the header) is treated as a new message.
- Generate a unique key per logical message.
Use a deterministic identifier from your system (such as an
order_idor a per-attempt UUID) as theIdempotency-Keyheader value. - Reuse the same
Idempotency-Keyon retry. If you encounter a network timeout,429, or5xx, retry with the exact sameIdempotency-Key. If the original request was already accepted, you will receive202withIdempotent-Replayed: trueand the originalmessages[0].id. - Store
messages[0].idfrom the202response. Use this ID (msg_<uuid>) to correlate final delivery status events from webhooks. - Retry only on transient errors.
Do not retry
400,401,402,403,404, or409responses.
Message Status and Error Webhooks
Section titled “Message Status and Error Webhooks”In addition to HTTP response errors, a message accepted by the server (202 Accepted) can still fail during delivery to Meta. These failures are delivered via the message.status.failed webhook.
The webhook payload follows the enriched Meta Cloud API envelope format — object / entry / changes / value.statuses[] — and each entry in errors[] carries code, title, and message (without a type field):
{ "object": "whatsapp_business_account", "entry": [ { "id": "1234567890", "changes": [ { "value": { "messaging_product": "whatsapp", "metadata": { "display_phone_number": "6281234567890", "phone_number_id": "9876543210" }, "statuses": [ { "id": "msg_a1b2c3d4-e5f6-7890-abcd-ef1234567890", "status": "failed", "timestamp": "1717200300", "recipient_id": "6289876543210", "errors": [ { "code": 131026, "title": "Message undeliverable", "message": "Message failed to send because more than 24 hours have passed since the customer last replied." } ] } ] }, "field": "messages" } ] } ]}See message.status.failed for the complete field structure and list of Meta error codes.
Meta Error Codes & Automatic Retries Before Webhook Failure
Section titled “Meta Error Codes & Automatic Retries Before Webhook Failure”| Code / Cause | Platform Behavior & Description |
|---|---|
130429 (Sender number rate limit) | When Meta answers “too fast”, the platform waits and retries automatically. After 30 minutes of continuous throttling, the message fails with error code 130429 in the message.status.failed webhook. |
131056 (Pair rate limit) | Too many messages were sent to the same recipient in a short time. The message fails at once with code 131056 in the message.status.failed webhook; the platform does not resend it. Resend from your system after a pause if it is still needed. |
131026 (Message undeliverable) | Recipient cannot receive the message (number not on WhatsApp or outdated app). |
131047 (Re-engagement message) | Free-form message outside the 24-hour window: use a template. |
| Number not on WhatsApp / blocked business | The recipient does not have a WhatsApp account or has blocked the sender number. |
| Template not approved | The message template still has status PENDING or REJECTED. |
See WhatsApp Error Codes for the meaning of each WhatsApp error code.
Getting Help
Section titled “Getting Help”If you encounter an error that cannot be resolved using the guide above:
- Check the API Reference to ensure the request matches the schema.
- Check the webhook logs for
message.status.failedevents. - Contact support@cpaas.id including:
message_id(if available)- Request timestamp (UTC)
- Full request body and response
- API key ID (first 4 characters only, do not send the full key)