API reference
Webhooks
Register endpoints, inspect deliveries and retry failures.
Endpoints
- POST
/v1/webhooksRegister a webhook endpoint - GET
/v1/webhooksList your webhook endpoints - GET
/v1/webhooks/{id}Read one webhook endpoint - PATCH
/v1/webhooks/{id}Update a webhook endpoint - DELETE
/v1/webhooks/{id}Delete a webhook endpoint - POST
/v1/webhooks/{id}/testSend a test delivery - GET
/v1/webhooks/{id}/deliveriesList an endpoint's deliveries - POST
/v1/webhooks/{id}/deliveries/{deliveryId}/retryRetry a delivery - GET
/v1/webhooks/event-typesList the webhook event types
Register a webhook endpoint#
POST/v1/webhooks
Required scope webhooks:manage
Registers an https endpoint and returns its signing secret — the ONLY time the secret is ever returned. Store it now; ekash cannot show it again, and you need it to verify the ekash-signature header on every delivery.
Each delivery is POSTed as { "id", "type", "created_at", "data" }, where data is the same object the corresponding REST resource returns. Delivery is at-least-once: deduplicate on id, and treat the events as idempotent state reports.
Request body
application/json · required
Schema CreateWebhookRequest
urlstringrequiredhttps url ekash will POST to. http://localhost is accepted outside production.
eventsarray of stringoptionalEvent types to receive. Omit (or send an empty array) to receive every event.
descriptionstringoptionalYour own note, shown in the ekash admin portal
Responses
201Created — the response contains the secret
400Not an https url, or an unknown event type
application/json
Schema Error
errorErrorBody5 child attributes
typestringCoarse error family
codestringStable machine-readable code — branch on this, not on the message
messagestringHuman-readable explanation, safe to log
fieldsmap of stringPer-field errors, present for validation failures
request_idstringEcho of the X-Request-Id header — quote it in a support request
{
"error": {
"type": "invalid_request",
"code": "https_required",
"message": "Not an https url, or an unknown event type.",
"request_id": "6f0c1e1a-2b7d-4c55-9f0e-3a1d2c4b5e6f"
}
}403Missing the webhooks:manage scope
application/json
Schema Error
errorErrorBody5 child attributes
typestringCoarse error family
codestringStable machine-readable code — branch on this, not on the message
messagestringHuman-readable explanation, safe to log
fieldsmap of stringPer-field errors, present for validation failures
request_idstringEcho of the X-Request-Id header — quote it in a support request
{
"error": {
"type": "permission",
"code": "insufficient_scope",
"message": "Missing the webhooks:manage scope.",
"request_id": "6f0c1e1a-2b7d-4c55-9f0e-3a1d2c4b5e6f"
}
}409This url is already registered, or the endpoint limit is reached
application/json
Schema Error
errorErrorBody5 child attributes
typestringCoarse error family
codestringStable machine-readable code — branch on this, not on the message
messagestringHuman-readable explanation, safe to log
fieldsmap of stringPer-field errors, present for validation failures
request_idstringEcho of the X-Request-Id header — quote it in a support request
{
"error": {
"type": "conflict",
"code": "endpoint_already_exists",
"message": "This url is already registered, or the endpoint limit is reached.",
"request_id": "6f0c1e1a-2b7d-4c55-9f0e-3a1d2c4b5e6f"
}
}curl -X POST https://stage.ekash.ai/dev/v1/webhooks \
-H "Authorization: Bearer $EKASH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://merchant.example.com/ekash/webhooks",
"events": [
"payment.sent",
"payment.refunded",
"payment.canceled"
],
"description": "ledger sync"
}'{
"data": {
"id": "12",
"url": "https://merchant.example.com/ekash/webhooks",
"events": [
"payment.sent",
"payment.refunded",
"payment.canceled"
],
"enabled": true,
"description": "ledger sync",
"consecutive_failures": 0,
"created_at": "2026-09-22T09:14:03Z",
"secret": "9f2c…64 hex characters…",
"secret_note": "Store this now. It is shown once and cannot be retrieved again."
}
}List your webhook endpoints#
GET/v1/webhooks
Required scope webhooks:manage
Never includes the signing secret.
Responses
200OK
application/json
Schema List
dataarray of map of objectnext_cursorstringPass back as ?cursor= to fetch the next page; null at the end of the list
has_moreboolean
curl https://stage.ekash.ai/dev/v1/webhooks \
-H "Authorization: Bearer $EKASH_API_KEY"{
"data": [
{
"id": "12",
"url": "https://merchant.example.com/ekash/webhooks",
"events": [
"payment.sent",
"payment.refunded",
"payment.canceled"
],
"enabled": true,
"description": "ledger sync",
"consecutive_failures": 0,
"created_at": "2026-09-22T09:14:03Z"
}
],
"next_cursor": null,
"has_more": false
}Read one webhook endpoint#
GET/v1/webhooks/{id}
Required scope webhooks:manage
Path parameters
idintegerrequired
Responses
200The endpoint (never includes its secret)
404No such endpoint for your company
application/json
Schema Error
errorErrorBody5 child attributes
typestringCoarse error family
codestringStable machine-readable code — branch on this, not on the message
messagestringHuman-readable explanation, safe to log
fieldsmap of stringPer-field errors, present for validation failures
request_idstringEcho of the X-Request-Id header — quote it in a support request
{
"error": {
"type": "not_found",
"code": "webhook_endpoint_not_found",
"message": "No such endpoint for your company.",
"request_id": "6f0c1e1a-2b7d-4c55-9f0e-3a1d2c4b5e6f"
}
}curl https://stage.ekash.ai/dev/v1/webhooks/12 \
-H "Authorization: Bearer $EKASH_API_KEY"{
"data": {
"id": "12",
"url": "https://merchant.example.com/ekash/webhooks",
"events": [
"payment.sent",
"payment.refunded",
"payment.canceled"
],
"enabled": true,
"description": "ledger sync",
"consecutive_failures": 0,
"created_at": "2026-09-22T09:14:03Z"
}
}Update a webhook endpoint#
PATCH/v1/webhooks/{id}
Required scope webhooks:manage
Changes the subscribed events, enables or disables the endpoint, or updates the description. Re-enabling also clears the consecutive-failure count.
Disabling stops deliveries without losing the endpoint: anything queued for it while it is disabled is marked failed rather than retried, and can be retried by hand once you enable it again.
Path parameters
idintegerrequired
Request body
application/json · required
Schema UpdateWebhookRequest
eventsarray of stringoptionalenabledbooleanoptionalDisable to stop deliveries without losing the endpoint or its history
descriptionstringoptional
Responses
200OK
curl -X PATCH https://stage.ekash.ai/dev/v1/webhooks/12 \
-H "Authorization: Bearer $EKASH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"events": [
"payment.sent"
],
"enabled": true,
"description": "ledger sync"
}'{
"data": {
"id": "12",
"url": "https://merchant.example.com/ekash/webhooks",
"events": [
"payment.sent",
"payment.refunded",
"payment.canceled"
],
"enabled": false,
"description": "ledger sync",
"consecutive_failures": 0,
"created_at": "2026-09-22T09:14:03Z"
}
}Delete a webhook endpoint#
DELETE/v1/webhooks/{id}
Required scope webhooks:manage
Removes the endpoint and its delivery log. Your event history is NOT deleted — it stays readable through GET /v1/events.
Path parameters
idintegerrequired
Responses
204Deleted
No response body.
curl -X DELETE https://stage.ekash.ai/dev/v1/webhooks/12 \
-H "Authorization: Bearer $EKASH_API_KEY"HTTP/1.1 204 No ContentSend a test delivery#
POST/v1/webhooks/{id}/test
Required scope webhooks:manage
Queues a ping event to this endpoint alone, whatever it is subscribed to. Use it to prove the url is reachable and your signature verification works before you rely on it.
The response is the queued delivery, not its outcome — the dispatcher sends it within a few seconds. Poll GET /v1/webhooks/{id}/deliveries to see how it went.
Path parameters
idintegerrequired
Responses
202Test delivery queued
409The endpoint is disabled
application/json
Schema Error
errorErrorBody5 child attributes
typestringCoarse error family
codestringStable machine-readable code — branch on this, not on the message
messagestringHuman-readable explanation, safe to log
fieldsmap of stringPer-field errors, present for validation failures
request_idstringEcho of the X-Request-Id header — quote it in a support request
{
"error": {
"type": "conflict",
"code": "endpoint_disabled",
"message": "The endpoint is disabled.",
"request_id": "6f0c1e1a-2b7d-4c55-9f0e-3a1d2c4b5e6f"
}
}curl -X POST https://stage.ekash.ai/dev/v1/webhooks/12/test \
-H "Authorization: Bearer $EKASH_API_KEY"{
"data": {
"id": "731",
"event_id": "evt_11112222333344445555666677778888",
"event_type": "ping",
"endpoint_id": "12",
"status": "pending",
"attempt": 0,
"max_attempts": 8,
"response_status": null,
"response_body": null,
"latency_ms": null,
"error": null,
"next_attempt_at": "2026-09-22T09:14:03Z",
"delivered_at": null,
"created_at": "2026-09-22T09:14:03Z"
}
}List an endpoint's deliveries#
GET/v1/webhooks/{id}/deliveries
Required scope webhooks:manage
Newest first. Each row carries the attempt count, the status code the endpoint returned, the first 500 characters of its response and, while a retry is scheduled, next_attempt_at.
A delivery that fails every attempt in the schedule (1m, 5m, 30m, 2h, 6h, 12h, 24h) ends as dead and is not retried automatically.
Path parameters
idintegerrequired
Query parameters
cursorintegeroptionalnext_cursor from the previous page
limitintegeroptionalPage size, max 100
Responses
200OK
application/json
Schema List
dataarray of map of objectnext_cursorstringPass back as ?cursor= to fetch the next page; null at the end of the list
has_moreboolean
curl 'https://stage.ekash.ai/dev/v1/webhooks/12/deliveries?limit=25' \
-H "Authorization: Bearer $EKASH_API_KEY"{
"data": [
{
"id": "731",
"event_id": "evt_9f1c7b2e4a6d4f0b8c3e5a7d9f1b3c5e",
"event_type": "payment.sent",
"endpoint_id": "12",
"status": "delivered",
"attempt": 1,
"max_attempts": 8,
"response_status": 200,
"response_body": "",
"latency_ms": 184,
"error": null,
"next_attempt_at": null,
"delivered_at": "2026-09-22T09:30:01Z",
"created_at": "2026-09-22T09:30:00Z"
}
],
"next_cursor": null,
"has_more": false
}Retry a delivery#
POST/v1/webhooks/{id}/deliveries/{deliveryId}/retry
Required scope webhooks:manage
Re-queues a dead or failed delivery: attempt count back to 0, sent again within a few seconds, with the ORIGINAL payload — the snapshot taken when the event happened, not a fresh read. A delivery that already succeeded cannot be retried.
Path parameters
idintegerrequireddeliveryIdintegerrequired
Responses
202Re-queued
404No such delivery on this endpoint
application/json
Schema Error
errorErrorBody5 child attributes
typestringCoarse error family
codestringStable machine-readable code — branch on this, not on the message
messagestringHuman-readable explanation, safe to log
fieldsmap of stringPer-field errors, present for validation failures
request_idstringEcho of the X-Request-Id header — quote it in a support request
{
"error": {
"type": "not_found",
"code": "delivery_not_found",
"message": "No such delivery on this endpoint.",
"request_id": "6f0c1e1a-2b7d-4c55-9f0e-3a1d2c4b5e6f"
}
}409That delivery already succeeded
application/json
Schema Error
errorErrorBody5 child attributes
typestringCoarse error family
codestringStable machine-readable code — branch on this, not on the message
messagestringHuman-readable explanation, safe to log
fieldsmap of stringPer-field errors, present for validation failures
request_idstringEcho of the X-Request-Id header — quote it in a support request
{
"error": {
"type": "conflict",
"code": "already_delivered",
"message": "That delivery already succeeded.",
"request_id": "6f0c1e1a-2b7d-4c55-9f0e-3a1d2c4b5e6f"
}
}curl -X POST https://stage.ekash.ai/dev/v1/webhooks/12/deliveries/731/retry \
-H "Authorization: Bearer $EKASH_API_KEY"{
"data": {
"id": "731",
"event_id": "evt_9f1c7b2e4a6d4f0b8c3e5a7d9f1b3c5e",
"event_type": "payment.sent",
"endpoint_id": "12",
"status": "pending",
"attempt": 0,
"max_attempts": 8,
"response_status": 503,
"response_body": "Service Unavailable",
"latency_ms": 10000,
"error": null,
"next_attempt_at": "2026-09-23T10:00:00Z",
"delivered_at": null,
"created_at": "2026-09-22T09:30:00Z"
}
}List the webhook event types#
GET/v1/webhooks/event-types
Required scope webhooks:manage
Every value that can appear in type and be subscribed to.
Responses
200OK
curl https://stage.ekash.ai/dev/v1/webhooks/event-types \
-H "Authorization: Bearer $EKASH_API_KEY"{
"data": [
"payment.created",
"payment.validated",
"payment.validation_failed",
"payment.ready_to_process",
"payment.approved",
"payment.processing",
"payment.sent",
"payment.received",
"payment.canceled",
"payment.refunded",
"payment.on_hold",
"payment.unclaimed",
"batch.validated",
"batch.submitted",
"batch.approved",
"batch.rejected",
"ping"
]
}