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.

7 events covered

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

Signature header
Mercury-Signature

Format: t=<unix seconds>,v1=<hex>

Scheme
HMAC-SHA256
Signed material
{t}.{raw body}

t from the Mercury-Signature header, a literal dot, then the body exactly as received. Re-serialised JSON will not verify.

How events are identified
resourceType and operationType in the body
Body format
JSON
Send timestamp
Mercury-Signature

Reject deliveries older than 5 minutes.

Envelope
id, resourceType, resourceId, operationType, resourceVersion, occurredAt, changedPaths, mergePatch, previousValues
Agent skill
npx skills add hookdeck/webhook-skills --skill mercury-webhooks

Verify Mercury webhooks →

Setting up Mercury webhooks

  • Create an endpoint with POST https://api.mercury.com/api/v1/webhooks, giving an HTTPS url and optional eventTypes and filterPaths. Save the secret in the response, because Mercury doesn't return it again.
  • Send a test event with POST /webhooks/{id}/verify. It sends transaction.created unless you pass another eventType. 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's url.
  • Mercury documents no resend call. To recover changes you missed, read GET /events, which keeps events for 90 days.

Delivery behaviour

  1. Event names aren't in the body

    transaction.created is a subscription filter and never arrives in a delivery. Route on resourceType and operationType instead, for example transaction and create.

    Choose and route events →
  2. Duplicate deliveries

    Mercury delivers at least once, so the same event can arrive more than once. Deduplicate on the event's id before you process it.

    Handle duplicates →
  3. A 4xx isn't retried

    Mercury doesn't retry a 4xx other than 429, so a strict validator or a wrong secret loses that delivery. Return a 5xx when a dependency is down, and read the Events API to recover.

    Retries and disabled endpoints →
  4. Endpoint disabled after failures

    Mercury sets an endpoint's status to disabled after consecutive delivery failures, and it doesn't publish the threshold. Set status back to active, then reconcile the gap from the Events API.

    Retries and disabled endpoints →

Mercury webhook best practices

  • Verify every signature. Check Mercury-Signature against 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's id and 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 eventTypes and filterPaths so Mercury sends only the changes you handle.
  • Reconcile from the Events API. After an outage, or after a 4xx you returned by mistake, read GET /events to 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

checkingAccount.balance.updated · creditAccount.balance.updated · investmentAccount.balance.updated · savingsAccount.balance.updated +3

7 1

All 7 events →

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.

Not affiliated with Mercury. Facts are compiled from public sources and linked inline.