Skip to content

client.webhook_endpoints

View as Markdown

client.webhook_endpoints — the webhookEndpoints operations.

On AsyncKindgi every method is the same, awaited.

list(
*,
limit: int | None = None,
cursor: str | None = None,
timeout: float | None = None,
) -> WebhookEndpointCollectionPage
Signature

List webhook endpoints. GET /v1/webhook-endpoints

create(
body: CreateWebhookEndpointBody | Mapping[str, Any] | None = None,
/,
*,
idempotency_key: str | None = None,
timeout: float | None = None,
**fields: Any,
) -> WebhookEndpoint
Signature

Register a webhook endpoint. POST /v1/webhook-endpoints

Registers a URL the platform sends signed events to. The signing secret is shared with the receiver, so it lives in your secrets (.env in development, the secrets store in production) and the endpoint references it by name (secretRef). Store it first; POST /v1/webhook-endpoints/generate-secret makes a strong one. Deliveries are signed in the Standard Webhooks format (webhook-id, webhook-timestamp, webhook-signature); verify with verifyWebhook from @kindgi/crypto or any Standard Webhooks library. The event bodies are described under webhooks in this document.

client.webhook_endpoints.generate_secret()

Section titled “client.webhook_endpoints.generate_secret()”
generate_secret(*, timeout: float | None = None) -> GeneratedWebhookSecret
Signature

Generate a webhook signing secret. POST /v1/webhook-endpoints/generate-secret

Returns a new strong secret (whsec_ + base64 of 32 random bytes). Nothing is stored: put it in your secrets, then register the endpoint with its name. Sent with an Idempotency-Key, a retry gets 409 idempotency-key-replay-withheld, not the secret again.

get(endpoint_id: str | UUID, /, *, timeout: float | None = None) -> WebhookEndpoint
Signature

Fetch a webhook endpoint. GET /v1/webhook-endpoints/{endpointId}

update(
endpoint_id: str | UUID,
body: PatchWebhookEndpointBody | Mapping[str, Any] | None = None,
/,
*,
idempotency_key: str | None = None,
timeout: float | None = None,
**fields: Any,
) -> WebhookEndpoint
Signature

Update a webhook endpoint. PATCH /v1/webhook-endpoints/{endpointId}

To rotate the signing secret, rotate the secret in your secrets store (POST /v1/secrets/{name}/rotate); point secretRef at another secret to switch.

unregister(
endpoint_id: str | UUID,
/,
*,
idempotency_key: str | None = None,
timeout: float | None = None,
) -> WebhookEndpointUnregisterResult
Signature

Unregister a webhook endpoint (soft delete). POST /v1/webhook-endpoints/{endpointId}/unregister

The endpoint stops receiving events; its pending deliveries are abandoned (failed). Idempotent.

client.webhook_endpoints.list_deliveries()

Section titled “client.webhook_endpoints.list_deliveries()”
list_deliveries(
endpoint_id: str | UUID,
/,
*,
status: Literal['pending', 'delivered', 'failed'] | None = None,
limit: int | None = None,
cursor: str | None = None,
timeout: float | None = None,
) -> WebhookDeliveryCollectionPage
Signature

List a webhook endpoint's deliveries. GET /v1/webhook-endpoints/{endpointId}/deliveries

Newest first. Each delivery carries the event it delivers.

redeliver(
endpoint_id: str | UUID,
delivery_id: str | UUID,
/,
*,
idempotency_key: str | None = None,
timeout: float | None = None,
) -> WebhookDelivery
Signature

Redeliver an event. POST /v1/webhook-endpoints/{endpointId}/deliveries/{deliveryId}/redeliver

Queues the delivery again now, whatever its status; its attempts start over.

send_test(
endpoint_id: str | UUID,
/,
*,
idempotency_key: str | None = None,
timeout: float | None = None,
) -> WebhookDelivery
Signature

Send a test event to a webhook endpoint. POST /v1/webhook-endpoints/{endpointId}/test

Queues a webhook.test event, signed like any other, to check the receiver end to end. Follow it in the delivery log.