API
Event Webhooks
Receive signed outbound webhooks when trades open or close, rooms change, or automations fire.
Subscribe an HTTPS endpoint and Trade Wzrd POSTs a signed event when something happens in your account. Creating subscriptions is session-only (dashboard or session JWT); receiving is your code.
Events
trade.opened, trade.closed, room.paused, room.resumed, room.updated, automation.fired
Subscribing
POST /api/v1/events/subscriptions{ "url": "https://example.com/tradewzrd", "events": ["trade.closed"] }The response includes secret (whsec_...) once - store it; it is never returned again.
Delivery
POST https://example.com/tradewzrdContent-Type: application/jsonX-TradeWzrd-Event: trade.closedX-TradeWzrd-Event-Id: 029436f843b844c8a6ffff0ef4f11a56X-TradeWzrd-Attempt: 1tw-signature: t=1764500000,v1=5f2c...e91 {"id":"029436f843b844c8a6ffff0ef4f11a56","event":"trade.closed", "attempt":1,"createdAt":1764500000123,"data":{ }}id is stable across retries of the same event and unique per event - use it as your dedupe key. attempt tells you which delivery you are looking at.
Verifying the signature
HMAC-SHA256 over the string "{t}.{raw_body}" using your whsec_ secret (Svix-compatible). Verify the raw bytes, not a re-serialized body. Always reject on timestamp skew - that is what makes a replay worthless.
Node
import crypto from "node:crypto"; export function verify(rawBody, header, secret, toleranceSec = 300) { const parts = Object.fromEntries(header.split(",").map((p) => p.split("="))); const t = Number(parts.t); if (!t || Math.abs(Date.now() / 1000 - t) > toleranceSec) return false; const expected = crypto .createHmac("sha256", secret) .update(`${t}.${rawBody}`) .digest("hex"); return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));}Python
import hashlib, hmac, time def verify(raw_body: bytes, header: str, secret: str, tolerance: int = 300) -> bool: parts = dict(p.split("=", 1) for p in header.split(",")) ts = int(parts["t"]) if abs(time.time() - ts) > tolerance: return False expected = hmac.new(secret.encode(), f"{ts}.".encode() + raw_body, hashlib.sha256).hexdigest() return hmac.compare_digest(expected, parts["v1"])Retries - and why you must dedupe
Delivery attempts: 3, with delays of 0s / 2s / 8s. A 2xx stops retries; a 4xx stops immediately; a 5xx or timeout retries. After the last attempt the subscription is marked failing and retried on the next event.
> A receiver that times out after processing will get the event again. Dedupe on id - the same value on every attempt of one event - so an upsert makes delivery effectively exactly-once.
Respond within the delivery timeout (8 seconds) and do work asynchronously.







