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

# Как подключить webhooks

Webhooks нужны, чтобы ваше приложение получало события автоматически, без постоянного опроса API.

Главный пример: статус заявки изменился, iEXExchanger отправил запрос на ваш URL, ваше приложение обновило статус у себя.

## Когда использовать webhooks

| Сценарий              | События                                                                 |
| --------------------- | ----------------------------------------------------------------------- |
| Статусы заявок        | `order.created`, `order.status_changed`, `order.payment_received`       |
| Проверки пользователя | `verification.identity.created`, `verification.identity.status_changed` |
| Проверки карты        | `verification.card.created`, `verification.card.status_changed`         |
| Файлы                 | `file.uploaded`                                                         |
| Sandbox               | `api.sandbox.simulated`                                                 |
| Отзывы                | `review.created`                                                        |
| Партнерские выплаты   | `partner.payout.paid`                                                   |

## Создать webhook endpoint

```bash
curl -sS https://example.com/api/v3/private/webhooks \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "url": "https://client.example.net/webhooks/iex",
    "events": ["order.created", "order.status_changed"],
    "description": "Production order status handler"
  }'
```

В ответе будет webhook secret. Сохраните его сразу. Он нужен для проверки подписи входящих webhook-запросов.

## Получить список webhooks

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

## Отправить тестовое событие

```bash
curl -sS https://example.com/api/v3/private/webhooks/test \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "url": "https://client.example.net/webhooks/iex",
    "event": "api.test"
  }'
```

## Изменить webhook

```bash
curl -sS https://example.com/api/v3/private/webhooks/WEBHOOK_ID \
  -X PATCH \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "events": ["order.created", "order.status_changed", "order.payment_received"],
    "status": "active"
  }'
```

## Сменить webhook secret

```bash
curl -sS https://example.com/api/v3/private/webhooks/WEBHOOK_ID/rotate-secret \
  -X POST \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

После смены secret сразу обновите его в своем receiver.

## Требования к receiver

Ваш webhook endpoint должен:

* принимать `POST`;
* работать по HTTPS;
* проверять `X-Webhook-Signature`;
* сохранять `event_id`;
* возвращать `2xx` только после успешного сохранения события;
* обрабатывать повторные события без дублей.

## API Reference

Точные параметры webhook endpoints доступны на странице [Webhooks API Reference](/get-started/exchanger-api/api-reference/webhooks.md).


---

# 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/webhooks/overview.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.
