Docs · updated 21 Nov 2026
Webhooks
Register an https endpoint and choose events; Nevarn posts each one as it happens, signed with the endpoint's secret. An event is written in the same transaction as what it announces, so a fill that was recorded is a fill you will hear about, and one that rolled back is not.
Endpoints are registered by an account's owner or an admin in the console's Commerce panel, which shows the secret once. Verify every delivery's signature before acting on it.
Events for your bot
| Event | When | Data |
|---|---|---|
| intent.ruled | A shadow intent, or a Sandbox execution, has its ruling | intent_id, intent_key, strategy, verdict, would_execute, reasons, decision_id |
| execution.filled | A Sandbox execution filled on paper, or a Production order confirmed | execution_id or intent_id, strategy, environment, state, amounts |
| execution.blocked | A Production order was stopped before the venue: a ruling withheld it, or its terms changed | execution_id, strategy, state, reason |
| execution.rejected | The venue rejected the order, or it expired | execution_id, strategy, state, reason |
| tenant.halted | Signing was turned off for the account | tenant_id, signing_enabled |
| tenant.resumed | The owner turned signing back on | tenant_id, signing_enabled |
| exchange.fill_unruled | A fill on your exchange account that no execute ruling covered: placed without asking, against a ruling, or for more than it allowed (needs a read-only key on the console) | exchange, symbol, side, order_id, amount, finding, intent_id, filled_at |
| receipt.published | A trade joined your public receipt feed, the moment its fill is booked (only while the feed is published) | the signed public receipt, exactly as GET /public/receipts serves it; verify it with /docs/receipts |
| drift.detected | A line of your book started to disagree with an outside ledger (a chain, a venue or a fiat provider). Checked hourly; sent once when the line enters drift, not again while it stays there | tenant_id, kind, ledger, ledger_name, account, label, asset, decimals, book, observed, difference, difference_display, cause, fix, detected_at |
| drift.cleared | That line was read again and agrees with the book. A line that cannot be read is not cleared | the same line fields, detected_at, cleared_at |
Every delivery is JSON: {"id", "type", "created_at", "data"}. The id is the event's, the same for every endpoint and every retry, so keep it to ignore a repeat.
Verify the signature
Each delivery carries X-Nevarn-Signature: t=<unix seconds>,v1=<hex>, an HMAC-SHA256 with your endpoint's secret over the timestamp, a dot and the raw body. Recompute it over the exact bytes you received and refuse anything older than five minutes.
import hashlib, hmac, time
def verified(secret: str, body: bytes, header: str) -> bool:
parts = dict(p.split("=", 1) for p in header.split(",") if "=" in p)
timestamp = int(parts.get("t", "0"))
if abs(time.time() - timestamp) > 300:
return False
expected = hmac.new(secret.encode(), f"{timestamp}.".encode() + body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts.get("v1", ""))Retries and replays
- Answer with a 2xx within 10 seconds. Anything else is retried after 1 minute, 5 minutes, 30 minutes, 2 hours and 12 hours; after that the delivery is marked dead and kept, so you can see what you missed.
- The console lists every delivery with its status, attempts and last error.
- An owner or admin can send a delivered or dead delivery again, with the same event id: POST /tenants/{tenant}/commerce/webhooks/deliveries/{delivery}/redeliver.
- Endpoints must be https on a public host; private and loopback addresses are refused.