Webhook endpoints
Where the calling key's environment's events are sent.
signed POSTs to your backend when something happens (a balance runs low, a credit lands, a key is revoked), so you react without polling. Each delivery is signed with the endpoint's secret (hixel-signature); see the webhooks of this document for every event.
| Operation | Method | SDK |
|---|---|---|
| List webhook endpoints | GET | hixel.webhookEndpoints.list |
| Create a webhook endpoint | POST | hixel.webhookEndpoints.create |
| Get a webhook endpoint | GET | hixel.webhookEndpoints.get |
| Update a webhook endpoint | PATCH | hixel.webhookEndpoints.update |
| Delete a webhook endpoint | DELETE | hixel.webhookEndpoints.delete |
| Rotate a webhook endpoint's secret | POST | hixel.webhookEndpoints.rotateSecret |
| Send a test event | POST | hixel.webhookEndpoints.test |
| List an endpoint's deliveries | GET | hixel.webhookEndpoints.listDeliveries |
| Redeliver a failed delivery | POST | hixel.webhookEndpoints.redeliver |
List webhook endpoints#
A page of the environment's webhook endpoints (at most 16 in all), oldest first.
Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
cursor | query | string | The next_cursor of the previous page, to read the next one; left out for the first page. Pass the same filters with it. |
limit | query | integer | How many items the page holds: an integer from 1 to 100; 50 when left out. |
Response 200: WebhookEndpointList
| Field | Type | Description |
|---|---|---|
data required | array of WebhookEndpoint | |
data[].id required | string | The id of a webhook endpoint (we_…). |
data[].organization_id required | string | The id of your organization (org_…). |
data[].project_id required | string | The id of a project (proj_…). |
data[].environment_id required | string | The id of an environment (env_…). |
data[].url required | string | Where events are sent. |
data[].description required | string | null | A note of yours; null for none. |
data[].event_types required | array of "*" | "wallet.balance_low" | "wallet.depleted" | "wallet.credited" | "wallet.grant_expired" | "wallet.credit_rejected" | … | The event types the endpoint receives; * is every type but usage.recorded, which an endpoint receives only by naming it. |
data[].enabled required | boolean | Whether events are sent to it. |
data[].disabled_reason required | "manual" | "failing" | null | failing when the platform disabled it after failing continuously; null while enabled. |
data[].disabled_at required | string | null | When it was disabled; null while enabled. |
data[].failing_since required | string | null | The first failed attempt since the last success; null while it succeeds. |
data[].consecutive_failures required | integer | Attempts failed in a row since the last success. |
data[].last_succeeded_at required | string | null | When a delivery to it last succeeded; null before the first. |
data[].secret_last_four required | string | The signing secret's last four characters, to tell secrets apart. |
data[].previous_secret_expires_at required | string | null | Until when the secret replaced by the last rotation still signs too; null for none. |
data[].created_at required | string (date-time) | |
data[].updated_at required | string (date-time) | |
next_cursor required | string | null | Pass back as cursor for the next page; null on the last page. |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_cursor: The cursor is not one this list gave.environment_required: a project key was sent withoutx-hixel-environment.invalid_query: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.
- 404
environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own. - 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/webhook_endpoints" \
-H "Authorization: Bearer $HIXEL_API_KEY"for await (const item of hixel.webhookEndpoints.list()) {
console.log(item);
}Create a webhook endpoint#
Adds an endpoint the environment's events are sent to, at most 16, and answers its signing secret, which is never shown again.
Takes an environment key with the management scope, or a project key with the admin role, naming the environment in x-hixel-environment. Accepts an Idempotency-Key header: a retry with the same key runs once.
Request body: CreateWebhookEndpointBody
| Field | Type | Description |
|---|---|---|
url required | string | Where events are sent: https:// on a public host name, without user information, query or fragment. |
description | string | |
event_types | array of string | ["*"] when left out: every event but usage.recorded. |
Response 200: WebhookEndpointWithSecret
| Field | Type | Description |
|---|---|---|
endpoint required | WebhookEndpoint | Where the environment's events are sent, as every read shows it: never its signing secret. |
endpoint.id required | string | The id of a webhook endpoint (we_…). |
endpoint.organization_id required | string | The id of your organization (org_…). |
endpoint.project_id required | string | The id of a project (proj_…). |
endpoint.environment_id required | string | The id of an environment (env_…). |
endpoint.url required | string | Where events are sent. |
endpoint.description required | string | null | A note of yours; null for none. |
endpoint.event_types required | array of "*" | "wallet.balance_low" | "wallet.depleted" | "wallet.credited" | "wallet.grant_expired" | "wallet.credit_rejected" | … | The event types the endpoint receives; * is every type but usage.recorded, which an endpoint receives only by naming it. |
endpoint.enabled required | boolean | Whether events are sent to it. |
endpoint.disabled_reason required | "manual" | "failing" | null | failing when the platform disabled it after failing continuously; null while enabled. |
endpoint.disabled_at required | string | null | When it was disabled; null while enabled. |
endpoint.failing_since required | string | null | The first failed attempt since the last success; null while it succeeds. |
endpoint.consecutive_failures required | integer | Attempts failed in a row since the last success. |
endpoint.last_succeeded_at required | string | null | When a delivery to it last succeeded; null before the first. |
endpoint.secret_last_four required | string | The signing secret's last four characters, to tell secrets apart. |
endpoint.previous_secret_expires_at required | string | null | Until when the secret replaced by the last rotation still signs too; null for none. |
endpoint.created_at required | string (date-time) | |
endpoint.updated_at required | string (date-time) | |
secret required | string | null | The endpoint's signing secret, whsec_…: store it now, it is never shown again. null in a response replayed for an Idempotency-Key. |
Errors
- 400
invalid_parameter,invalid_url: The request is malformed or fails validation;paramnames the field.invalid_idempotency_key: anIdempotency-Keyis 1 to 255 characters of visible ASCII.environment_required: a project key was sent withoutx-hixel-environment.invalid_payload,malformed_body,body_too_large: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.role_not_allowed: the project key'smemberrole does not allow this; it takesadmin.
- 404
environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own. - 409
project_archived: This project is archived.environment_archived: This environment is archived.webhook_endpoint_limit_reached: This environment has the most webhook endpoints it may have (16). Delete one first.idempotency_key_reused,idempotency_key_in_use: the key was used for another request (method, path or body), or the first request with it is still running.
- 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.database_unavailable: the stored response to the key could not be read or written; retry later.
curl -X POST "https://api.hixel.dev/v1/webhook_endpoints" \
-H "Authorization: Bearer $HIXEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://app.example.com/webhooks/gateway"
}'const webhookEndpointWithSecret = await hixel.webhookEndpoints.create({
url: "https://app.example.com/webhooks/gateway",
});Get a webhook endpoint#
The endpoint, never its signing secret.
Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string | The endpoint's id (we_…). |
Response 200: WebhookEndpoint
| Field | Type | Description |
|---|---|---|
id required | string | The id of a webhook endpoint (we_…). |
organization_id required | string | The id of your organization (org_…). |
project_id required | string | The id of a project (proj_…). |
environment_id required | string | The id of an environment (env_…). |
url required | string | Where events are sent. |
description required | string | null | A note of yours; null for none. |
event_types required | array of "*" | "wallet.balance_low" | "wallet.depleted" | "wallet.credited" | "wallet.grant_expired" | "wallet.credit_rejected" | … | The event types the endpoint receives; * is every type but usage.recorded, which an endpoint receives only by naming it. |
enabled required | boolean | Whether events are sent to it. |
disabled_reason required | "manual" | "failing" | null | failing when the platform disabled it after failing continuously; null while enabled. |
disabled_at required | string | null | When it was disabled; null while enabled. |
failing_since required | string | null | The first failed attempt since the last success; null while it succeeds. |
consecutive_failures required | integer | Attempts failed in a row since the last success. |
last_succeeded_at required | string | null | When a delivery to it last succeeded; null before the first. |
secret_last_four required | string | The signing secret's last four characters, to tell secrets apart. |
previous_secret_expires_at required | string | null | Until when the secret replaced by the last rotation still signs too; null for none. |
created_at required | string (date-time) | |
updated_at required | string (date-time) |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.environment_required: a project key was sent withoutx-hixel-environment.invalid_params: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.
- 404
webhook_endpoint_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own.
- 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/webhook_endpoints/we_123" \
-H "Authorization: Bearer $HIXEL_API_KEY"const webhookEndpoint = await hixel.webhookEndpoints.get("we_123");Update a webhook endpoint#
Changes the fields given. enabled: false disables the endpoint; enabled: true enables it again and clears its failures.
Takes an environment key with the management scope, or a project key with the admin role, naming the environment in x-hixel-environment. Accepts an Idempotency-Key header: a retry with the same key runs once.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string | The endpoint's id (we_…). |
Request body: UpdateWebhookEndpointBody
| Field | Type | Description |
|---|---|---|
url | string | |
description | string | null | |
event_types | array of string | |
enabled | boolean | false disables the endpoint; true enables it again and clears its failures. |
Response 200: WebhookEndpoint
| Field | Type | Description |
|---|---|---|
id required | string | The id of a webhook endpoint (we_…). |
organization_id required | string | The id of your organization (org_…). |
project_id required | string | The id of a project (proj_…). |
environment_id required | string | The id of an environment (env_…). |
url required | string | Where events are sent. |
description required | string | null | A note of yours; null for none. |
event_types required | array of "*" | "wallet.balance_low" | "wallet.depleted" | "wallet.credited" | "wallet.grant_expired" | "wallet.credit_rejected" | … | The event types the endpoint receives; * is every type but usage.recorded, which an endpoint receives only by naming it. |
enabled required | boolean | Whether events are sent to it. |
disabled_reason required | "manual" | "failing" | null | failing when the platform disabled it after failing continuously; null while enabled. |
disabled_at required | string | null | When it was disabled; null while enabled. |
failing_since required | string | null | The first failed attempt since the last success; null while it succeeds. |
consecutive_failures required | integer | Attempts failed in a row since the last success. |
last_succeeded_at required | string | null | When a delivery to it last succeeded; null before the first. |
secret_last_four required | string | The signing secret's last four characters, to tell secrets apart. |
previous_secret_expires_at required | string | null | Until when the secret replaced by the last rotation still signs too; null for none. |
created_at required | string (date-time) | |
updated_at required | string (date-time) |
Errors
- 400
invalid_parameter,invalid_url: The request is malformed or fails validation;paramnames the field.invalid_idempotency_key: anIdempotency-Keyis 1 to 255 characters of visible ASCII.environment_required: a project key was sent withoutx-hixel-environment.invalid_params,invalid_payload,malformed_body,body_too_large: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.role_not_allowed: the project key'smemberrole does not allow this; it takesadmin.
- 404
webhook_endpoint_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own.
- 409
project_archived: This project is archived.environment_archived: This environment is archived.idempotency_key_reused,idempotency_key_in_use: the key was used for another request (method, path or body), or the first request with it is still running.
- 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.database_unavailable: the stored response to the key could not be read or written; retry later.
curl -X PATCH "https://api.hixel.dev/v1/webhook_endpoints/we_123" \
-H "Authorization: Bearer $HIXEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://app.example.com/webhooks/gateway"
}'const webhookEndpoint = await hixel.webhookEndpoints.update("we_123", {
url: "https://app.example.com/webhooks/gateway",
});Delete a webhook endpoint#
Deletes the endpoint; events are no longer sent to it. Answers 204 with no body.
Takes an environment key with the management scope, or a project key with the admin role, naming the environment in x-hixel-environment. Accepts an Idempotency-Key header: a retry with the same key runs once.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string | The endpoint's id (we_…). |
Response 204
No body.
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_idempotency_key: anIdempotency-Keyis 1 to 255 characters of visible ASCII.environment_required: a project key was sent withoutx-hixel-environment.invalid_params: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.role_not_allowed: the project key'smemberrole does not allow this; it takesadmin.
- 404
webhook_endpoint_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own.
- 409
project_archived: This project is archived.environment_archived: This environment is archived.idempotency_key_reused,idempotency_key_in_use: the key was used for another request (method, path or body), or the first request with it is still running.
- 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.database_unavailable: the stored response to the key could not be read or written; retry later.
curl -X DELETE "https://api.hixel.dev/v1/webhook_endpoints/we_123" \
-H "Authorization: Bearer $HIXEL_API_KEY"await hixel.webhookEndpoints.delete("we_123");Rotate a webhook endpoint's secret#
A new signing secret, shown once. The old one keeps signing beside it for grace_period_seconds (24 hours when left out, 0 to 7 days), so a delivery carries a signature of each. The body may be empty.
Takes an environment key with the management scope, or a project key with the admin role, naming the environment in x-hixel-environment. Accepts an Idempotency-Key header: a retry with the same key runs once.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string | The endpoint's id (we_…). |
Request body: RotateWebhookSecretBody
| Field | Type | Description |
|---|---|---|
grace_period_seconds | integer |
Response 200: WebhookEndpointWithSecret
| Field | Type | Description |
|---|---|---|
endpoint required | WebhookEndpoint | Where the environment's events are sent, as every read shows it: never its signing secret. |
endpoint.id required | string | The id of a webhook endpoint (we_…). |
endpoint.organization_id required | string | The id of your organization (org_…). |
endpoint.project_id required | string | The id of a project (proj_…). |
endpoint.environment_id required | string | The id of an environment (env_…). |
endpoint.url required | string | Where events are sent. |
endpoint.description required | string | null | A note of yours; null for none. |
endpoint.event_types required | array of "*" | "wallet.balance_low" | "wallet.depleted" | "wallet.credited" | "wallet.grant_expired" | "wallet.credit_rejected" | … | The event types the endpoint receives; * is every type but usage.recorded, which an endpoint receives only by naming it. |
endpoint.enabled required | boolean | Whether events are sent to it. |
endpoint.disabled_reason required | "manual" | "failing" | null | failing when the platform disabled it after failing continuously; null while enabled. |
endpoint.disabled_at required | string | null | When it was disabled; null while enabled. |
endpoint.failing_since required | string | null | The first failed attempt since the last success; null while it succeeds. |
endpoint.consecutive_failures required | integer | Attempts failed in a row since the last success. |
endpoint.last_succeeded_at required | string | null | When a delivery to it last succeeded; null before the first. |
endpoint.secret_last_four required | string | The signing secret's last four characters, to tell secrets apart. |
endpoint.previous_secret_expires_at required | string | null | Until when the secret replaced by the last rotation still signs too; null for none. |
endpoint.created_at required | string (date-time) | |
endpoint.updated_at required | string (date-time) | |
secret required | string | null | The endpoint's signing secret, whsec_…: store it now, it is never shown again. null in a response replayed for an Idempotency-Key. |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_idempotency_key: anIdempotency-Keyis 1 to 255 characters of visible ASCII.environment_required: a project key was sent withoutx-hixel-environment.invalid_params,invalid_payload,malformed_body,body_too_large: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.role_not_allowed: the project key'smemberrole does not allow this; it takesadmin.
- 404
webhook_endpoint_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own.
- 409
project_archived: This project is archived.environment_archived: This environment is archived.idempotency_key_reused,idempotency_key_in_use: the key was used for another request (method, path or body), or the first request with it is still running.
- 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.database_unavailable: the stored response to the key could not be read or written; retry later.
curl -X POST "https://api.hixel.dev/v1/webhook_endpoints/we_123/rotate_secret" \
-H "Authorization: Bearer $HIXEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"grace_period_seconds": 3600
}'const webhookEndpointWithSecret = await hixel.webhookEndpoints.rotateSecret("we_123", {
grace_period_seconds: 3600,
});Send a test event#
Sends a webhook.test event to this endpoint alone, whatever it subscribes to, to check that it receives and verifies deliveries.
Takes an environment key with the management scope, or a project key with the admin role, naming the environment in x-hixel-environment. Accepts an Idempotency-Key header: a retry with the same key runs once.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string | The endpoint's id (we_…). |
Response 200: WebhookTestSent
| Field | Type | Description |
|---|---|---|
event_id required | string | The id of an event (evt_…): the same in every delivery of it. |
delivery required | WebhookDelivery | One event's delivery to one endpoint: never the request's signature. |
delivery.id required | string | The id of one event's delivery to one endpoint (whd_…). |
delivery.endpoint_id required | string | The id of a webhook endpoint (we_…). |
delivery.event_id required | string | The id of an event (evt_…): the same in every delivery of it. |
delivery.event_type required | "wallet.balance_low" | "wallet.depleted" | "wallet.credited" | "wallet.grant_expired" | "wallet.credit_rejected" | "wallet.spend_limit_reached" | … | |
delivery.status required | "pending" | "succeeded" | "failed" | pending while attempts remain, then succeeded or failed. |
delivery.attempts required | integer | Attempts made so far. |
delivery.next_attempt_at required | string | null | When the next attempt is due; null once the delivery succeeded or failed. |
delivery.last_attempt_at required | string | null | When it was last attempted; null before the first. |
delivery.last_response_status required | integer | null | The HTTP status of the last answer; null when none came (last_error says why). |
delivery.last_response_body required | string | null | The start of the last answer's body: at most 1024 characters. |
delivery.last_error required | "timeout" | "network" | "redirect" | "http_status" | "internal" | string | null | Why the last attempt failed: timeout, network, redirect, http_status, or internal (a fault on the platform's side, not counted against the endpoint). |
delivery.completed_at required | string | null | When it succeeded or failed for good; null while pending. |
delivery.created_at required | string (date-time) |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_idempotency_key: anIdempotency-Keyis 1 to 255 characters of visible ASCII.environment_required: a project key was sent withoutx-hixel-environment.invalid_params: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.role_not_allowed: the project key'smemberrole does not allow this; it takesadmin.
- 404
webhook_endpoint_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own.
- 409
project_archived: This project is archived.environment_archived: This environment is archived.webhook_endpoint_disabled: This webhook endpoint is disabled. Enable it first.idempotency_key_reused,idempotency_key_in_use: the key was used for another request (method, path or body), or the first request with it is still running.
- 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.database_unavailable: the stored response to the key could not be read or written; retry later.
curl -X POST "https://api.hixel.dev/v1/webhook_endpoints/we_123/test" \
-H "Authorization: Bearer $HIXEL_API_KEY"const webhookTestSent = await hixel.webhookEndpoints.test("we_123");List an endpoint's deliveries#
A page of the endpoint's deliveries, newest first.
Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string | The endpoint's id (we_…). |
status | query | "pending" | "succeeded" | "failed" | Only deliveries with this status. |
event_id | query | string | Only the deliveries of this event (evt_…). |
cursor | query | string | The next_cursor of the previous page, to read the next one; left out for the first page. Pass the same filters with it. |
limit | query | integer | How many items the page holds: an integer from 1 to 100; 50 when left out. |
Response 200: WebhookDeliveryList
| Field | Type | Description |
|---|---|---|
data required | array of WebhookDelivery | |
data[].id required | string | The id of one event's delivery to one endpoint (whd_…). |
data[].endpoint_id required | string | The id of a webhook endpoint (we_…). |
data[].event_id required | string | The id of an event (evt_…): the same in every delivery of it. |
data[].event_type required | "wallet.balance_low" | "wallet.depleted" | "wallet.credited" | "wallet.grant_expired" | "wallet.credit_rejected" | "wallet.spend_limit_reached" | … | |
data[].status required | "pending" | "succeeded" | "failed" | pending while attempts remain, then succeeded or failed. |
data[].attempts required | integer | Attempts made so far. |
data[].next_attempt_at required | string | null | When the next attempt is due; null once the delivery succeeded or failed. |
data[].last_attempt_at required | string | null | When it was last attempted; null before the first. |
data[].last_response_status required | integer | null | The HTTP status of the last answer; null when none came (last_error says why). |
data[].last_response_body required | string | null | The start of the last answer's body: at most 1024 characters. |
data[].last_error required | "timeout" | "network" | "redirect" | "http_status" | "internal" | string | null | Why the last attempt failed: timeout, network, redirect, http_status, or internal (a fault on the platform's side, not counted against the endpoint). |
data[].completed_at required | string | null | When it succeeded or failed for good; null while pending. |
data[].created_at required | string (date-time) | |
next_cursor required | string | null | Pass back as cursor for the next page; null on the last page. |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_cursor: The cursor is not one this list gave.environment_required: a project key was sent withoutx-hixel-environment.invalid_params,invalid_query: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.
- 404
webhook_endpoint_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own.
- 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/webhook_endpoints/we_123/deliveries" \
-H "Authorization: Bearer $HIXEL_API_KEY"for await (const item of hixel.webhookEndpoints.listDeliveries("we_123")) {
console.log(item);
}Redeliver a failed delivery#
Sends a failed delivery again, with a fresh retry schedule.
Takes an environment key with the management scope, or a project key with the admin role, naming the environment in x-hixel-environment. Accepts an Idempotency-Key header: a retry with the same key runs once.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string | The endpoint's id (we_…). |
delivery_id required | path | string | The delivery's id (whd_…). |
Response 200: WebhookDelivery
| Field | Type | Description |
|---|---|---|
id required | string | The id of one event's delivery to one endpoint (whd_…). |
endpoint_id required | string | The id of a webhook endpoint (we_…). |
event_id required | string | The id of an event (evt_…): the same in every delivery of it. |
event_type required | "wallet.balance_low" | "wallet.depleted" | "wallet.credited" | "wallet.grant_expired" | "wallet.credit_rejected" | "wallet.spend_limit_reached" | … | |
status required | "pending" | "succeeded" | "failed" | pending while attempts remain, then succeeded or failed. |
attempts required | integer | Attempts made so far. |
next_attempt_at required | string | null | When the next attempt is due; null once the delivery succeeded or failed. |
last_attempt_at required | string | null | When it was last attempted; null before the first. |
last_response_status required | integer | null | The HTTP status of the last answer; null when none came (last_error says why). |
last_response_body required | string | null | The start of the last answer's body: at most 1024 characters. |
last_error required | "timeout" | "network" | "redirect" | "http_status" | "internal" | string | null | Why the last attempt failed: timeout, network, redirect, http_status, or internal (a fault on the platform's side, not counted against the endpoint). |
completed_at required | string | null | When it succeeded or failed for good; null while pending. |
created_at required | string (date-time) |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_idempotency_key: anIdempotency-Keyis 1 to 255 characters of visible ASCII.environment_required: a project key was sent withoutx-hixel-environment.invalid_params: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.role_not_allowed: the project key'smemberrole does not allow this; it takesadmin.
- 404
webhook_endpoint_not_found,webhook_delivery_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own.
- 409
project_archived: This project is archived.environment_archived: This environment is archived.webhook_endpoint_disabled: This webhook endpoint is disabled. Enable it first.webhook_delivery_not_failed: Only a delivery that failed can be redelivered.idempotency_key_reused,idempotency_key_in_use: the key was used for another request (method, path or body), or the first request with it is still running.
- 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.database_unavailable: the stored response to the key could not be read or written; retry later.
curl -X POST "https://api.hixel.dev/v1/webhook_endpoints/we_123/deliveries/whd_123/redeliver" \
-H "Authorization: Bearer $HIXEL_API_KEY"const webhookDelivery = await hixel.webhookEndpoints.redeliver("we_123", "whd_123");