> For the complete documentation index, see [llms.txt](https://stablemesh.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://stablemesh.gitbook.io/docs/home/stablemesh-doc/developers/api/errors.md).

# Errors

The API uses standard HTTP status codes plus an application `code` in the JSON body.

* **`200 OK`** — success. Action endpoints return `{ "code": 0, "message": "ok" }`.
* **`400 Bad Request`** — a business/validation error. Body: `{ "code": <non-zero>, "message": "..." }`.
* **`401 Unauthorized`** — missing, unknown, or revoked API key.

Always check the `code` field even on a `200` response.

***

## Common error codes

| `code`  | Name                              | Meaning                                                                                                                                                   |
| ------- | --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `0`     | SUCCESS                           | OK                                                                                                                                                        |
| `400`   | ILLEGAL\_PARAMETER                | A required field is missing or invalid                                                                                                                    |
| `3000`  | ASSET\_NOT\_FOUND                 | No balance for the requested currency                                                                                                                     |
| `3001`  | ASSET\_NOT\_ENOUGH                | USDT balance too low for this action                                                                                                                      |
| `4001`  | CARD\_NOT\_FOUND                  | No such card for your account                                                                                                                             |
| `4004`  | BIN\_NOT\_FOUND                   | Unknown card BIN                                                                                                                                          |
| `4005`  | BIN\_DISABLED                     | The card BIN is disabled                                                                                                                                  |
| `4007`  | REJECTED\_HAVING\_PENDING\_ORDERS | A conflicting operation is pending on this card                                                                                                           |
| `4008`  | CARD\_IS\_DELETING                | Card is being cancelled                                                                                                                                   |
| `4009`  | CARD\_OUT\_OF\_INVENTORY          | No card inventory available — contact support                                                                                                             |
| `8001`  | DEPOSIT\_AMOUNT\_TOO\_SMALL       | Amount below the minimum (or too small to cover the deposit fee)                                                                                          |
| `4210`  | IDEMPOTENCY\_KEY\_REQUIRED        | An `Idempotency-Key` is required on this mutation but was missing (HTTP 400) — see [Idempotency](/docs/home/stablemesh-doc/developers/api/idempotency.md) |
| `4211`  | IDEMPOTENCY\_KEY\_MISMATCH        | The `Idempotency-Key` was already used with a different request (HTTP 409)                                                                                |
| `4212`  | IDEMPOTENCY\_KEY\_IN\_PROGRESS    | A request with this `Idempotency-Key` is still in flight — retry shortly (HTTP 409)                                                                       |
| `11002` | AUTH\_FAILED                      | Invalid or revoked API key (HTTP 401)                                                                                                                     |
| `9999`  | SYSTEM\_ERROR                     | Unexpected server error — retry later                                                                                                                     |

***

## Example error response

```json
{
  "code": 3001,
  "message": "Your balance is too low for this action. Please add funds to your wallet and try again."
}
```

{% hint style="info" %}
On a `3001` (insufficient balance), top up your USDT balance — see [Wallet & Funding](/docs/home/stablemesh-doc/developers/api/wallet.md) — and retry.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://stablemesh.gitbook.io/docs/home/stablemesh-doc/developers/api/errors.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
