# Справочник API: Вебхуки

Вебхуки: все операции API v1 с нужным scope, параметрами, примерами на curl, JavaScript и Python и ответами. Аутентификация, ошибки, постраничная выдача, лимиты и идемпотентность описаны в [обзоре справочника API](/docs/api-reference); см. также [SDK](/docs/sdks) и [командную строку](/docs/cli).

> Попробуйте со своим ключом: создайте API-ключ в консоли, выполните в терминале `export APIDLY_API_KEY=...` и вставьте любой пример curl ниже. Значения в примерах условные. На этой странице нет поля для ввода ключа.

Описания операций и полей взяты из определения API и приведены на английском.

| Операция | Требуемый scope | Описание |
| --- | --- | --- |
| `GET /webhooks` | `full` | Эндпоинты вебхуков и типы событий, на которые можно подписаться |
| `POST /webhooks` | `full` | Создать эндпоинт вебхука |
| `DELETE /webhooks/{id}` | `full` | Удалить эндпоинт вебхука |
| `PATCH /webhooks/{id}` | `full` | Изменить эндпоинт вебхука |
| `GET /webhooks/{id}/deliveries` | `full` | Журнал доставок одного эндпоинта, сначала новые |
| `POST /webhooks/{id}/rotate-secret` | `full` | Выпустить новый секрет подписи |
| `POST /webhooks/{id}/test` | `full` | Отправить тестовое событие |
| `POST /webhooks/deliveries/{deliveryId}/redeliver` | `full` | Повторно отправить одну прошлую доставку |

### GET /webhooks

Эндпоинты вебхуков и типы событий, на которые можно подписаться

Webhook endpoints carry signing details, so reading them needs `webhooks.manage`, which only the `full` scope reaches: a `read` or `servers` key gets 403 `insufficient_scope`.

**Требуемый scope:** `full` · **Роль создателя:** `admin` · **Разрешение:** `webhooks.manage`

**Пример запроса (curl)**

```bash
curl "https://apidly.com/api/v1/webhooks" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.webhooks.list();
```

**Python (SDK)**

```python
client.webhooks.list()
```

**Утилита командной строки:** `apidly webhooks` ([Справочник CLI](/docs/cli))

**Пример ответа** (200)

```json
{
  "webhooks": [
    {
      "id": "example",
      "url": "https://example.com/hook",
      "format": "json",
      "events": [
        "example"
      ],
      "description": "example",
      "active": false,
      "disabledReason": "example",
      "secretHint": "example",
      "consecutiveFailures": 1,
      "lastDeliveryAt": "2026-11-21T10:00:00.000Z",
      "lastSuccessAt": "2026-11-21T10:00:00.000Z",
      "createdAt": "2026-11-21T10:00:00.000Z",
      "secret": "example"
    }
  ],
  "events": [
    "example"
  ],
  "max": 1
}
```

Статусы ошибок: `401`, `403`, `429`.

### POST /webhooks

Создать эндпоинт вебхука

The signing `secret` is shown only in this response. `format` picks the body: `json` (default, signed) or a chat app (`slack`, `discord`, `teams`), whose URL must be that app's incoming-webhook address (400 `url_not_chat_webhook` otherwise). Chat messages carry no signature header and never contain secrets, variable values or connection details.

**Требуемый scope:** `full` · **Роль создателя:** `admin`

**Тело запроса**

| Имя | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `url` | string | да |  |
| `format` | `json` \| `slack` \| `discord` \| `teams` | нет | `json` (default): the signed JSON envelope. `slack`, `discord`, `teams`: a short message in the organization's language, posted in that app's incoming-webhook shape, with no signature header; the URL must be that app's incoming-webhook address. |
| `description` | string | нет |  |
| `events` | массив из `server.requested` \| `server.approved` \| `server.rejected` \| `server.provisioning` \| `server.running` \| `server.stopped` \| `server.interrupted` \| `server.failed` \| `server.destroyed` \| `server.resumed` \| `server.offline` \| `server.back_online` \| `server.disk_low` \| `server.gpu_idle` \| `server.rental_ending` \| `server.rental_ended` \| `plan.available` \| `endpoint.created` \| `endpoint.paused` \| `endpoint.resumed` \| `endpoint.scaled` \| `endpoint.job.completed` \| `payment.failed` \| `balance.low` \| `balance.exhausted` \| `balance.topped_up` \| `invoice.created` \| `budget.threshold` \| `alert.triggered` \| `member.invited` \| `member.joined` \| `member.removed` \| `api_key.created` \| `api_key.revoked` \| `api_key.rotated` \| `api_key.updated` \| `transfer.completed` \| `transfer.failed` \| `transfer.unverified` \| `volume.created` \| `volume.deleted` \| `server.contract_expiring` \| `server.contract_expired` | да | Event types to receive. `server.contract_expiring` and `server.contract_expired` are deprecated names of `server.rental_ending` and `server.rental_ended`, removed after 2027-05-31: a new subscription cannot select them (400 `invalid_body`); one that already lists an old name keeps it and receives the event under that old name until then, and under the current name after. |

**Пример запроса (curl)**

```bash
curl -X POST "https://apidly.com/api/v1/webhooks" \
  -H "Authorization: Bearer $APIDLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/hook","events":["server.requested"]}'
```

**JavaScript (SDK)**

```js
await apidly.webhooks.create({
  url: "https://example.com/hook",
  events: [
    "server.requested"
  ]
});
```

**Python (SDK)**

```python
client.webhooks.create(url="https://example.com/hook", events=["server.requested"])
```

**Утилита командной строки:** `apidly webhooks` ([Справочник CLI](/docs/cli))

**Пример ответа** (201)

```json
{
  "webhook": {
    "id": "example",
    "url": "https://example.com/hook",
    "format": "json",
    "events": [
      "example"
    ],
    "description": "example",
    "active": false,
    "disabledReason": "example",
    "secretHint": "example",
    "consecutiveFailures": 1,
    "lastDeliveryAt": "2026-11-21T10:00:00.000Z",
    "lastSuccessAt": "2026-11-21T10:00:00.000Z",
    "createdAt": "2026-11-21T10:00:00.000Z",
    "secret": "example"
  },
  "endpoint": {
    "id": "example",
    "url": "https://example.com/hook",
    "format": "json",
    "events": [
      "example"
    ],
    "description": "example",
    "active": false,
    "disabledReason": "example",
    "secretHint": "example",
    "consecutiveFailures": 1,
    "lastDeliveryAt": "2026-11-21T10:00:00.000Z",
    "lastSuccessAt": "2026-11-21T10:00:00.000Z",
    "createdAt": "2026-11-21T10:00:00.000Z",
    "secret": "example"
  },
  "secret": "example"
}
```

Статусы ошибок: `400`, `401`, `403`, `429`.

### DELETE /webhooks/{id}

Удалить эндпоинт вебхука

**Требуемый scope:** `full` · **Роль создателя:** `admin`

**Параметры**

| Имя | Где | Тип | Обязательный | Описание |
| --- | --- | --- | --- | --- |
| `id` | path | string | да |  |

**Пример запроса (curl)**

```bash
curl -X DELETE "https://apidly.com/api/v1/webhooks/webhook_example" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.webhooks.delete("webhook_example");
```

**Python (SDK)**

```python
client.webhooks.delete("webhook_example")
```

**Утилита командной строки:** `apidly webhooks` ([Справочник CLI](/docs/cli))

**Пример ответа** (200)

```json
{
  "ok": false
}
```

Статусы ошибок: `401`, `403`, `404`, `429`.

### PATCH /webhooks/{id}

Изменить эндпоинт вебхука

Any of `url`, `format`, `description`, `events` and `active`. A new `url` or `format` is checked together (400 `url_not_chat_webhook` when a chat format gets an address that is not that app's). The secret is never returned; rotate it with `POST /webhooks/{id}/rotate-secret`.

**Требуемый scope:** `full` · **Разрешение:** `webhooks.manage`

**Параметры**

| Имя | Где | Тип | Обязательный | Описание |
| --- | --- | --- | --- | --- |
| `id` | path | string | да |  |

**Тело запроса**

| Имя | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `url` | string | нет |  |
| `format` | `json` \| `slack` \| `discord` \| `teams` | нет | `json` (default): the signed JSON envelope. `slack`, `discord`, `teams`: a short message in the organization's language, posted in that app's incoming-webhook shape, with no signature header; the URL must be that app's incoming-webhook address. |
| `description` | string | нет |  |
| `events` | массив из `server.requested` \| `server.approved` \| `server.rejected` \| `server.provisioning` \| `server.running` \| `server.stopped` \| `server.interrupted` \| `server.failed` \| `server.destroyed` \| `server.resumed` \| `server.offline` \| `server.back_online` \| `server.disk_low` \| `server.gpu_idle` \| `server.rental_ending` \| `server.rental_ended` \| `plan.available` \| `endpoint.created` \| `endpoint.paused` \| `endpoint.resumed` \| `endpoint.scaled` \| `endpoint.job.completed` \| `payment.failed` \| `balance.low` \| `balance.exhausted` \| `balance.topped_up` \| `invoice.created` \| `budget.threshold` \| `alert.triggered` \| `member.invited` \| `member.joined` \| `member.removed` \| `api_key.created` \| `api_key.revoked` \| `api_key.rotated` \| `api_key.updated` \| `transfer.completed` \| `transfer.failed` \| `transfer.unverified` \| `volume.created` \| `volume.deleted` \| `server.contract_expiring` \| `server.contract_expired` | нет | Event types to receive. `server.contract_expiring` and `server.contract_expired` are deprecated names of `server.rental_ending` and `server.rental_ended`, removed after 2027-05-31: a new subscription cannot select them (400 `invalid_body`); one that already lists an old name keeps it and receives the event under that old name until then, and under the current name after. |
| `active` | boolean | нет |  |

**Пример запроса (curl)**

```bash
curl -X PATCH "https://apidly.com/api/v1/webhooks/webhook_example" \
  -H "Authorization: Bearer $APIDLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/hook","format":"json","description":"example"}'
```

**JavaScript (SDK)**

```js
await apidly.webhooks.update("webhook_example", {
  url: "https://example.com/hook",
  format: "json",
  description: "example"
});
```

**Python (SDK)**

```python
client.webhooks.update("webhook_example")
```

**Утилита командной строки:** `apidly webhooks` ([Справочник CLI](/docs/cli))

**Пример ответа** (200)

```json
{
  "webhook": {
    "id": "example",
    "url": "https://example.com/hook",
    "format": "json",
    "events": [
      "example"
    ],
    "description": "example",
    "active": false,
    "disabledReason": "example",
    "secretHint": "example",
    "consecutiveFailures": 1,
    "lastDeliveryAt": "2026-11-21T10:00:00.000Z",
    "lastSuccessAt": "2026-11-21T10:00:00.000Z",
    "createdAt": "2026-11-21T10:00:00.000Z",
    "secret": "example"
  }
}
```

Статусы ошибок: `400`, `401`, `403`, `404`, `429`.

### GET /webhooks/{id}/deliveries

Журнал доставок одного эндпоинта, сначала новые

**Требуемый scope:** `full` · **Роль создателя:** `admin` · **Разрешение:** `webhooks.manage`

**Параметры**

| Имя | Где | Тип | Обязательный | Описание |
| --- | --- | --- | --- | --- |
| `id` | path | string | да |  |
| `limit` | query | integer | нет |  |

**Пример запроса (curl)**

```bash
curl "https://apidly.com/api/v1/webhooks/webhook_example/deliveries?limit=20" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.webhooks.listDeliveries("webhook_example", { limit: 20 });
```

**Python (SDK)**

```python
client.webhooks.list_deliveries("webhook_example")
```

**Утилита командной строки:** `apidly webhooks` ([Справочник CLI](/docs/cli))

**Пример ответа** (200)

```json
{
  "deliveries": [
    {
      "id": "example",
      "endpointId": "id_example",
      "eventId": "id_example",
      "type": "example",
      "status": "example",
      "attempts": 1,
      "isTest": false,
      "responseCode": 1,
      "responseSnippet": "example",
      "durationMs": 1,
      "lastAttemptAt": "2026-11-21T10:00:00.000Z",
      "nextAttemptAt": "2026-11-21T10:00:00.000Z",
      "createdAt": "2026-11-21T10:00:00.000Z"
    }
  ]
}
```

Статусы ошибок: `401`, `403`, `404`, `429`.

### POST /webhooks/{id}/rotate-secret

Выпустить новый секрет подписи

The new `secret` is in this response only. The old one keeps signing for 24 hours so receivers can switch over.

**Требуемый scope:** `full` · **Разрешение:** `webhooks.manage`

**Параметры**

| Имя | Где | Тип | Обязательный | Описание |
| --- | --- | --- | --- | --- |
| `id` | path | string | да |  |

**Пример запроса (curl)**

```bash
curl -X POST "https://apidly.com/api/v1/webhooks/webhook_example/rotate-secret" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.webhooks.rotateSecret("webhook_example");
```

**Python (SDK)**

```python
client.webhooks.rotate_secret("webhook_example")
```

**Утилита командной строки:** `apidly webhooks` ([Справочник CLI](/docs/cli))

**Пример ответа** (200)

```json
{
  "webhook": {
    "id": "example",
    "url": "https://example.com/hook",
    "format": "json",
    "events": [
      "example"
    ],
    "description": "example",
    "active": false,
    "disabledReason": "example",
    "secretHint": "example",
    "consecutiveFailures": 1,
    "lastDeliveryAt": "2026-11-21T10:00:00.000Z",
    "lastSuccessAt": "2026-11-21T10:00:00.000Z",
    "createdAt": "2026-11-21T10:00:00.000Z",
    "secret": "example"
  },
  "endpoint": {
    "id": "example",
    "url": "https://example.com/hook",
    "format": "json",
    "events": [
      "example"
    ],
    "description": "example",
    "active": false,
    "disabledReason": "example",
    "secretHint": "example",
    "consecutiveFailures": 1,
    "lastDeliveryAt": "2026-11-21T10:00:00.000Z",
    "lastSuccessAt": "2026-11-21T10:00:00.000Z",
    "createdAt": "2026-11-21T10:00:00.000Z",
    "secret": "example"
  },
  "secret": "example"
}
```

Статусы ошибок: `401`, `403`, `404`, `429`.

### POST /webhooks/{id}/test

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

A `webhook.test` event now (one attempt, never counted against the endpoint): the signed envelope for a `json` webhook, a short test message for a chat-app webhook.

**Требуемый scope:** `full` · **Разрешение:** `webhooks.manage`

**Параметры**

| Имя | Где | Тип | Обязательный | Описание |
| --- | --- | --- | --- | --- |
| `id` | path | string | да |  |

**Пример запроса (curl)**

```bash
curl -X POST "https://apidly.com/api/v1/webhooks/webhook_example/test" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.webhooks.test("webhook_example");
```

**Python (SDK)**

```python
client.webhooks.test("webhook_example")
```

**Утилита командной строки:** `apidly webhooks` ([Справочник CLI](/docs/cli))

**Пример ответа** (200)

```json
{
  "delivery": {
    "key": null
  }
}
```

Статусы ошибок: `401`, `403`, `404`, `429`.

### POST /webhooks/deliveries/{deliveryId}/redeliver

Повторно отправить одну прошлую доставку

Same payload, new delivery row.

**Требуемый scope:** `full` · **Разрешение:** `webhooks.manage`

**Параметры**

| Имя | Где | Тип | Обязательный | Описание |
| --- | --- | --- | --- | --- |
| `deliveryId` | path | string | да |  |

**Пример запроса (curl)**

```bash
curl -X POST "https://apidly.com/api/v1/webhooks/deliveries/webhook_example/redeliver" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.webhooks.redeliver("webhook_example");
```

**Python (SDK)**

```python
client.webhooks.redeliver("webhook_example")
```

**Утилита командной строки:** `apidly webhooks` ([Справочник CLI](/docs/cli))

**Пример ответа** (200)

```json
{
  "delivery": {
    "key": null
  }
}
```

Статусы ошибок: `401`, `403`, `404`, `429`.
