Skip to content
Beta · The spec may still change before general availability. The API domain api.hensa.example is a placeholder. See changes →

Webhook endpoints

Register event URLs, rotate secrets, inspect deliveries and redeliver.

List webhook endpoints

GET/v1/webhook_endpoints

All URLs receiving events.

Returns

200 · A page of WebhookEndpoint plus nextCursor for the next page.

curl https://api.hensa.example/v1/webhook_endpoints \
-H "Authorization: Bearer $HENSA_API_KEY"
Response 200
{
"data": [
{
"id": "whe_01JD7R1S3T5V7X9Z1B3D5F7H9K",
"url": "https://cuahang.vn/webhooks/hensa",
"events": [
"payment_request.paid",
"bank_transaction.created"
],
"status": "active",
"secretLast4": "9f2a",
"createdAt": "2026-11-03T07:00:00Z"
}
]
}

Create a webhook endpoint

POST/v1/webhook_endpoints

Requires Idempotency-Key

The URL must be public HTTPS (private addresses are rejected). The signing secret (whsec_…) is returned once – store it now.

Request body

urlstringrequired

Public HTTPS URL that will receive events.

eventsstring[]required

Events to receive (at least one).

Values: bank_transaction.created payment_request.paid payment_request.partially_paid payment_request.expired bank_connection.status_changed

Returns

201 · WebhookEndpoint + secret

Possible errors

  • validation_error 400 Invalid request data – see message.
  • url_not_https 422 Webhook URLs must use HTTPS.
  • url_private_address 422 The URL resolves to a private address – not allowed.
curl -X POST https://api.hensa.example/v1/webhook_endpoints \
-H "Authorization: Bearer $HENSA_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"url":"https://cuahang.vn/webhooks/hensa","events":["payment_request.paid","bank_transaction.created"]}'
Response 201
{
"endpoint": {
"id": "whe_01JD7R1S3T5V7X9Z1B3D5F7H9K",
"url": "https://cuahang.vn/webhooks/hensa",
"events": [
"payment_request.paid",
"bank_transaction.created"
],
"status": "active",
"secretLast4": "9f2a",
"createdAt": "2026-11-03T07:00:00Z"
},
"secret": "…"
}

Delete a webhook endpoint

DELETE/v1/webhook_endpoints/{id}

Stops sending events to this URL immediately.

Parameters

idstring · pathrequired

Endpoint ID.

Returns

204 · No content.

Possible errors

  • not_found 404 Not found (or not owned by this key's store).
curl -X DELETE https://api.hensa.example/v1/webhook_endpoints/whe_01JD7R1S3T5V7X9Z1B3D5F7H9K \
-H "Authorization: Bearer $HENSA_API_KEY"

Rotate the signing secret

POST/v1/webhook_endpoints/{id}/rotate_secret

Creates a new secret. The old one stays valid for 24 hours – meanwhile each event carries two v1 signatures so you can switch without downtime.

Parameters

idstring · pathrequired

Endpoint ID.

Returns

200 · WebhookEndpoint + secret

Possible errors

  • not_found 404 Not found (or not owned by this key's store).
curl -X POST https://api.hensa.example/v1/webhook_endpoints/whe_01JD7R1S3T5V7X9Z1B3D5F7H9K/rotate_secret \
-H "Authorization: Bearer $HENSA_API_KEY"
Response 200
{
"endpoint": {
"id": "whe_01JD7R1S3T5V7X9Z1B3D5F7H9K",
"url": "https://cuahang.vn/webhooks/hensa",
"events": [
"payment_request.paid",
"bank_transaction.created"
],
"status": "active",
"secretLast4": "9f2a",
"createdAt": "2026-11-03T07:00:00Z"
},
"secret": "…"
}

Send a test event

POST/v1/webhook_endpoints/{id}/test

Sends a signed sample event to the endpoint right away and returns the result.

Parameters

idstring · pathrequired

Endpoint ID.

Returns

200 · WebhookDelivery

Possible errors

  • not_found 404 Not found (or not owned by this key's store).
curl -X POST https://api.hensa.example/v1/webhook_endpoints/whe_01JD7R1S3T5V7X9Z1B3D5F7H9K/test \
-H "Authorization: Bearer $HENSA_API_KEY"
Response 200
{
"id": "whd_01JD7QC4V6X8Z0B2D4F6H8K0MP",
"endpointId": "whe_01JD7R1S3T5V7X9Z1B3D5F7H9K",
"eventType": "payment_request.paid",
"status": "succeeded",
"httpStatus": 200,
"durationMs": 142,
"attempt": 1,
"createdAt": "2026-11-03T08:03:12Z"
}

List deliveries

GET/v1/webhook_endpoints/{id}/deliveries

Every delivery attempt in the last 30 days, including failures.

Parameters

idstring · pathrequired

Endpoint ID.

limitinteger · query

Items per page (1–100, default 25).

cursorstring · query

The nextCursor value from the previous page.

Returns

200 · A page of WebhookDelivery plus nextCursor for the next page.

Possible errors

  • not_found 404 Not found (or not owned by this key's store).
curl https://api.hensa.example/v1/webhook_endpoints/whe_01JD7R1S3T5V7X9Z1B3D5F7H9K/deliveries \
-H "Authorization: Bearer $HENSA_API_KEY"
Response 200
{
"data": [
{
"id": "whd_01JD7QC4V6X8Z0B2D4F6H8K0MP",
"endpointId": "whe_01JD7R1S3T5V7X9Z1B3D5F7H9K",
"eventType": "payment_request.paid",
"status": "succeeded",
"httpStatus": 200,
"durationMs": 142,
"attempt": 1,
"createdAt": "2026-11-03T08:03:12Z"
}
],
"nextCursor": "…"
}

Redeliver

POST/v1/webhook_deliveries/{id}/redeliver

Resends an event (within 30 days). Same event id – your system must be idempotent.

Parameters

idstring · pathrequired

Delivery ID.

Returns

200 · WebhookDelivery

Possible errors

  • not_found 404 Not found (or not owned by this key's store).
  • delivery_too_old 422 Only events from the last 30 days can be redelivered.
curl -X POST https://api.hensa.example/v1/webhook_deliveries/whd_01JD7QC4V6X8Z0B2D4F6H8K0MP/redeliver \
-H "Authorization: Bearer $HENSA_API_KEY"
Response 200
{
"id": "whd_01JD7QC4V6X8Z0B2D4F6H8K0MP",
"endpointId": "whe_01JD7R1S3T5V7X9Z1B3D5F7H9K",
"eventType": "payment_request.paid",
"status": "succeeded",
"httpStatus": 200,
"durationMs": 142,
"attempt": 1,
"createdAt": "2026-11-03T08:03:12Z"
}

Objects

WebhookEndpoint

idstringrequired

Endpoint ID.

urlstringrequired

Public HTTPS URL receiving events.

eventsstring[]required

Subscribed events.

Values: bank_transaction.created payment_request.paid payment_request.partially_paid payment_request.expired bank_connection.status_changed

statusstringrequired

active · failing (alerts sent) · disabled.

secretLast4stringrequired

Last 4 characters of the signing secret – for identification.

createdAtstringrequired

Creation time.

WebhookEndpoint · Example
{
"id": "whe_01JD7R1S3T5V7X9Z1B3D5F7H9K",
"url": "https://cuahang.vn/webhooks/hensa",
"events": [
"payment_request.paid",
"bank_transaction.created"
],
"status": "active",
"secretLast4": "9f2a",
"createdAt": "2026-11-03T07:00:00Z"
}

WebhookDelivery

idstringrequired

Delivery ID.

endpointIdstringrequired

Target endpoint.

eventTypestringrequired

Event type.

Values: bank_transaction.created payment_request.paid payment_request.partially_paid payment_request.expired bank_connection.status_changed

statusstringrequired

succeeded · failed · retrying.

httpStatusinteger | nullrequired

HTTP status your server returned.

Values:

durationMsinteger | nullrequired

Response time (ms).

Values:

attemptintegerrequired

Attempt number (1–8).

createdAtstringrequired

Delivery time.

WebhookDelivery · Example
{
"id": "whd_01JD7QC4V6X8Z0B2D4F6H8K0MP",
"endpointId": "whe_01JD7R1S3T5V7X9Z1B3D5F7H9K",
"eventType": "payment_request.paid",
"status": "succeeded",
"httpStatus": 200,
"durationMs": 142,
"attempt": 1,
"createdAt": "2026-11-03T08:03:12Z"
}