> For the complete documentation index, see [llms.txt](https://docs.iexexchanger.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.iexexchanger.com/get-started/exchanger-api/kak-ustroen-api/errors.md).

# Ошибки и как их обрабатывать

API возвращает HTTP status и JSON body с `error.code`.

Пример:

```json
{
  "state": 1,
  "message": "Validation failed",
  "result": null,
  "error": {
    "code": "validation_error",
    "details": {
      "amount": ["The amount field is required."]
    }
  },
  "meta": {
    "request_id": "req_01J...",
    "timestamp": "2026-06-23T10:00:00+00:00"
  }
}
```

## Что делать по HTTP status

| HTTP  | Что значит                            | Повторять?                             |
| ----- | ------------------------------------- | -------------------------------------- |
| `400` | Неверный запрос.                      | Нет, исправить запрос.                 |
| `401` | Нет авторизации или неверная подпись. | Нет, пока не исправлен token/HMAC.     |
| `403` | Доступ запрещен.                      | Нет, пока не изменены права/IP/scopes. |
| `404` | Ресурс не найден.                     | Обычно нет.                            |
| `409` | Конфликт состояния или idempotency.   | Только после анализа.                  |
| `422` | Ошибка данных.                        | Нет, показать пользователю поля.       |
| `429` | Слишком много запросов.               | Да, после `Retry-After`.               |
| `5xx` | Ошибка сервера.                       | Да, с backoff.                         |

## Частые error.code

| Code                      | Что означает                          | Что делать                           |
| ------------------------- | ------------------------------------- | ------------------------------------ |
| `authentication_required` | Не передан Bearer token.              | Добавить `Authorization`.            |
| `invalid_token`           | Token неверный или отключен.          | Создать или проверить ключ.          |
| `signature_required`      | Нужна HMAC-подпись.                   | Добавить HMAC headers.               |
| `invalid_signature`       | Подпись не совпала.                   | Проверить canonical string.          |
| `signature_replay`        | Nonce уже использован.                | Сгенерировать новый nonce.           |
| `scope_denied`            | Не хватает scope.                     | Добавить scope ключу.                |
| `ip_not_allowed`          | IP не в allow-list.                   | Добавить IP сервера.                 |
| `validation_error`        | Неверные данные.                      | Исправить поля из `details`.         |
| `idempotency_conflict`    | Ключ использован для другого запроса. | Не повторять с этим key.             |
| `rate_limit_exceeded`     | Частотный лимит исчерпан.             | Ждать `Retry-After`.                 |
| `quota_exceeded`          | Дневная или месячная quota исчерпана. | Повысить quota или снизить нагрузку. |

## Что передавать в поддержку

Передайте:

* `X-Request-Id`;
* endpoint;
* HTTP method;
* время запроса;
* HTTP status;
* `error.code`;
* название API-ключа, но не сам token.


---

# 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 current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.iexexchanger.com/get-started/exchanger-api/kak-ustroen-api/errors.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
