REST API
Webhooks
Whire calls a URL you choose whenever a payment changes status, so you do not have to poll. Each call is a signed JSON POST. A call that fails is retried for about eighteen hours, and every call carries an id you can use to ignore duplicates.
You register an endpoint with your API key, receive a secret once, and verify the signature on every delivery. The requests and events on this page were produced against a running deployment with the simulated rail on; the URL is replaced where you would put your own.
Webhooks need API keys. A deployment that runs with authentication switched off refuses to register endpoints, because without a key nobody can own one.
Quickstart#
curl -s -X POST https://sandbox.whire.ai/api/webhooks \
-H "X-API-Key: $KEY" -H "Content-Type: application/json" \
-d '{ "url": "https://hooks.example.com/whire", "description": "Order updates" }'The response carries the endpoint and its secret. The secret is shown once, here, and in no later response. The one exception is retrying the same request with the same Idempotency-Key within 24 hours, which returns the same answer again so that a lost response can be recovered. Store it where your receiver can read it.
{
"ok": true,
"data": {
"id": "we_2ea144543b08901fa2b1740f",
"url": "https://hooks.example.com/whire",
"description": "Order updates",
"events": ["*"],
"ibans": [],
"status": "enabled",
"disabledReason": null,
"consecutiveFailures": 0,
"createdAt": "2026-10-21T12:53:41.028Z",
"updatedAt": "2026-10-21T12:53:41.028Z",
"secret": "whsec_BcInnGNeGqkgm+3zfM++HfhC8unFei9rWRgZJO47dz4="
}
}curl -s -X POST https://sandbox.whire.ai/api/webhooks/we_2ea144543b08901fa2b1740f/test \
-H "X-API-Key: $KEY"One webhook.test delivery, sent now. The response is the delivery record: what your server answered, and how long it took.
Check the signature (Verify the signature), do your work, and answer with any 2xx status within 15 seconds. The body of your answer is ignored.
Events#
A payment is a payout in the API. Each status it moves into is announced once, and the event is named after it, with one exception: payout.submitted carries the status pending_kyc.
| Event | Sent when | Operator | Seller |
|---|---|---|---|
payout.submitted |
the payout is sent for review of the payee | yes | no |
payout.approved |
the review passed | yes | no |
payout.kyc_rejected |
the review refused the payee; nothing will be sent | yes | no |
payout.processing |
the payment has been handed to the payment step and the outcome is not yet known; a rejection can follow at once | yes | yes |
payout.paid |
the payment settled | yes | yes |
payout.failed |
the payment was rejected or could not be sent | yes | yes |
payout.returned |
the payment settled and the counterparty bank sent it back | yes | yes |
payout.reconciliation_required |
the rail reported something that contradicts a status already recorded, for example a settlement for a payout recorded as failed | yes | no |
mandate.revoked |
a mandate was revoked | yes | no |
mandate.expired |
a mandate was found to be past its end date | yes | no |
webhook.test |
you asked for a test | the test call only | the test call only |
Operator is an endpoint registered with an ordinary API key. Seller is an endpoint registered with a seller key; see For sellers. Choose what an endpoint receives with events, a list of event types, or ["*"] for every type it may hear.
A mandate is marked expired the first time it is looked at after its end date, which happens at least once a minute, so mandate.expired arrives within about a minute of the date.
A webhook.test delivery has the same envelope as every other event. Its data is { "object": "webhook_test", "endpointId": "we_...", "message": "..." }.
The event#
Every delivery has the same envelope. The body is exactly what was signed, so read it raw before you parse it.
{
"id": "evt_185e413fb8b0194f3758e912",
"type": "payout.paid",
"timestamp": "2026-10-21T12:53:41.131Z",
"environment": "SANDBOX",
"simulated": true,
"data": {
"object": "payout",
"payoutId": "31603588-5305-4258-a480-6372911866cc",
"status": "paid",
"previousStatus": "processing",
"sequence": 4,
"amount": "12.50",
"currency": "EUR",
"payee": { "name": "Report Vendor BV", "iban": "DE89370400440532013000" },
"payer": { "iban": "NL91ABNA0417164300" },
"mandateReference": "ORDERS-2026",
"transaction": "SIM-C357DD0B",
"failureCode": null,
"reference": "Invoice 2026-091",
"beneficiaryId": "1890338e-7c01-4ec5-a583-ad06813cb3dc",
"mandateId": "41bbed7d-5b8d-470d-8dd7-8153bf9d01fa"
}
}| Field | Meaning |
|---|---|
id |
the event's id. It is the same on every retry, and on every endpoint that receives the event |
type |
the event type |
timestamp |
when it happened, ISO 8601. Not the time of the delivery attempt |
environment |
SANDBOX or PRODUCTION |
simulated |
true when the settlement behind the event is the simulation and no real money moved |
data.object, data.payoutId |
"payout", and the payout's id |
data.status, data.previousStatus |
the status the payout moved into and out of. payout.paid has status: "paid", payout.submitted has "pending_kyc", and a reconciliation carries the status the payout already had. previousStatus is null on a reconciliation, which is not a transition. A first event has previousStatus: "draft" |
data.sequence |
counts a payout's transitions from 1 for its first, so a seller, who hears from processing on, first sees 3. Use it to ignore an event older than one you have already handled. A payout.reconciliation_required event repeats the payout's latest sequence number instead of adding one, so handle it by its type and do not drop it for repeating a number |
data.amount, data.currency |
a decimal string with two places, so "12.50". In an x402 message the same amount is "1250", in cents |
data.payee, data.payer |
the account that is paid and the account that is debited. payer is null when the payout had no mandate |
data.mandateReference |
the reference of the mandate the payout ran under, or null |
data.mandateId |
on operator endpoints, the mandate's id, or null when the payout had no mandate |
data.transaction |
the rail's reference for the payment, once there is one, otherwise null. It is the transaction that settle returns on x402. On a real rail it is what you look for on your bank statement; the simulation has no statement |
data.failureCode |
on failed and returned, the bank's reason code when the rail gave one, for example AM04 (insufficient funds), AC04 (account closed), AC01 (incorrect account number). Otherwise null, and always null on a reconciliation |
data.reference |
the reference the payer put on the payout. Operator endpoints only |
data.beneficiaryId |
Whire's id for the payee. Operator endpoints only |
data.railReport |
on a reconciliation only: what the rail reported, settled, failed or returned |
A mandate event carries a different data, with these fields: object ("mandate"), mandateId, mandateReference, status (revoked or expired), previousStatus (active, or expired when a lapsed mandate is then revoked), currency and validUntil.
{
"id": "evt_f745d747af3d58fbf7e6f285",
"type": "mandate.revoked",
"timestamp": "2026-10-21T12:53:42.610Z",
"environment": "SANDBOX",
"simulated": true,
"data": {
"object": "mandate",
"mandateId": "41bbed7d-5b8d-470d-8dd7-8153bf9d01fa",
"mandateReference": "ORDERS-2026",
"status": "revoked",
"previousStatus": "active",
"currency": "EUR",
"validUntil": "2027-10-21T12:53:41.044Z"
}
}Verify the signature#
Anyone who learns your URL can send it a request. The signature is how you know a delivery came from Whire and was not changed on the way. Whire follows the Standard Webhooks specification, so libraries for most languages already verify it.
Every delivery has three headers:
webhook-id: evt_185e413fb8b0194f3758e912
webhook-timestamp: 1792587221
webhook-signature: v1,<base64 of the HMAC>webhook-idis the event id. Keep the ones you have handled and ignore a repeat.webhook-timestampis the time of this attempt, in whole seconds. It changes on every retry. Reject a delivery more than five minutes from your clock, in either direction.webhook-signatureis one or more space-separatedv1,<base64>entries. Accept the delivery if any entry verifies. There is usually one. While you rotate a secret there is one for each secret still valid, up to five.
The signature is an HMAC-SHA256, in standard base64, of webhook-id, webhook-timestamp and the raw body joined with dots: {id}.{timestamp}.{body}. The key is the secret after its whsec_ prefix, base64-decoded.
To check your verifier before you rely on it, use this vector from the Standard Webhooks reference library. Compute the signature your code would produce for it and compare. Do not run the vector through a full verify call: its timestamp is old, so a verifier that checks the five-minute window, correctly, rejects it unless you pass a very large tolerance for this one test:
import { createHmac, timingSafeEqual } from 'node:crypto';
// `rawBody` must be the request body exactly as received, before any JSON parsing.
export function verifyWhireWebhook(secret, headers, rawBody, toleranceSeconds = 300) {
// Node's http gives a plain object with lowercase names; fetch-based runtimes give a Headers object.
const header = (name) => (typeof headers.get === 'function' ? headers.get(name) : headers[name]);
const id = header('webhook-id');
const timestamp = header('webhook-timestamp');
const signatures = header('webhook-signature');
if (!id || !timestamp || !signatures) throw new Error('missing webhook headers');
if (!/^\d+$/.test(timestamp) || Math.abs(Date.now() / 1000 - Number(timestamp)) > toleranceSeconds) {
throw new Error('timestamp outside the tolerance');
}
const key = Buffer.from(secret.replace(/^whsec_/, ''), 'base64');
const expected = createHmac('sha256', key).update(`${id}.${timestamp}.${rawBody}`).digest();
for (const entry of signatures.split(' ')) {
const [version, value] = entry.split(',');
if (version !== 'v1' || !value) continue;
const given = Buffer.from(value, 'base64');
if (given.length === expected.length && timingSafeEqual(given, expected)) {
return JSON.parse(rawBody);
}
}
throw new Error('no valid signature');
}// npm install standardwebhooks
import { Webhook } from 'standardwebhooks';
const webhook = new Webhook(process.env.WHIRE_SIGNING_SECRET); // the whsec_ value
// Throws if the signature or the timestamp is wrong. Returns the parsed event otherwise.
const event = webhook.verify(rawBody, {
// Node's http lowercases header names. With a fetch Request, use request.headers.get('webhook-id') and so on.
'webhook-id': request.headers['webhook-id'],
'webhook-timestamp': request.headers['webhook-timestamp'],
'webhook-signature': request.headers['webhook-signature'],
});# pip install standardwebhooks
import os
from standardwebhooks import Webhook
webhook = Webhook(os.environ["WHIRE_SIGNING_SECRET"]) # the whsec_ value
def handle(raw_body: bytes, headers):
# Header names are case-insensitive and frameworks differ in how they spell them, so lowercase them.
lowered = {name.lower(): value for name, value in headers.items()}
# Raises WebhookVerificationError if the signature or the timestamp is wrong.
event = webhook.verify(raw_body, {
"webhook-id": lowered["webhook-id"],
"webhook-timestamp": lowered["webhook-timestamp"],
"webhook-signature": lowered["webhook-signature"],
})
return eventVerify against the raw bytes of the body. If your framework parses the JSON first and you serialize it again, the bytes can differ and every signature will fail.
Retries and failures#
Answer 2xx within 15 seconds. Anything else counts as a failed attempt: a 4xx or 5xx status, a timeout, a connection error. A 3xx is a failure too, and the redirect is not followed. Register the final URL.
Whire tries again with the same webhook-id, a fresh webhook-timestamp and a new signature:
| Attempt | Waits before it |
|---|---|
| 1 | nothing |
| 2 | 5 seconds |
| 3 | 5 minutes |
| 4 | 30 minutes |
| 5 | 2 hours |
| 6 | 5 hours |
| 7 | 10 hours |
That is seven attempts over about eighteen hours, with a little random spread on each wait. If your server answers with a Retry-After header, the next attempt waits at least that long, up to one hour.
After the last attempt the delivery is failed and stays on the endpoint's list, where you can send it again. Two things switch an endpoint off:
410 Gone. It tells Whire you no longer want these. The endpoint is disabled at once, withdisabledReason: "gone", and nothing more is sent. That includes a410answer to a test event.- Ten deliveries in a row that fail every attempt. The endpoint is disabled with
disabledReason: "too_many_failures". Fix your receiver, then enable it.
A disabled endpoint receives nothing, and events that happen meanwhile are not queued for it. Use the event list to catch up.
Whire keeps the 200 most recent finished deliveries of each endpoint, tests included, so a run of tests can push older failed deliveries out of the list. It holds at most 1,000 waiting deliveries for one endpoint and 2,000 for one account. Past either, new deliveries are recorded as failed with queue_full and are not sent; one account's failing receivers cannot use up the queue other accounts share. Delivery slots are shared out the same way.
Duplicates and order#
Delivery is at least once, so you can receive the same event twice. Keep the ids you have handled and ignore a repeat. Retries can also arrive after a later event. Use data.sequence to see which event of a payout is newer.
Which URLs are accepted#
httpsonly, on the default port.- A public DNS name. An IP address,
localhostand names under internal suffixes such as.localor.internalare refused. - No username or password in the URL, and at most 2048 characters.
- A name that resolves to a private or internal address is refused when Whire connects, whatever it resolved to when you registered it.
To develop against your own machine, open a tunnel that gives you a public https URL and register that.
Manage endpoints#
All endpoints answer with the usual envelope, { "ok": true, "data": ... } or { "ok": false, "error": "..." }.
| Status | Meaning |
|---|---|
400 |
a mistake in the request: a bad URL, an unknown event type, an invalid IBAN, a body that is not a JSON object |
401 |
no key, or a key Whire does not know |
403 |
a key that may not do this, for example a seller key on /api/webhooks, or a deployment with authentication switched off |
404 |
an unknown id, or one that belongs to another key |
405 |
a method that path does not accept |
409 |
a URL already registered, the endpoint limit reached, a test already running for the endpoint, or an endpoint that is disabled |
429 |
too many tests running at once |
An endpoint belongs to the account whose key registered it. Another account's key cannot see, change or delete it, and may register the same URL.
POST/api/webhooks
Registers an endpoint and returns its secret.
Request
{
"url": "https://hooks.example.com/whire",
"description": "Order updates",
"events": ["payout.paid", "payout.failed", "payout.returned"],
"ibans": ["DE89370400440532013000"]
}Only url is required. events defaults to ["*"]. description is at most 200 characters. ibans limits the endpoint to payouts to those payee accounts, up to 50 valid IBANs; leave it out to hear about every payee. An endpoint limited by ibans receives payout events only.
Response 200: the endpoint, and secret.
GET/api/webhooks
Lists your endpoints. No response includes a secret.
{
"ok": true,
"data": {
"endpoints": [
{
"id": "we_2ea144543b08901fa2b1740f",
"url": "https://hooks.example.com/whire",
"status": "enabled",
"...": "as in the next response"
}
]
}
}GET/api/webhooks/{id}
One endpoint.
{
"ok": true,
"data": {
"id": "we_2ea144543b08901fa2b1740f",
"url": "https://hooks.example.com/whire",
"description": "Order updates",
"events": ["*"],
"ibans": [],
"status": "enabled",
"disabledReason": null,
"consecutiveFailures": 0,
"createdAt": "2026-10-21T12:53:41.028Z",
"updatedAt": "2026-10-21T12:53:41.028Z"
}
}status is enabled or disabled. disabledReason is manual, gone or too_many_failures. consecutiveFailures counts real deliveries in a row that failed every attempt. A delivery that succeeds resets it; a test, passing or failing, does not touch it.
POST/api/webhooks/{id}
Changes url, events, description or ibans. Send only what changes. The secret stays the same. If any field is refused, nothing changes. Answers with the endpoint, as do enable and disable.
DELETE/api/webhooks/{id}
Removes the endpoint and its delivery list.
{ "ok": true, "data": { "id": "we_2ea144543b08901fa2b1740f", "deleted": true } }POST/api/webhooks/{id}/disable
Stops deliveries. What was waiting for a retry is marked failed and can be sent again once you enable the endpoint.
POST/api/webhooks/{id}/enable
Resumes deliveries and resets consecutiveFailures.
POST/api/webhooks/{id}/rotate-secret
Issues a new secret, shown once. The old one keeps working for overlapSeconds (default 86400, so a day; a larger number is treated as 604800, a week; 0 ends it at once). While both are valid every delivery carries a signature for each, so you can switch your receiver with no gap. If you rotate again before the overlap ends, the overlapSeconds you give now applies to every earlier secret still valid, so a later rotation can shorten their time but never extend it, and 0 ends them all at once. Up to five secrets are valid at the same time.
Request
{ "overlapSeconds": 3600 }Response 200: the endpoint, the new secret, and previousSecretExpiresAt.
POST/api/webhooks/{id}/test
Sends one webhook.test event to this endpoint now, with a single attempt and no retries, and returns the delivery. It works on a disabled endpoint, and a failed test does not count toward the ten-failure limit, though a 410 answer still disables the endpoint. One test can run at a time for an endpoint, and a few overall; otherwise you get 409 or 429.
{
"ok": true,
"data": {
"id": "dlv_d2af45c224fdc8369ebe8e13",
"endpointId": "we_2ea144543b08901fa2b1740f",
"eventId": "evt_9723f51de2d71712a70d98c8",
"eventType": "webhook.test",
"status": "succeeded",
"attemptCount": 1,
"lastStatus": 200,
"lastError": null,
"nextAttemptAt": null,
"createdAt": "2026-10-21T12:53:42.310Z",
"attempts": [{ "at": "2026-10-21T12:53:42.311Z", "status": 200, "error": null, "durationMs": 5 }]
}
}GET/api/webhooks/{id}/deliveries
The most recent deliveries to this endpoint, newest first (limit, up to 200), as { "ok": true, "data": { "deliveries": [ ... ] } }. status is pending, succeeded or failed. lastStatus is the HTTP status your server answered, or 0 when there was none, and lastError says why. Both are null until the first attempt has finished:
lastError |
Meaning |
|---|---|
http_error |
your server answered with a status outside 2xx |
redirect_not_followed |
your server answered 3xx |
timeout |
your server sent no response status within 15 seconds |
connect_failed |
the connection could not be made, or was closed before a response |
dns_failure |
the name did not resolve |
tls_failed |
the TLS handshake failed, for example an untrusted or expired certificate, or a URL that is https for a server that does not speak it |
blocked_address |
the name resolved to an address Whire does not connect to |
response_error |
your server's response could not be read, for example headers that are malformed or too large |
invalid_url |
the stored URL no longer passes the rules above |
queue_full |
too many deliveries were already waiting, for this endpoint or for your account, so this one was not sent. The event is still in the event list |
endpoint_disabled |
the endpoint was switched off while the delivery was waiting |
delivery_error |
an internal error on Whire's side; it is retried like any failure |
POST/api/webhooks/{id}/deliveries/{deliveryId}/retry
Sends a delivery again, whatever happened to it, as a fresh run of attempts starting now. The endpoint must be enabled. The event keeps its id, so a receiver that already handled it will recognise it. A webhook.test delivery is sent once, not retried.
GET/api/webhook-events
The recent events themselves, oldest first, for catching up after your receiver was down or an endpoint was disabled. Use type to filter, limit for the page size (up to 200), and after to continue from a cursor.
{
"ok": true,
"data": {
"events": [
{
"id": "evt_185e413fb8b0194f3758e912",
"seq": 4,
"type": "payout.paid",
"timestamp": "2026-10-21T12:53:41.131Z",
"environment": "SANDBOX",
"data": { "...": "as delivered" }
}
],
"nextAfter": 4
}
}nextAfter is the cursor for the next page and is null when there are no more. The most recent 2,000 events are kept.
For sellers#
An ordinary key can use /x402/webhooks and /x402/webhook-events as well; it sees the same endpoints and events as under /api. A seller key is an optional, restricted key for a party that only receives payments under x402 over SEPA. It reaches only these two paths, and has these differences:
- An endpoint is limited to the IBANs registered for your key. Asking for another IBAN is a
403that names the IBANs you may use. Leaveibansout to cover all of yours. - You hear only
payout.processing,payout.paid,payout.failedandpayout.returned, for payments addressed to your IBANs. Earlier statuses belong to the payer and are not sent to you. - The payload has no
reference,beneficiaryIdormandateId. You get the amount, the payer's IBAN, the mandate reference and thetransaction. - You manage only your own endpoints. Another key's endpoint answers
404as if it did not exist, even a key registered for the same IBAN. - At most five endpoints per key.
- The event list shows only events that match your IBANs, with the same payload as the deliveries.
curl -s -X POST https://sandbox.whire.ai/x402/webhooks \
-H "X-API-Key: $SELLER_KEY" -H "Content-Type: application/json" \
-d '{ "url": "https://hooks.example.com/whire" }'For an x402 seller two events matter most. payout.paid tells you a payment you are waiting on, one where settle answered settlement_pending, has settled. Its transaction is the rail's reference; settle returns the same reference when it has one, and an empty string while the outcome is unconfirmed, so match on the payout id or on the eventual success. payout.returned tells you the bank sent a payment back after it settled, which settle cannot tell you because it has already answered.
Limits and good to know#
- Up to 20 endpoints per ordinary key holder, and 5 per seller key.
- In the sandbox, endpoints and any retry still waiting are held in memory. A restart or a redeploy clears them, so register again afterwards and use the event list to catch up on what you missed. A reset of the sandbox keeps your endpoints and clears the event list, the delivery lists and anything waiting to be retried.
- An ordinary key hears every event on its deployment, the same records its key can already read through the API. Two ordinary keys on one deployment therefore hear each other's payments, though never each other's endpoints.
- Requests to your URL come from Whire's addresses, which are not fixed. Do not allowlist by IP; verify the signature.
- Each request has
Content-Type: application/jsonand aUser-AgentstartingWhire-Webhooks/. - Events never carry the service's internal notes or any account balance. What an event holds is what this page lists.