Register a URL and RAVN posts to it whenever a swap made with your key settles, gets refunded,
or fails. This is a convenience notification layer on top of /status,
not a replacement for it, see What this isn’t before you build on it.
Register a URL
Set webhookUrl on PATCH /v1/keys. It must be https://.
Save webhookSecret immediately. It’s only ever returned from this exact call, and there’s
no separate endpoint to retrieve it or rotate it later. Re-registering a different webhookUrl
on the same key does not get you a fresh one, see below, so losing it means you can no longer
verify deliveries on this key at all.
Re-registering a different webhookUrl on the same key keeps the same webhookSecret; only the
first-ever registration on a key generates one. This is deliberate: rotating endpoints shouldn’t
also force you to update your signature-verification code. Enterprise keys don’t support
webhooks yet and return 404 NOT_FOUND on this field.
What gets sent
When a swap executed with your x-api-key reaches a terminal state, RAVN POSTs this to your
URL:
event is one of swap.settled, swap.refunded, or swap.failed. ts is the delivery
timestamp, epoch milliseconds. deliveredOut and slippageBps can be null on a venue that
doesn’t report them.
Verify the signature
Every request carries an x-ravn-signature header: sha256=<hex>, an HMAC-SHA256 of the exact
raw JSON body using your webhookSecret. Verify it against the raw bytes, before you parse the
body, not against a re-serialized copy of it.
What this isn’t
This is not a reliable, real-time push system, treat it as a convenience on top of polling.
- Deliveries fire from a background settlement job that runs roughly every 5 minutes, so a
webhook can lag up to that long behind what
/status would already
show you.
- Delivery is best-effort and fired once. If your endpoint is down, times out, or the request
otherwise fails, there is no retry and no way to recover that specific notification, it’s
gone.
/status polling remains the only way to get a guaranteed final
result. Use webhooks to avoid polling every swap constantly, not as your source of truth for
whether one actually completed.