> ## Documentation Index
> Fetch the complete documentation index at: https://docs.shortext.ny-corp.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

> Error codes of the Shortext API and what to do with them.

Errors come back with HTTP 200 (except a removed version, which answers 410), `success: false`, a `code` and a `message`. Use the `code` in your logic; show or log the `message`; send the `trace_id` to support when you need help.

## Codes

| Code | Meaning | What to do |
| - | - | - |
| `1000` | Success | - |
| `1` | The token has expired | Create a new key. |
| `2` | The token is revoked | Use another key. |
| `3` | The token is invalid | Check the `Authorization` header. |
| `4` | The token was not found | Send `Authorization: Bearer {key}` with a valid key. |
| `5` | No company for this token | Use a company API key. |
| `1001` | The request failed | Read `message`, for example a channel that refused the message. Retry later if it is temporary. |
| `1002` | Validation error | Fix the request: `body` lists the errors per field. |
| `1003` | The request has expired | Start the operation again. |
| `1004` | Duplicate | The resource already exists. |
| `1005` | Not authorized | A missing key permission, a limit of your plan (`body.limit`), or an action not allowed in the current state. |
| `1006` | Server error | Retry with a backoff; contact support with the `trace_id` if it persists. |
| `1007` | Not found | Check the id, and that the resource belongs to your company. |
| `1008` | Invalid JSON | Send a valid JSON body with `Content-Type: application/json`. |
| `1009` | Service unavailable | Retry later. |
| `1010` | Emergency | Contact support. |
| `1200` | API version removed (HTTP 410) | Move to the version given in `body.latest`. See [Versioning](https://docs.shortext.ny-corp.io/api-reference/versioning.md). |

## Validation errors

```json theme={null}
{
  "success": false,
  "message": "The message.content.text field is required when message.type is text.",
  "code": 1002,
  "body": {
    "message.content.text": ["The message.content.text field is required when message.type is text."]
  },
  "trace_id": "..."
}
```

Some business rules also answer `1002` with an explicit message, for example a template that is not approved, a missing template variable, or a free-form WhatsApp message outside the 24-hour window.

## Retrying

* Retry `1006` and `1009` with an exponential backoff.
* Do not retry `1002`, `1005` or `1007` unchanged: they fail again.
* `POST` requests that create something (a message, a conversation) are not idempotent, except the [Shortext inbound](https://docs.shortext.ny-corp.io/api-reference/shortext-endpoint.md#idempotency) call, which deduplicates on `message.id`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.