LegalStack

Webhooks

Регистрация webhook-эндпойнтов и проверка подписей.

Список webhook-эндпойнтов

GET
/api/v1/webhooks
АвторизацияBearer <токен>

В: header

Тело ответа

application/json

curl -X GET "https://loading/api/v1/webhooks"
[
  {
    "clientId": "string",
    "createdAt": "2019-08-24T14:15:22Z",
    "createdBy": "25a02396-1048-48f9-bf93-102d2fb7895e",
    "events": [
      "string"
    ],
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "isActive": true,
    "name": "string",
    "teamId": "a4ede8ba-7c0a-4485-8763-cbd9b282fbec",
    "updatedAt": "2019-08-24T14:15:22Z",
    "url": "http://example.com"
  }
]

Создать webhook-эндпойнт

POST
/api/v1/webhooks
АвторизацияBearer <токен>

В: header

Тело запроса

application/json

TypeScript-определения

Используйте тип request body в TypeScript.

Тело ответа

application/json

curl -X POST "https://loading/api/v1/webhooks" \  -H "Content-Type: application/json" \  -d '{    "events": [      "string"    ],    "name": "string",    "url": "http://example.com"  }'
{
  "clientId": "string",
  "createdAt": "2019-08-24T14:15:22Z",
  "createdBy": "25a02396-1048-48f9-bf93-102d2fb7895e",
  "events": [
    "string"
  ],
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "isActive": true,
  "name": "string",
  "teamId": "a4ede8ba-7c0a-4485-8763-cbd9b282fbec",
  "updatedAt": "2019-08-24T14:15:22Z",
  "url": "http://example.com",
  "secret": "string"
}

Получить webhook-эндпойнт по id

GET
/api/v1/webhooks/{id}
АвторизацияBearer <токен>

В: header

Параметры пути

id*string

Идентификатор эндпойнта

Форматuuid

Тело ответа

application/json

application/problem+json

curl -X GET "https://loading/api/v1/webhooks/497f6eca-6276-4993-bfeb-53cbbbba6f08"
{
  "clientId": "string",
  "createdAt": "2019-08-24T14:15:22Z",
  "createdBy": "25a02396-1048-48f9-bf93-102d2fb7895e",
  "events": [
    "string"
  ],
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "isActive": true,
  "name": "string",
  "teamId": "a4ede8ba-7c0a-4485-8763-cbd9b282fbec",
  "updatedAt": "2019-08-24T14:15:22Z",
  "url": "http://example.com"
}
{
  "code": "string",
  "detail": "string",
  "errors": [
    {
      "name": "string",
      "pointer": "string",
      "reason": "string",
      "rule": "string"
    }
  ],
  "instance": "string",
  "request_id": "string",
  "status": 0,
  "title": "string",
  "trace_id": "string",
  "type": "http://example.com",
  "property1": null,
  "property2": null
}

Обновить webhook-эндпойнт

PATCH
/api/v1/webhooks/{id}
АвторизацияBearer <токен>

В: header

Параметры пути

id*string

Идентификатор эндпойнта

Форматuuid

Тело запроса

application/json

TypeScript-определения

Используйте тип request body в TypeScript.

Тело ответа

application/json

application/problem+json

curl -X PATCH "https://loading/api/v1/webhooks/497f6eca-6276-4993-bfeb-53cbbbba6f08" \  -H "Content-Type: application/json" \  -d '{}'
{
  "clientId": "string",
  "createdAt": "2019-08-24T14:15:22Z",
  "createdBy": "25a02396-1048-48f9-bf93-102d2fb7895e",
  "events": [
    "string"
  ],
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "isActive": true,
  "name": "string",
  "teamId": "a4ede8ba-7c0a-4485-8763-cbd9b282fbec",
  "updatedAt": "2019-08-24T14:15:22Z",
  "url": "http://example.com"
}
{
  "code": "string",
  "detail": "string",
  "errors": [
    {
      "name": "string",
      "pointer": "string",
      "reason": "string",
      "rule": "string"
    }
  ],
  "instance": "string",
  "request_id": "string",
  "status": 0,
  "title": "string",
  "trace_id": "string",
  "type": "http://example.com",
  "property1": null,
  "property2": null
}

Удалить webhook-эндпойнт

DELETE
/api/v1/webhooks/{id}
АвторизацияBearer <токен>

В: header

Параметры пути

id*string

Идентификатор эндпойнта

Форматuuid

Тело ответа

application/problem+json

curl -X DELETE "https://loading/api/v1/webhooks/497f6eca-6276-4993-bfeb-53cbbbba6f08"
Пусто
{
  "code": "string",
  "detail": "string",
  "errors": [
    {
      "name": "string",
      "pointer": "string",
      "reason": "string",
      "rule": "string"
    }
  ],
  "instance": "string",
  "request_id": "string",
  "status": 0,
  "title": "string",
  "trace_id": "string",
  "type": "http://example.com",
  "property1": null,
  "property2": null
}

Список попыток доставки

GET
/api/v1/webhooks/{id}/deliveries
АвторизацияBearer <токен>

В: header

Параметры пути

id*string

Идентификатор эндпойнта

Форматuuid

Тело ответа

application/json

curl -X GET "https://loading/api/v1/webhooks/497f6eca-6276-4993-bfeb-53cbbbba6f08/deliveries"
[
  {
    "attempts": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "deliveredAt": "2019-08-24T14:15:22Z",
    "endpointId": "c8d2c7e1-e4b1-4108-9e29-3429a36a1ef3",
    "error": "string",
    "eventId": "string",
    "eventType": "string",
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "lastAttemptAt": "2019-08-24T14:15:22Z",
    "maxAttempts": 0,
    "nextRetryAt": "2019-08-24T14:15:22Z",
    "payload": null,
    "responseStatus": 0,
    "status": "pending",
    "teamId": "a4ede8ba-7c0a-4485-8763-cbd9b282fbec"
  }
]

Сгенерировать новый секрет webhook

POST
/api/v1/webhooks/{id}/rotate-secret
АвторизацияBearer <токен>

В: header

Параметры пути

id*string

Идентификатор эндпойнта

Форматuuid

Тело ответа

application/json

application/problem+json

curl -X POST "https://loading/api/v1/webhooks/497f6eca-6276-4993-bfeb-53cbbbba6f08/rotate-secret"
{
  "clientId": "string",
  "createdAt": "2019-08-24T14:15:22Z",
  "createdBy": "25a02396-1048-48f9-bf93-102d2fb7895e",
  "events": [
    "string"
  ],
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "isActive": true,
  "name": "string",
  "teamId": "a4ede8ba-7c0a-4485-8763-cbd9b282fbec",
  "updatedAt": "2019-08-24T14:15:22Z",
  "url": "http://example.com",
  "secret": "string"
}
{
  "code": "string",
  "detail": "string",
  "errors": [
    {
      "name": "string",
      "pointer": "string",
      "reason": "string",
      "rule": "string"
    }
  ],
  "instance": "string",
  "request_id": "string",
  "status": 0,
  "title": "string",
  "trace_id": "string",
  "type": "http://example.com",
  "property1": null,
  "property2": null
}