Webhooks
Have Superpay send each event to your endpoint as it happens, signed, retried and logged.
A webhook subscription sends the events you choose to an endpoint of yours as they happen. Each delivery is a POST whose body is the event, signed so you can check that Superpay sent it.
Deliveries follow the Standard Webhooks specification: a stock Standard Webhooks library verifies them with your subscription's secret, as it is.
| Endpoint | Idempotency-Key | Does |
|---|---|---|
POST /v1/webhook-subscriptions | Required | Create a subscription |
GET /v1/webhook-subscriptions | — | List subscriptions |
GET /v1/webhook-subscriptions/{id} | — | Retrieve a subscription |
POST /v1/webhook-subscriptions/{id} | Required | Update, disable or enable it |
DELETE /v1/webhook-subscriptions/{id} | — | Delete it |
POST /v1/webhook-subscriptions/{id}/rotate-secret | Required | Rotate its secret |
GET /v1/webhook-subscriptions/{id}/deliveries | — | List its deliveries |
GET /v1/webhook-subscriptions/{id}/deliveries/{delivery_id} | — | Retrieve a delivery and its attempts |
POST /v1/webhook-subscriptions/{id}/deliveries | Required | Redeliver an event |
Every route needs the webhooks:manage scope, reads included. It shows each subscription's full URL, so grant it only where it is needed. Subscriptions belong to one mode: a test subscription is sent test events, signed with its test secret, and a live subscription live events.
Webhooks tell you, the event log keeps you right
Deliveries arrive at least once, in no particular order, and an endpoint that is down misses what is sent meanwhile. Use webhooks to react quickly, and backfill from the event log to be sure you have seen everything.
Create a subscription#
/v1/webhook-subscriptionswebhooks:manageSubscribes a URL to the events you name. The subscription is ENABLED at once and is sent the matching events recorded from then on. Nothing is sent to the URL, and it is not looked up, when you create the subscription.
urlstringRequiredWhere deliveries go. At most 2048 bytes, following the URL rules. Stored and returned in canonical form.
enabled_eventsarray of stringsRequiredThe events to send, 1 to 64 entries, each once: an exact event type such as payout.completed, every type of a family such as payout.*, or * for everything. The families are payout, beneficiary, originator, fx, business, webhook_subscription and treasury. A family or * also matches types added later.
descriptionstringYour own note, at most 256 characters. It is never sent anywhere.
You cannot choose the secret. A body with any other field, such as secret, is rejected with 400 REQUEST_BODY_INVALID.
curl https://api.withsuperpay.com/v1/webhook-subscriptions \
-H "Authorization: Bearer $SUPERPAY_TOKEN" \
-H "Idempotency-Key: 6c1f0e2a-94b7-4d35-8a2e-7b0d5c3f9e41" \
-H "Content-Type: application/json" \
-d '{
"url": "https://hooks.example.com/superpay",
"enabled_events": ["payout.*", "beneficiary.verification_updated"],
"description": "Payout status for the ledger team"
}'{
"object": "webhook_subscription",
"id": "whs_01M2FR3E7G9J1K3M5P7R9T1V3X",
"url": "https://hooks.example.com/superpay",
"description": "Payout status for the ledger team",
"enabled_events": ["payout.*", "beneficiary.verification_updated"],
"api_version": "v1",
"status": "ENABLED",
"disabled_reason": null,
"status_changed_at": "2026-09-30T09:00:00Z",
"secret_version": 1,
"previous_secret_expires_at": null,
"health": {
"consecutive_failures": 0,
"failing_since": null,
"circuit_open_until": null,
"last_success_at": null,
"last_failure_at": null
},
"livemode": false,
"created_at": "2026-09-30T09:00:00Z",
"updated_at": "2026-09-30T09:00:00Z",
"secret": "whsec_1SUElxxd54C9NVxq8MU3mnVPwYFW3WwLl3l67U9J5pA="
}The response carries Location: /v1/webhook-subscriptions/{id}.
Save the secret now
secret appears in this response and in the response to rotate-secret, and nowhere else. A retry of this request with the same Idempotency-Key within 24 hours returns the same response, secret included. After that, rotate the secret to get a new one.
- You can have at most 16 subscriptions in each mode, disabled ones included and deleted ones not. One more returns
422 WEBHOOK_SUBSCRIPTION_LIMIT_REACHED. - A URL can be subscribed once per mode. A second subscription to it returns
409 WEBHOOK_URL_ALREADY_SUBSCRIBED. - If a create succeeded but you never received its response, and its key has expired, a retry meets that conflict. List your subscriptions to find it, then rotate its secret with
previous_secret_expires_in0. - Superpay cannot check your endpoint when you subscribe, and there is no test event. To try your endpoint, subscribe in test mode and cause an event, or redeliver one.
URL rules#
| Rule | Detail |
|---|---|
| Scheme | https in live mode. https or http in test mode, for example for a tunnel to your machine |
| Host | A public DNS name with at least two labels: letters, digits and hyphens. Not an IP address. The last label must contain a letter. International names are stored in punycode |
| Private names | Refused: localhost, and names under a private or reserved suffix such as .local, .internal, .test or .example. Superpay's own hosts and some third-party hosts are refused too |
| Port | The scheme's default, or one from 1024 to 65535 that Superpay does not reserve. A reserved port is refused with a message saying so. The default port is the safe choice |
| Other parts | No user name or password, and no #fragment |
| Every connection | The host is looked up again, and the attempt is refused if any address it resolves to is private, loopback, link-local or otherwise not public |
A URL that breaks a rule is refused with 400 INVALID_ARGUMENT. The errors[] entry on url names the rule, for example a live URL must use https, and never repeats the URL.
The canonical form lower-cases the scheme and host, drops a default port, turns an empty path into / and drops a bare ?. HTTPS://Hooks.Example.com:443/superpay is stored as https://hooks.example.com/superpay.
Superpay does not publish a list of the addresses deliveries come from. Verify the signature instead.
Receive events#
The request#
Each delivery is an HTTP/1.1 POST to your URL, over TLS 1.2 or later for https. The body is the event: the same bytes that GET /v1/events/{id} returns. It is compact JSON of at most 16 KiB.
| Header | Value |
|---|---|
Webhook-Id | The event's id. The same on every attempt at the event, and on a redelivery. Deduplicate on it |
Webhook-Timestamp | When this attempt was sent, in Unix seconds. New on every attempt |
Webhook-Signature | v1, followed by a base64 signature. Two space-separated entries while a rotation overlaps, newest secret first |
Content-Type | application/json |
User-Agent | SuperPay-Webhooks/1.0 |
Content-Length | The body's length in bytes |
No other header is sent: no cookies, no compression, no trace headers. Header names are case-insensitive; read them that way.
POST /superpay HTTP/1.1
Host: hooks.example.com
Content-Type: application/json
Content-Length: 773
User-Agent: SuperPay-Webhooks/1.0
Webhook-Id: evt_01M2G0A7ZQ3K9V5T1R8N6P4J2H
Webhook-Timestamp: 1790763702
Webhook-Signature: v1,MsBERy96b8WZCIeA73s7A+cMTEtX6B3kdPHiijATowM=Respond quickly#
Answer with any 2xx. Your response's headers must arrive within 10 seconds of the request, and the whole exchange, connecting included, must finish within 15 seconds. Your response body is ignored and is not read past 64 KiB.
Anything else is a failed attempt, and the delivery is retried:
- any other status, including a redirect: redirects are never followed;
- no answer in time;
- a DNS, connection or TLS failure.
Acknowledge first, then process: store the event and answer 200, and do the work afterwards, so that slow processing does not turn into a retry.
Verify the signature#
- Take the raw request body, exactly as received. Verify it before you parse it, and never re-serialise it: the bytes are what is signed.
- Reject the delivery if
Webhook-Id,Webhook-TimestamporWebhook-Signatureis missing, or if the timestamp is more than five minutes from your clock. - Build the signed content:
{Webhook-Id}.{Webhook-Timestamp}.{body}. - Decode your secret: base64-decode the part after
whsec_. The key is the decoded bytes, not the string. - Compute the HMAC-SHA256 of the signed content with that key, and base64-encode it.
- Split
Webhook-Signatureon spaces. Compare your value, in constant time, with eachv1,entry. The delivery is genuine if any entry matches a secret you hold.
import crypto from 'node:crypto';
const TOLERANCE_SECONDS = 5 * 60;
// rawBody is a Buffer of the unparsed request body; headers have lower-case names, as Node gives them.
// secrets are the whsec_… secrets you accept: one, or two while you move to a rotated secret.
export function verifyWebhook(rawBody, headers, secrets) {
const id = headers['webhook-id'];
const timestamp = headers['webhook-timestamp'];
const signatures = headers['webhook-signature'];
if (!id || !timestamp || !signatures || !/^\d+$/.test(timestamp)) return false;
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > TOLERANCE_SECONDS) return false;
const signed = Buffer.concat([Buffer.from(`${id}.${timestamp}.`), rawBody]);
const received = signatures
.split(/\s+/)
.filter(entry => entry.startsWith('v1,'))
.map(entry => Buffer.from(entry.slice(3), 'base64'));
return secrets.some(secret => {
const key = Buffer.from(secret.slice('whsec_'.length), 'base64');
const expected = crypto.createHmac('sha256', key).update(signed).digest();
return received.some(sig => sig.length === expected.length && crypto.timingSafeEqual(sig, expected));
});
}import base64
import hashlib
import hmac
import time
TOLERANCE_SECONDS = 5 * 60
def verify_webhook(raw_body: bytes, headers, secrets) -> bool:
"""raw_body is the unparsed request body; headers is case-insensitive, e.g. Flask's request.headers;
secrets are the whsec_… secrets you accept."""
msg_id = headers.get("webhook-id")
timestamp = headers.get("webhook-timestamp")
signatures = headers.get("webhook-signature")
if not (msg_id and timestamp and signatures) or not timestamp.isdigit():
return False
if abs(time.time() - int(timestamp)) > TOLERANCE_SECONDS:
return False
signed = f"{msg_id}.{timestamp}.".encode() + raw_body
received = [entry[3:] for entry in signatures.split() if entry.startswith("v1,")]
for secret in secrets:
key = base64.b64decode(secret[len("whsec_"):])
expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode()
if any(hmac.compare_digest(expected, sig) for sig in received):
return True
return FalseRead the body as raw bytes. A framework that parses JSON before your handler runs changes the bytes, and the signature no longer matches.
Test your verification#
Check your code against this delivery. Its timestamp is fixed, so skip the five-minute check while you test.
| Secret | whsec_ciyZWGyPhuM71aN58LCa30zdL4xV64U4EMgs1f5Ohn4= |
Webhook-Id | evt_01M2G0A7ZQ3K9V5T1R8N6P4J2H |
Webhook-Timestamp | 1790763702 |
Webhook-Signature | v1,MsBERy96b8WZCIeA73s7A+cMTEtX6B3kdPHiijATowM= |
{"id":"evt_01M2G0A7ZQ3K9V5T1R8N6P4J2H","object":"event","type":"payout.completed","api_version":"v1","created_at":"2026-09-30T10:21:41Z","livemode":false,"resource":{"object":"payout","id":"po_01M2FPYTCG9B1D3F5H7K9M1P3R","version":8},"data":{"object":"payout","id":"po_01M2FPYTCG9B1D3F5H7K9M1P3R","originator_id":"org_01M2FPKH20W4N5X6M3P9R2T1VA","beneficiary_id":"ben_01M2FPNHGG6C8D0F2H4K6M8P0R","corridor":"IN-INR-BANK","amount":{"amount":5000000,"currency":"INR"},"fee":{"amount":12500,"currency":"INR"},"status":"COMPLETED","purpose_code":"P1301","reference":"INV-2026-0042","bank_reference":"425714839201","rail":"IMPS","created_at":"2026-09-30T10:21:14Z","updated_at":"2026-09-30T10:21:41Z","submitted_at":"2026-09-30T10:21:16Z","completed_at":"2026-09-30T10:21:41Z"}}During a rotation overlap with the previous secret whsec_1SUElxxd54C9NVxq8MU3mnVPwYFW3WwLl3l67U9J5pA=, the same delivery carries v1,MsBERy96b8WZCIeA73s7A+cMTEtX6B3kdPHiijATowM= v1,jB4EpM1u5ROc4ZK7ZE57b2lf1XQF0+HSWrn9/nvJMRM=, and either secret verifies it.
Duplicates, order and concurrency#
| Rule | What you do |
|---|---|
| At least once | The same event can arrive more than once: after a late 2xx, after an interrupted attempt, from a redelivery, or once per subscription that matches it. Deduplicate on Webhook-Id |
| No particular order | Events can arrive out of order, even for one object. Order one object's events by resource.version, and ignore one older than the version you hold |
| Concurrent | Several deliveries to one subscription can be in flight at once. Handle them in parallel |
| Not everything | data is a subset of the object. Retrieve the object when you need every field |
| Gaps | An endpoint that was down, or a subscription that was disabled, misses events. Backfill from the event log |
Retries#
A failed delivery is attempted again, at most 10 times in all. Each delay counts from the end of the previous attempt and is spread by up to 10% either way, so that deliveries which failed together do not retry together.
| Before attempt | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|
| Delay after the previous attempt | 5 s | 1 min | 5 min | 30 min | 1 h | 2 h | 4 h | 8 h | 8 h |
- The tenth attempt comes about 23 hours 36 minutes after the first.
- A
429or503withRetry-After, in seconds or as an HTTP date and at most one hour, can put the next attempt later, never earlier. - A delivery that has not succeeded 72 hours after its event was published is abandoned, as
FAILEDwithstatus_reasonEXPIRED. After ten failed attempts it isFAILEDwithATTEMPTS_EXHAUSTED. - An attempt Superpay itself interrupts (
ABORTED,LEASE_EXPIRED,INTERNAL) does not count against your endpoint's health, but it uses one of the ten attempts. It is retried if attempts remain.
An endpoint that keeps failing#
| When | What happens |
|---|---|
| 5 failed attempts in a row | The subscription's circuit opens. Its deliveries are held, not attempted, for 30 seconds, then twice as long after each further failure, up to 30 minutes. While it is failing, it is sent one attempt at a time. health.circuit_open_until says until when |
| A success | Closes the circuit. The held deliveries follow, earliest due first |
| Failing for at least 5 days, with at least 10 failed attempts in a row | The subscription is disabled with disabled_reason FAILING_ENDPOINT, and its waiting deliveries are cancelled. A webhook_subscription.disabled event is sent to your other subscriptions that match it |
The circuit holds a delivery for at most 30 minutes at a time, well within the hours between later retries. So on an endpoint that stays down, a delivery still uses its ten attempts over about a day and then fails as ATTEMPTS_EXHAUSTED. On a busy endpoint, where deliveries queue behind the one attempt at a time, many expire at 72 hours after fewer attempts.
| Your endpoint was down for | What to do |
|---|---|
| A few hours | Nothing. Retries catch up |
| Around a day or more | Deliveries that failed their tenth attempt, about 24 hours after their first, are not tried again, and on a busy endpoint deliveries expire at 72 hours. Backfill from the event log, or redeliver single events |
| 5 days or more | The subscription is disabled. Fix the endpoint, enable it with {"status": "ENABLED"}, then backfill. Nothing is replayed for you |
Watch a subscription's health, and subscribe a second endpoint to webhook_subscription.disabled, or check GET /v1/events?type=webhook_subscription.disabled.
Rotate the secret#
/v1/webhook-subscriptions/{id}/rotate-secretwebhooks:manageCreates a new signing secret and shows it, once, in secret. secret_version goes up by one. Works on a disabled subscription too.
previous_secret_expires_inintegerSeconds the replaced secret keeps signing beside the new one, 0 to 604800. Default 86400, one day. 0 stops it at once: use it when a secret has leaked. The body is optional.
curl -X POST https://api.withsuperpay.com/v1/webhook-subscriptions/whs_01M2FR3E7G9J1K3M5P7R9T1V3X/rotate-secret \
-H "Authorization: Bearer $SUPERPAY_TOKEN" \
-H "Idempotency-Key: 0b9e4d21-7c3a-4f86-9e15-2d8a6f4c1b73" \
-H "Content-Type: application/json" \
-d '{ "previous_secret_expires_in": 3600 }'{
"object": "webhook_subscription",
"id": "whs_01M2FR3E7G9J1K3M5P7R9T1V3X",
"status": "ENABLED",
"secret_version": 2,
"previous_secret_expires_at": "2026-09-30T10:30:00Z",
"updated_at": "2026-09-30T09:30:00Z",
"secret": "whsec_ciyZWGyPhuM71aN58LCa30zdL4xV64U4EMgs1f5Ohn4="
}- While the old secret keeps signing, every delivery carries two signatures, one per secret. Move your receiver to the new secret at any point in that window: either secret verifies.
previous_secret_expires_atsays when the old secret stops. It isnullwhen only one secret signs, including after a rotation with0.- At most two secrets sign at a time. Rotating again during an overlap stops the oldest secret at once.
- A retry with the same
Idempotency-Keywithin 24 hours returns the same new secret. It does not rotate twice.
Update a subscription#
/v1/webhook-subscriptions/{id}webhooks:manageChanges any of url, enabled_events, description and status. A field you leave out, or send as null, stays as it is. A field sent with its current value changes nothing. There is no PATCH: this POST is the update, and it takes an Idempotency-Key.
| Field | Effect |
|---|---|
url | A new endpoint, under the URL rules. Deliveries still waiting go to it. Its failures are forgotten |
enabled_events | Replaces the whole list for events published from now on. Deliveries already waiting are still sent |
description | Replaces the note. "" removes it |
status DISABLED | Stops automatic deliveries. disabled_reason becomes MANUAL, and waiting deliveries are cancelled, a long backlog over the following seconds. An attempt already under way finishes. Redeliveries you asked for still go |
status ENABLED | Resumes deliveries from the next published event, clears disabled_reason and forgets the endpoint's failures. Nothing published while the subscription was disabled is sent |
The signing secret does not change. To change it, rotate it.
curl https://api.withsuperpay.com/v1/webhook-subscriptions/whs_01M2FR3E7G9J1K3M5P7R9T1V3X \
-H "Authorization: Bearer $SUPERPAY_TOKEN" \
-H "Idempotency-Key: 3a7d9c50-18e2-4b6f-a4c9-5e0b2f7d8a16" \
-H "Content-Type: application/json" \
-d '{ "status": "DISABLED" }'{
"object": "webhook_subscription",
"id": "whs_01M2FR3E7G9J1K3M5P7R9T1V3X",
"status": "DISABLED",
"disabled_reason": "MANUAL",
"status_changed_at": "2026-09-30T12:00:00Z",
"updated_at": "2026-09-30T12:00:00Z"
}Delete a subscription#
/v1/webhook-subscriptions/{id}webhooks:managecurl -X DELETE https://api.withsuperpay.com/v1/webhook-subscriptions/whs_01M2FR3E7G9J1K3M5P7R9T1V3X \
-H "Authorization: Bearer $SUPERPAY_TOKEN"Returns 204 No Content. No body and no Idempotency-Key.
- The subscription is sent nothing more. Its secrets are deleted, and its waiting deliveries, redeliveries included, are cancelled. An attempt already under way finishes.
- Deleting it again returns
204and changes nothing. - A deleted subscription is no longer found by
GET, but its deliveries stay listable for as long as their events are kept. - Its URL can be subscribed again. Drop its secret from your receiver.
List subscriptions#
/v1/webhook-subscriptionswebhooks:manageYour subscriptions in the token's mode, newest first. Deleted subscriptions are not listed, and no secret is shown.
statusstringQuery parameter. ENABLED or DISABLED.
limitintegerQuery parameter. 1 to 100. Default 10.
starting_afterstringQuery parameter. A whs_ id. Returns the page of older subscriptions after it.
ending_beforestringQuery parameter. A whs_ id. Returns the page of newer subscriptions before it. Can't be combined with starting_after.
curl -G https://api.withsuperpay.com/v1/webhook-subscriptions \
-H "Authorization: Bearer $SUPERPAY_TOKEN" \
-d status=DISABLEDThe response is a list of subscription objects.
Retrieve a subscription#
/v1/webhook-subscriptions/{id}webhooks:manageReturns the subscription with Superpay's view of its endpoint in health. The secret is never shown. A deleted subscription, or one from the other mode, returns 404 WEBHOOK_SUBSCRIPTION_NOT_FOUND.
curl https://api.withsuperpay.com/v1/webhook-subscriptions/whs_01M2FR3E7G9J1K3M5P7R9T1V3X \
-H "Authorization: Bearer $SUPERPAY_TOKEN"{
"object": "webhook_subscription",
"id": "whs_01M2FR3E7G9J1K3M5P7R9T1V3X",
"url": "https://hooks.example.com/superpay",
"enabled_events": ["*"],
"api_version": "v1",
"status": "ENABLED",
"disabled_reason": null,
"status_changed_at": "2026-09-30T09:00:00Z",
"secret_version": 1,
"previous_secret_expires_at": null,
"health": {
"consecutive_failures": 6,
"failing_since": "2026-09-30T11:02:10Z",
"circuit_open_until": "2026-09-30T11:40:12Z",
"last_success_at": "2026-09-30T10:21:42Z",
"last_failure_at": "2026-09-30T11:39:12Z"
},
"livemode": false,
"created_at": "2026-09-30T09:00:00Z",
"updated_at": "2026-09-30T11:39:12Z"
}The subscription object#
Unlike most objects, a subscription sends null for a field with no value. Only description is left out when there is none.
| Field | Type | Description |
|---|---|---|
object | string | webhook_subscription |
id | string | whs_… |
url | string | The endpoint, in canonical form, including any path and query |
description | string | Your note. Left out when there is none |
enabled_events | array | The event types, families or * you subscribed to, in your order |
api_version | string | The event envelope version deliveries use. Always v1 |
status | string | ENABLED: sent the events it matches. DISABLED: sent nothing automatically |
disabled_reason | string or null | MANUAL (you disabled it), FAILING_ENDPOINT (its endpoint kept failing) or TENANT_OFFBOARDED (your account was closed). null while enabled |
status_changed_at | string | When status last changed |
secret_version | integer | Which secret signs, counting from 1. Each rotation adds one |
previous_secret_expires_at | string or null | When the secret a rotation replaced stops signing. null when only one secret signs |
health.consecutive_failures | integer | Failed automatic attempts in a row, across all its deliveries. From 5, deliveries are held |
health.failing_since | string or null | When the current run of failures began. null after a success |
health.circuit_open_until | string or null | While in the future, deliveries are held. It can stay in the past until the next success |
health.last_success_at | string or null | The last successful automatic attempt |
health.last_failure_at | string or null | The last failed automatic attempt |
livemode | boolean | true for live, false for test |
created_at, updated_at | string | RFC 3339, UTC. updated_at also moves when an attempt changes health |
Only automatic attempts change health: redeliveries never do. Enabling a subscription, or changing its URL, clears its failures.
Delivery log#
Every delivery to a subscription, and every attempt at it with the status your endpoint answered, is recorded. Use it to answer "did my endpoint get this event, and what happened?"
A delivery is created when its event is published, a moment after the change it records, or when you redeliver an event. It is kept, with its attempts, as long as its event: 30 days. Nothing of your endpoint's response is kept except its status, and the URL is never shown.
List deliveries#
/v1/webhook-subscriptions/{id}/deliverieswebhooks:manageNewest first. Also works for a deleted subscription.
event_idstringQuery parameter. Only the deliveries of this event.
event_typestringQuery parameter. Only the deliveries of events of this type (payout.completed) or family (payout.*). * is not accepted.
statusstringQuery parameter. PENDING, IN_FLIGHT, SUCCEEDED, FAILED or CANCELLED.
kindstringQuery parameter. AUTOMATIC for the deliveries publishing created, REDELIVERY for the ones you asked for.
limitintegerQuery parameter. 1 to 100. Default 10.
starting_afterstringQuery parameter. A whd_ id. Returns older deliveries. Can't be combined with ending_before.
ending_beforestringQuery parameter. A whd_ id. Returns newer deliveries.
curl -G https://api.withsuperpay.com/v1/webhook-subscriptions/whs_01M2FR3E7G9J1K3M5P7R9T1V3X/deliveries \
-H "Authorization: Bearer $SUPERPAY_TOKEN" \
-d event_id=evt_01M2G0A7ZQ3K9V5T1R8N6P4J2H{
"object": "list",
"data": [
{
"object": "webhook_delivery",
"id": "whd_01M2FR5B8D0F2H4K6M8P0R2T4V",
"subscription_id": "whs_01M2FR3E7G9J1K3M5P7R9T1V3X",
"event_id": "evt_01M2G0A7ZQ3K9V5T1R8N6P4J2H",
"event_type": "payout.completed",
"kind": "AUTOMATIC",
"status": "SUCCEEDED",
"status_reason": null,
"attempt_count": 2,
"max_attempts": 10,
"next_attempt_at": null,
"expires_at": "2026-10-03T10:21:42Z",
"first_attempt_at": "2026-09-30T10:21:42Z",
"last_attempt_at": "2026-09-30T10:21:47Z",
"last_response_status": 200,
"last_error_code": null,
"last_duration_ms": 184,
"requested_by": null,
"livemode": false,
"created_at": "2026-09-30T10:21:42Z",
"completed_at": "2026-09-30T10:21:47Z"
}
],
"has_next": false
}No delivery of an event means one of these:
- the event is not published yet: an event can be read by id a moment before it is published and delivered;
- it did not match
enabled_eventswhen it was published; - the subscription was created after it, or was disabled when it was published;
- the event is older than 30 days.
Retrieve a delivery#
/v1/webhook-subscriptions/{id}/deliveries/{delivery_id}webhooks:manageReturns the delivery with every attempt at it in attempts, first attempt first. A delivery of another subscription returns 404 WEBHOOK_DELIVERY_NOT_FOUND.
{
"object": "webhook_delivery",
"id": "whd_01M2FR5B8D0F2H4K6M8P0R2T4V",
"status": "SUCCEEDED",
"attempt_count": 2,
"attempts": [
{
"attempt_number": 1,
"started_at": "2026-09-30T10:21:42Z",
"finished_at": "2026-09-30T10:21:42Z",
"duration_ms": 212,
"outcome": "HTTP_ERROR",
"response_status": 503,
"signatures": 1
},
{
"attempt_number": 2,
"started_at": "2026-09-30T10:21:47Z",
"finished_at": "2026-09-30T10:21:47Z",
"duration_ms": 184,
"outcome": "SUCCEEDED",
"response_status": 200,
"signatures": 1
}
]
}The delivery object#
A delivery sends null for a field with no value.
| Field | Type | Description |
|---|---|---|
object | string | webhook_delivery |
id | string | whd_… |
subscription_id | string | The subscription it was sent to |
event_id, event_type | string | The event and its type |
kind | string | AUTOMATIC (created when the event was published) or REDELIVERY (you asked for it) |
status | string | PENDING (waiting for its next attempt), IN_FLIGHT (being attempted), or final: SUCCEEDED, FAILED or CANCELLED |
status_reason | string or null | Why a delivery that did not succeed ended: ATTEMPTS_EXHAUSTED, EXPIRED, SUBSCRIPTION_DISABLED, SUBSCRIPTION_DELETED or TENANT_OFFBOARDED. CANCELLED with null means Superpay refused to send it on a safety check |
attempt_count | integer | Attempts made so far, including one in flight |
max_attempts | integer | 10 for an automatic delivery, 1 for a redelivery |
next_attempt_at | string or null | When a PENDING delivery is next due. While the circuit is open it can be in the past |
expires_at | string | When the delivery is abandoned if it has not succeeded: 72 hours after it was created, or one hour for a redelivery |
first_attempt_at, last_attempt_at | string or null | When attempts were made |
last_response_status | integer or null | The status your endpoint answered the last finished attempt with. null when it did not answer |
last_error_code | string or null | The outcome of the last finished attempt when it failed |
last_duration_ms | integer or null | How long the last finished attempt took. null when no connection was made |
requested_by | string or null | The API client (cli_…) that asked for a redelivery. null for an automatic delivery |
livemode | boolean | true for live, false for test |
created_at | string | When the delivery was created |
completed_at | string or null | When it reached a final status |
attempts | array | Retrieve only. Each attempt: attempt_number, started_at, finished_at, duration_ms, outcome, response_status, and signatures: how many signatures it carried, 2 during a rotation overlap |
Attempt outcomes#
outcome | Meaning |
|---|---|
SUCCEEDED | Your endpoint answered 2xx |
HTTP_ERROR | Any other status, except a redirect |
REDIRECT | A 3xx. Redirects are never followed |
TIMEOUT | Connected, but no answer in time |
CONNECTION_FAILED | The connection was refused, reset or timed out, or the response was malformed or had over 16 KiB of headers |
DNS_ERROR | The host did not resolve |
TLS_CERT_EXPIRED, TLS_HOSTNAME_MISMATCH, TLS_UNKNOWN_AUTHORITY, TLS_HANDSHAKE_FAILED | A TLS failure, as named |
DESTINATION_BLOCKED | The host resolved to an address that is not public. Nothing was sent |
URL_NOT_ALLOWED | The URL no longer passes the URL rules. Nothing was sent |
ABORTED | Superpay interrupted the attempt. It is retried at once, if attempts remain |
LEASE_EXPIRED | Superpay lost track of the attempt. Your endpoint may have received it. It is retried, if attempts remain |
INTERNAL | Superpay could not make the attempt |
Redeliver an event#
/v1/webhook-subscriptions/{id}/deliverieswebhooks:manageSends one event to this subscription again, and returns 202 Accepted with the new delivery, of kind REDELIVERY, and a Location header.
event_idstringRequiredThe evt_ id of the event to send.
curl https://api.withsuperpay.com/v1/webhook-subscriptions/whs_01M2FR3E7G9J1K3M5P7R9T1V3X/deliveries \
-H "Authorization: Bearer $SUPERPAY_TOKEN" \
-H "Idempotency-Key: 9f2c6b18-4e7a-4d03-b5c1-8a3e0d6f2b94" \
-H "Content-Type: application/json" \
-d '{ "event_id": "evt_01M2G0A7ZQ3K9V5T1R8N6P4J2H" }'- The request carries the event's own
Webhook-Idand body, freshly signed. A receiver that deduplicates onWebhook-Idtreats it as the event it already has. - A redelivery is one attempt, made within the hour (
expires_at), usually at once. It is not retried: ask again with a new key if it fails. - It is sent to a
DISABLEDsubscription too, and while the circuit is open. It does not change the subscription or itshealth. - The event must be one of yours in this mode, published, recorded in the last 29 days, and of a type that
enabled_eventsmatches now. It need not have been delivered to this subscription before. - One redelivery of an event to a subscription can be open (
PENDINGorIN_FLIGHT) at a time, and at most 5 redeliveries to a subscription.
A refusal is stored against its Idempotency-Key like any other answer. Once its cause has gone, ask again with a new key.
Errors#
Errors are problem documents. Authentication, scope, idempotency and request-body errors are shared by every endpoint and listed on Errors.
| Code | HTTP | Endpoint | When | What you do |
|---|---|---|---|---|
INVALID_ARGUMENT | 400 | Any | A field or query parameter is invalid. errors[] names it: url (missing, too long, or breaks a URL rule), enabled_events (empty, over 64 entries, a repeat, or an entry that names no event type), description (over 256 characters), status, previous_secret_expires_in (not 0 to 604800), event_id, event_type, kind, limit, or a cursor | Fix it. Send with a new key |
WEBHOOK_SUBSCRIPTION_NOT_FOUND | 404 | Retrieve, update, rotate, list deliveries, redeliver | No such subscription in this mode. Retrieve, update, rotate and redeliver also return it for a deleted subscription, whose deliveries stay listable | Check the id and mode |
WEBHOOK_DELIVERY_NOT_FOUND | 404 | Retrieve a delivery | No such delivery of this subscription | Check both ids |
EVENT_NOT_FOUND | 404 | Redeliver | No such event of yours in this mode, published in the last 30 days | Check the event id. A just-recorded event may not be published yet: try again shortly with a new key |
WEBHOOK_URL_ALREADY_SUBSCRIBED | 409 | Create, update | Another of your subscriptions in this mode has this URL | Use the existing subscription |
REDELIVERY_IN_PROGRESS | 409 | Redeliver | A redelivery of this event to this subscription is still PENDING or IN_FLIGHT | Wait for it to finish, then ask again with a new key |
WEBHOOK_SUBSCRIPTION_LIMIT_REACHED | 422 | Create | You already have 16 subscriptions in this mode | Delete one first |
EVENT_TOO_OLD_TO_REDELIVER | 422 | Redeliver | The event was recorded more than 29 days ago | Reconcile the object with its GET endpoint instead |
EVENT_NOT_SUBSCRIBED | 422 | Redeliver | The subscription's enabled_events do not match the event's type | Update enabled_events first, or redeliver to another subscription |
REDELIVERY_LIMIT_REACHED | 422 | Redeliver | 5 redeliveries to this subscription are already open | Wait for one to finish, then ask again with a new key |