# Message Failure Codes

When sending messages to the Channels API,`/workspaces/:id/messages/:id`, a message can end up in a failed status. The possible failure statuses are

* sending\_failed
* delivery\_failed

Errors are captured in the message in the `reason` and also `failure` object. See the example below

```
"status": "delivery_failed",
 "reason": "details: unknown subscriber; reason: unknown_subscriber; code: 1",
 "direction": "outgoing",
 "details": "unknown_subscriber",
 "failure": {
   "code": 15005,
   "source": {
     "name": "sms-messagebird",
     "code": "1"
```

The `reason` is always a platform-specific error, e.g., why WhatsApp rejected the message or an SMS message was blocked.

The failure code groups errors encountered across different channel platforms into a more general grouping designed to be both service and channel-agnostic (meaning, for example, both a failed WhatsApp message and an SMS can have the same failure code). In addition to the delivery status report, the Failure code can be checked in each channel log inspection view.&#x20;

![](https://lh7-us.googleusercontent.com/AWVF0vjgJ7Eg8iy1KzIZq4jHiNX_1-5MS-YbM75QFb2tUi_crRipPEvXb2WAjutmRQJXJzKqdMV_7_glb1nbzbAWDY-z1vlpqy_Q26IsZA7WLFRTfy_-4njwD0QCfvheXQfbsVxlzB8LcOYu-UPQ0ic)&#x20;

### Failure Codes

Error codes are divided into three categories

* **11XXX**: **Async Validation Errors** that could happen in channels API in async validations, usually for batch messages.
* 1**2XXX: Service Errors** that could happen in channels API but are not directly caused by the user
* **14XXX: Customer Error** that could occur due to customers' actions
* **15XXX: Platform Errors** that could happen due to platform issue

#### Message validation Errors

Errors that could happen in Channels API, but are usually related to batch messages. Examples include, invalid channel configuration, invalid input, invalid receiver, invalid content and invalid sender. We reserver 11XXX for this kind of error.

`INVALID_CHANNEL_CONFIGURATION: 11001`

It is expected when the channel used doesn't support the request, e.g. multiple receivers for SMS messages.

`INVALID_INPUT: 11002`

It is expected when the input contains an invalid configuration, e.g. message scheduled further than 35 days.

`INVALID_RECEIVER: 11003`

It is expected when the receiver isn't valid, e.g. invalid identifier value format.

`INVALID_CONTENT: 11004`

It is expected when the content has an invalid configuration or reference, e.g. template can't be found due to wrong ID.

`INVALID_SENDER: 11005`

It is expeceted when the sender has an invalid configuration.

#### Message Processing Errors

Errors that could happen in channels API but are not directly caused by the user. Examples include inter-system routing, template conversion, or no price for a destination. We reserve 12XXX for this kind of error.

`DEPENDENCY_ERROR: 12001`

It is expected when channels receive a generic internal error from dependencies.

`UNSUPPORTED_TYPE: 12002`

It is expected that attempting to convert a message into platform-specific messages results in an unsupported template by that platform.

`UNSUPPORTED_DESTINATION: 12003`

It is expected when the source number and destination combination are not allowed

`UNKNOWN_PRODUCT: 12004`

It is expected when trying to send a message to an unsupported product, we will receive this error.

`UNKNOWN_ROUTING: 12005`

It is expected when attempting to call an unknown API.

`INVALID_MESSAGE: 12006`

It is expected when a platform rejects a message due to the wrong json (could be either property or type that was not supported)

`BILLING_FALIURE:12007`

It is expected when charging of the message failed

NETWORK\_TIMEOUT: 12008

This code indicates a timeout when the downstream carrier or network fails to return a message status report before the expiration of the message validity period or Time To Live (TTL). The actual message may have been delivered, but in the absence of definitive information, it is assumed to have failed and is marked with this failure code

#### Customer Error&#x20;

Errors that could happen due to customers. Example: Invalid phone number, etc. We reserve 14XXX for this kind of error.

`INVALID_BALANCE: 14001`

It is expected when a workspace is out of balance.

`INVALID_DESTINATION: 14002`

It is expected when a destination number is not allowed to receive this type of message (for example a landline number that cannot receive SMS) .

`INVALID_TEMPLATE: 14003`

It is expected when a message's template is invalid.

`UNSUPPORTED_MEDIA_TYPE: 14004`

It is expected when an unsupported media type is sent to the platform.

`INVALID_SESSION_WINDOW: 14005`

It is expected when an end-user is out of the session window.

#### Platform Error

Errors could happen due to platform issues, such as being marked as spam, blocked by the platform, attempting to send unsupported content, etc. We reserve 15XXX for this kind of error.

`UNKNOWN_FAILURE: 15001`

It is expected when the platform worker receives an unrecognized error from the platforms.

`INVALID_PERMISSION: 15002`

It is expected when a customer (or sender or workspace) misses the required permissions to send messages to the receiver's country or destination.

`FAILURE_ENTITY_PROCESSING: 15003`

It is expected when the platform accepts a request body but can not be processed later due to internal errors/processing issues.

`INVALID_PAYMENT: 15004`

It is expected when a payment issue occurs.

`UNKNOWN_SUBSCRIBER: 15005`

It is expected when a platform does not recognize the receivers of a message as active or valid (for example a well-formed number not assigned to any user).

`FAILURE_SUBSCRIBER: 15006`

It is expected when a platform cannot send messages to a subscriber due to subscriber configuration/availability.

`FAILURE_ROUTING: 15007`

It is expected when a platform cannot route the message to the destination.

`UNSUPPORTED_ACTION: 15008`

It is expected when a customer tries to send a message using an unsupported action.

`INVALID_SUBSCRIPTION: 15010`

It is expected when a customer tries to send a message to an unsubscribed receiver.

`INVALID_SPAM: 15011`

It is expected when a platform marks the message as policy/spam/malicious activity.

`INVALID_CAPACITY: 15012`

It is expected when a platform blocks sending from/of a channel because it uses high capacity in a short period/ or reaches its limit quota.

`FAILURE_MESSAGE_BOUNCED: 15013`

It is expected when a platform bounces a message being sent to an end user, we will receive this error.

`INVALID_BLOCKED_CHANNEL: 15014`

It is expected when a platform blocks a channel to send any message to an end user.

`FAILURE_POLICY: 15015`

It is expected when a platform blocks a business/customer from sending a message to an end user due to a policy violation.

`OPTEDOUT_RECEIVER: 15016`

It is expected when a message is sent to a receiver who has previously opted out of a prior subscription.

`CANNOT_SEND_MMS: 15017`

It is expected when a channel cannot send a message because it is MMS and fallback is not enabled.

`DELETED_PHONE_NUMBER_WHATSAPP: 15018`

It is expected when a message fails to be sent due to the requested phone number having been deleted on WhatsApp Business.

`RECIPIENT_UNDELIVERABLE: 15019`

It is expected when the message cannot be delivered to the recipient.

`MISSING_REPORT: 15020`

It is expected when a supplier fails to return a status report after a certain amount of time.

`EXPIRED: 15021`

It is expected when a message fails due to expiration of the validity period.<br>
