Webhooks

A webhook POSTs spread events to your URL. Nothing has to stay connected on your side: you get a signed HTTPS request when a spread that matches your filters opens, changes or closes. Webhooks are available when your plan includes them.

Create one

curl -X POST https://b2b.api.arbitragescanner.io/api/screener-v3/v1/webhooks \
  -H "X-API-KEY: $ARB_API_KEY" -H "Content-Type: application/json" \
  -d '{
        "url": "https://example.com/arb-hook",
        "events": ["spread.opened", "spread.closed"],
        "filters": {"strategies": ["perp-perp"], "minNetSpreadPct": 0.5, "minEntryUsd": 500},
        "batch": true
      }'

The answer holds the webhook and its signing secret (whsec_…). The secret is shown only once: store it.

  • Filters: the same as for the stream and REST (WebhookFilters in the API reference).
  • Manage: list webhooks, change them (PATCH), delete them, re-enable a disabled one, send a test ping and read the delivery log, with the endpoints under /v1/webhooks.
  • Limit: up to 10 webhooks per account.

Events

EventWhen
spread.openedA spread starts matching the filters.
spread.updatedIt still matches, at most every 30 s per spread. Only if you list it in events.
spread.closedIt stops matching or closes. data.open is false when the spread itself closed.
pingPOST /v1/webhooks/{id}/test. data is empty.

By default a webhook gets spread.opened and spread.closed.

One event is one POST:

{ "id": "6f1c…", "event": "spread.opened", "createdAt": "2026-11-24T10:00:00.123Z", "data": { "key": "ARIA/USDT|bitget:perpetual:ARIAUSDT>mexc:perpetual:ARIA_USDT", "netSpreadPct": 0.305 } }

data is the full spread (StreamSpread in the API reference), the same object as the stream's spread event. The example above is shortened.

With batch: true you get one POST per second with that second's events, up to 500:

{ "id": "a93e…", "event": "spread.batch", "createdAt": "2026-11-24T10:00:01Z",
  "events": [ { "id": "…", "event": "spread.opened", "createdAt": "…", "data": { } }, { "id": "…", "event": "spread.closed", "createdAt": "…", "data": { } } ] }

Each request carries the headers:

  • X-Arb-Event: the event name (spread.batch for a batch);
  • X-Arb-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256>.

Verify the signature

The signature is HMAC-SHA256 with your webhook secret over <t>.<raw request body>. Verify it on the raw bytes before parsing the JSON. Reject requests whose t is more than a few minutes old.

Node.js:

import crypto from "node:crypto";

export function verify(rawBody, header, secret, toleranceSec = 300) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=", 2)));
  const t = Number(parts.t);
  if (!t || Math.abs(Date.now() / 1000 - t) > toleranceSec) return false;
  const expected = crypto.createHmac("sha256", secret).update(`${t}.`).update(rawBody).digest("hex");
  const got = Buffer.from(parts.v1 ?? "", "hex");
  return got.length === 32 && crypto.timingSafeEqual(got, Buffer.from(expected, "hex"));
}

// Express: keep the raw body
// app.post("/arb-hook", express.raw({ type: "application/json" }), (req, res) => {
//   if (!verify(req.body, req.get("X-Arb-Signature"), process.env.WEBHOOK_SECRET)) return res.sendStatus(401);
//   const delivery = JSON.parse(req.body);
//   res.sendStatus(200); // answer fast, process afterwards
// });

Python:

import hashlib, hmac, time

def verify(raw_body: bytes, header: str, secret: str, tolerance_sec: int = 300) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(",") if "=" in p)
    try:
        t = int(parts["t"])
    except (KeyError, ValueError):
        return False
    if abs(time.time() - t) > tolerance_sec:
        return False
    expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, parts.get("v1", ""))

Delivery

  • Success: any 2xx within 5 s. Answer first, process after.
  • Retries: a failed delivery is retried after 1, 5 and 25 s.
  • Auto-disable: after 20 failed deliveries in a row the webhook is disabled. Fix the endpoint, then POST /v1/webhooks/{id}/enable.
  • Delivery log: GET /v1/webhooks/{id}/deliveries shows the last 7 days (status, attempts, error, duration).
  • Order: with batch: true deliveries arrive one at a time, in order. Without it, several may be in flight at once, so order by createdAt.
  • Duplicates: a delivery may repeat when your answer was lost; deduplicate by id.
  • URL: public http(s) on port 80 or 443.

Credits

  • Charge: 1 credit per event, charged when it is first sent; in a batch, each event in it counts.
  • Not charged: retries and the test ping.