> 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/authentication.md).

# Авторизация Bearer token

Все приватные endpoints требуют Bearer-токен.

```http
Authorization: Bearer YOUR_API_KEY
```

## Проверка токена

```bash
curl -sS https://example.com/api/v3/private/health/client \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Если токен работает, API вернет `state: 0`.

## Что проверяет API

При каждом приватном запросе API проверяет:

1. Передан ли Bearer-токен.
2. Существует ли такой токен.
3. Активен ли аккаунт клиента.
4. Включен ли API-доступ клиенту.
5. Активен ли сам ключ.
6. Не истек ли срок ключа.
7. Разрешен ли IP, если включен allow-list.
8. Есть ли нужный scope для endpoint.
9. Нужна ли HMAC-подпись.

## Типичные ошибки доступа

| HTTP  | Code                      | Что делать                                     |
| ----- | ------------------------- | ---------------------------------------------- |
| `401` | `authentication_required` | Добавить `Authorization: Bearer ...`.          |
| `401` | `invalid_token`           | Проверить токен или создать новый ключ.        |
| `401` | `signature_required`      | Добавить HMAC headers.                         |
| `401` | `invalid_signature`       | Исправить расчет подписи.                      |
| `403` | `api_access_disabled`     | Попросить администратора включить API клиенту. |
| `403` | `ip_not_allowed`          | Добавить IP сервера в allow-list.              |
| `403` | `scope_denied`            | Добавить нужный scope ключу.                   |

## Где хранить токен

Токен должен храниться только на backend-стороне интеграции. Если у вас сайт или мобильное приложение, frontend обращается к вашему backend, а backend вызывает iEXExchanger API.


---

# 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/authentication.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.
