---
metadata:
  - name: generator
    content: Diplodoc Platform v5.57.3
alternate:
  - https://yandex.ru/dev/kit/ru/openapi/Vebhuki/CreateWebhook.md
  - href: https://yandex.ru/dev/kit/ru/openapi/Vebhuki/CreateWebhook.md
    type: text/markdown
    title: Markdown version
  - href: https://yandex.ru/dev/kit/ru/llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.ru/dev/kit/ru/llms.txt

<div class="openapi">

# Создание вебхука

<!-- markdownlint-disable-file -->

Создает новый вебхук.

## Request

<div class="openapi__requests">

<div class="openapi__request__wrapper" style="--method: var(--dc-openapi-methods-post);margin-bottom: 12px">

<div class="openapi__request">

POST {.openapi__method}
```text translate=no
https://api.kit.yandex.net/v1/webhooks
```

</div>

</div>

</div>

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "url": "https://example.com/webhook",
  "events": [
    "ORDER_STATUS_CHANGED"
  ]
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_events_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: [WebhookEventTypes](#entity-WebhookEventTypes)[]

Список типов событий, на которые подписывается вебхук.

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
[
  "ORDER_STATUS_CHANGED"
]
```

{% endcut %}
{.table-cell}
||
||

_url_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

URL вебхука. Поддерживается только HTTPS протокол.

_Example:_{.json-schema-reset .json-schema-example} `https://example.com/webhook`
{.table-cell}
||
|#{.json-schema-properties}

</div>

<div class="openapi-entity">

### WebhookEventTypes {#entity-WebhookEventTypes}

Тип события:
- `ORDER_STATUS_CHANGED` — изменился статус заказа.
- `ORDER_PAYMENT_STATUS_CHANGED` — изменился статус оплаты заказа.
- `ORDER_DELIVERY_STATUS_CHANGED` — изменился статус доставки заказа.

**Type**: string

_Enum:_{.json-schema-reset .json-schema-value} `ORDER_STATUS_CHANGED`, `ORDER_PAYMENT_STATUS_CHANGED`, `ORDER_DELIVERY_STATUS_CHANGED`

</div>

## Responses

<div class="openapi__response__code__201">

## 201 Created

Вебхук успешно создан.

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "id": "019b21d9-c5d9-777d-80bd-d67c664bc6d9",
  "url": "https://example.com/webhook",
  "events": [
    "ORDER_STATUS_CHANGED"
  ],
  "status": "ACTIVE",
  "secret": "019b21d9-c5d9-777d-80bd-d67c664bc6d9"
}
```

{% endcut %}

{% cut "**All of 2 types**" %}{.json-schema-combinators data-marker=and}

- **Type**: [Webhook](#entity-Webhook)

  {% cut "**Example**" %}{.json-schema-example}

  ```json translate=no
  {
    "id": "019b21d9-c5d9-777d-80bd-d67c664bc6d9",
    "url": "https://example.com/webhook",
    "events": [
      "ORDER_STATUS_CHANGED"
    ],
    "status": "ACTIVE"
  }
  ```

  {% endcut %}

- {% cut "**Type**: object" %}

  #|
  ||

  _secret_{.json-schema-reset .json-schema-property .json-schema-required}
  {.table-cell}|
  **Type**: string

  Секретный ключ для верификации подлинности входящих запросов от вебхука.

  _Example:_{.json-schema-reset .json-schema-example} `019b21d9-c5d9-777d-80bd-d67c664bc6d9`
  {.table-cell}
  ||
  |#{.json-schema-properties}

  {% endcut %}

  {% cut "**Example**" %}{.json-schema-example}

  ```json translate=no
  {
    "secret": "019b21d9-c5d9-777d-80bd-d67c664bc6d9"
  }
  ```

  {% endcut %}

{% endcut %}

</div>

<div class="openapi-entity">

### WebhookID {#entity-WebhookID}

ID вебхука.

**Type**: string&lt;uuid&gt;

_Example:_{.json-schema-reset .json-schema-example} `019b21d9-c5d9-777d-80bd-d67c664bc6d9`

</div>

<div class="openapi-entity">

### WebhookStatus {#entity-WebhookStatus}

Статус вебхука:
- `ACTIVE` — активный.
- `INACTIVE` — неактивный.

**Type**: string

_Enum:_{.json-schema-reset .json-schema-value} `ACTIVE`, `INACTIVE`

</div>

<div class="openapi-entity">

### Webhook {#entity-Webhook}

#|
|| **Name** | **Description** ||
||

_events_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: [WebhookEventTypes](#entity-WebhookEventTypes)[]

Список типов событий, на которые подписан вебхук.

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
[
  "ORDER_STATUS_CHANGED"
]
```

{% endcut %}
{.table-cell}
||
||

_id_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: [WebhookID](#entity-WebhookID)

ID вебхука.

_Example:_{.json-schema-reset .json-schema-example} `019b21d9-c5d9-777d-80bd-d67c664bc6d9`
{.table-cell}
||
||

_status_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: [WebhookStatus](#entity-WebhookStatus)

Статус вебхука:
- `ACTIVE` — активный.
- `INACTIVE` — неактивный.

_Enum:_{.json-schema-reset .json-schema-value} `ACTIVE`, `INACTIVE`
{.table-cell}
||
||

_url_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

URL вебхука.

_Example:_{.json-schema-reset .json-schema-example} `https://example.com/webhook`
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "id": "019b21d9-c5d9-777d-80bd-d67c664bc6d9",
  "url": "https://example.com/webhook",
  "events": [
    "ORDER_STATUS_CHANGED"
  ],
  "status": "ACTIVE"
}
```

{% endcut %}

</div>

</div>

<div class="openapi__response__code__400">

## 400 Bad Request

Некорректный запрос.

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "code": "VALIDATION_ERROR",
  "message": "Invalid input",
  "trace_id": "00000000000000000000000000000000"
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_code_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `VALIDATION_ERROR`
{.table-cell}
||
||

_message_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `Invalid input`
{.table-cell}
||
||

_trace_id_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Уникальный идентификатор запроса для отладки.

_Example:_{.json-schema-reset .json-schema-example} `00000000000000000000000000000000`
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

<div class="openapi__response__code__401">

## 401 Unauthorized

Не авторизован.

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "code": "VALIDATION_ERROR",
  "message": "Invalid input",
  "trace_id": "00000000000000000000000000000000"
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_code_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `VALIDATION_ERROR`
{.table-cell}
||
||

_message_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `Invalid input`
{.table-cell}
||
||

_trace_id_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Уникальный идентификатор запроса для отладки.

_Example:_{.json-schema-reset .json-schema-example} `00000000000000000000000000000000`
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

<div class="openapi__response__code__500">

## 500 Internal Server Error

Внутренняя ошибка сервера.

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "code": "VALIDATION_ERROR",
  "message": "Invalid input",
  "trace_id": "00000000000000000000000000000000"
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_code_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `VALIDATION_ERROR`
{.table-cell}
||
||

_message_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `Invalid input`
{.table-cell}
||
||

_trace_id_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Уникальный идентификатор запроса для отладки.

_Example:_{.json-schema-reset .json-schema-example} `00000000000000000000000000000000`
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

</div>

[*Deprecated]: No longer supported, please use an alternative and newer version.