Mercury webhooks
Mercury webhooks are HTTP POST requests that Mercury sends to your endpoint when a transaction or an account balance changes in your Mercury account.
The event names on these pages are what you subscribe to with eventTypes. They aren't in the delivery: its body identifies the change with resourceType and operationType, so route on those.
How Mercury webhooks work
Webhooks push changes to your server as they happen, so you don't have to poll Mercury's Events API. Mercury sends a POST with a JSON body to each endpoint subscribed to the change, and a 2xx within 5 seconds counts as delivered.
The body has the same structure as an Events API event. resourceType names what changed, such as transaction, and operationType is create, update or delete. changedPaths lists the changed fields, mergePatch holds their new values as a JSON Merge Patch, and previousValues holds the old ones. There's no payload version: resourceVersion counts the changes to that one resource.
Key facts
{t}.{raw body} t from the Mercury-Signature header, a literal dot, then the body exactly as received. Re-serialised JSON will not verify.
id, resourceType, resourceId, operationType, resourceVersion, occurredAt, changedPaths, mergePatch, previousValues Setting up Mercury webhooks
- Create an endpoint with
POST https://api.mercury.com/api/v1/webhooks, giving an HTTPSurland optionaleventTypesandfilterPaths. Save thesecretin the response, because Mercury doesn't return it again. - Send a test event with
POST /webhooks/{id}/verify. It sendstransaction.createdunless you pass anothereventType. Webhooks aren't available in Mercury's sandbox. - To test locally, run the Hookdeck CLI:
hookdeck listen 3000 mercury --path /webhooks/mercury, then use its URL as the endpoint'surl. - Mercury documents no resend call. To recover changes you missed, read
GET /events, which keeps events for 90 days.
Delivery behaviour
5 seconds no response in that time counts as a failed delivery Retries up to 10 exponential backoff over about a day; a 4xx other than 429 isn't retried Endpoint disabled after consecutive failures the threshold isn't documented; set status back to active to reactivate Duplicates at least once the same event can arrive more than once, so deduplicate on id Known failure modes
From Hookdeck's Mercury guide →-
Event names aren't in the body
Choose and route events →transaction.createdis a subscription filter and never arrives in a delivery. Route onresourceTypeandoperationTypeinstead, for exampletransactionandcreate. -
Duplicate deliveries
Mercury delivers at least once, so the same event can arrive more than once. Deduplicate on the event's
Handle duplicates →idbefore you process it. -
A 4xx isn't retried
Mercury doesn't retry a
Retries and disabled endpoints →4xxother than429, so a strict validator or a wrong secret loses that delivery. Return a5xxwhen a dependency is down, and read the Events API to recover. -
Endpoint disabled after failures
Mercury sets an endpoint's
Retries and disabled endpoints →statustodisabledafter consecutive delivery failures, and it doesn't publish the threshold. Setstatusback toactive, then reconcile the gap from the Events API.
Mercury webhook best practices
- Verify every signature.
Check
Mercury-Signatureagainst the raw body. Without it, anyone who finds your URL can send a fake transaction. - Return a 2xx within 5 seconds. Store the event and respond before you apply the patch or call the API, so a slow handler doesn't count as a failed delivery.
- Deduplicate on
id. Delivery is at least once, so record each event'sidand skip any you've already processed. - Track
resourceVersion. Keep the last version you applied to each resource and ignore lower ones, since Mercury documents no ordering guarantee. - Subscribe narrowly.
Use
eventTypesandfilterPathsso Mercury sends only the changes you handle. - Reconcile from the Events API.
After an outage, or after a
4xxyou returned by mistake, readGET /eventsto pick up what you missed. Events stay available for 90 days.
Common Mercury webhook events
Transactions
transaction.created | New transaction appears in your Mercury account |
transaction.updated | Existing transaction changes, such as its status or note |
Account balances
checkingAccount.balance.updated | Checking account's available, current or in-flight balance changes |
savingsAccount.balance.updated | Savings account's available, current or in-flight balance changes |
treasuryAccount.balance.updated | Treasury account's available, current or in-flight balance changes |
creditAccount.balance.updated | Credit account's available, current or in-flight balance changes |
investmentAccount.balance.updated | Investment account's available, current or in-flight balance changes |
Events
| Resource | Events | Payloads |
|---|---|---|
Mercury events | 7 | 1 |
In this hub
| Webhook events → | Every covered Mercury event, with payloads where the registry has them. |
| MCP events → | How an agent subscribes to Mercury events as MCP events. |
| Verify signatures → | Signature facts, verification code and common failures. |
| Production guide → | Production problems, such as timeouts and retries, and how to handle them. |
| Agent skill → | Install the webhook skill in your coding agent. npx skills add hookdeck/webhook-skills --skill mercury-webhooks |
Keep an outage from disabling your Mercury endpoint.
Event Gateway verifies the signature and answers Mercury as soon as it accepts each delivery, so downtime on your side doesn't count as failed deliveries, and your events wait in its queue until your service recovers.