Skip to main content

Documentation Index

Fetch the complete documentation index at: https://developer.alterscope.org/llms.txt

Use this file to discover all available pages before exploring further.

Your webhook endpoint was down for an hour. Your kill-switch missed two depeg starts. You need to backfill those events and decide what to do with positions that should already be flat.

What you build

A backfill job that pulls every missed event for the affected window and reapplies them through the same handler your live webhook uses.

1. Identify the gap

Check your last successfully processed event timestamp. The replay endpoint accepts from and to ISO-8601 timestamps and returns events in chronological order.

2. Replay the window

from alterscope import AlterscopeClient

client = AlterscopeClient(api_key="sk_live_...")

events = client.risk_events.replay(
    from_="2026-04-27T07:00:00Z",
    to="2026-04-27T08:00:00Z",
    types=["risk.depeg.start", "risk.cap.changed"],
)

for ev in events:
    handle_event(ev)  # same handler your webhook uses

3. Idempotency

The replay endpoint returns the same event ids your webhook would have delivered. Make your handler idempotent on event.id so replay is a no-op for events that did get through, and a recovery for those that didn’t.

4. Limits

  • Replay window is 30 days. Older events return a 410 Gone.
  • Per-call window cap is 24 hours. For longer gaps, page in 24-hour slices.
  • Replay does not consume your webhook quota; it counts against your standard rate limit.

5. Troubleshooting

  • Gap still has missing events after replay: check the rejected events log via /v2/webhooks/{id}/deliveries?status=failed and re-emit them through the handler manually.
  • Order matters: events arrive in chronological order; do not parallelize handlers if your kill-switch is order-sensitive.