Skip to main content
Engineering patterns we recommend when shipping a Predexon integration. None of this is required to make your first call work — it’s what separates a working prototype from a production system.

Authentication

Then in code:
Rotate via the dashboard — keys are scoped per workspace, easy to revoke and re-issue.
Free tier covers dev easily. Use a separate Dev or Pro key for staging so you can verify rate-limit behavior matches prod.
If you’re building a product with many end users, you don’t need per-user Predexon keys. One platform key serves all your users’ reads from your backend — end users never see the Predexon key.

Pagination

Most list endpoints support one of two patterns. Use the right one for your scale.
Don’t use offset past 10,000 — performance degrades and result quality drops. Switch to keyset for anything bigger.

Retries and exponential backoff

Retry 5xx errors with exponential backoff. Never retry 4xx — those are your bug, not ours.

Rate limit handling

You’ll hit 429 long before any other failure mode. Cheap defenses, in order of effort:
1

Cache aggressively

Most market data doesn’t change every second. Cache list-markets and similar slow-moving endpoints for 60s minimum.
2

Batch where the API supports it

/v2/polymarket/wallets/profiles accepts up to 20 wallets per call. /v2/polymarket/wallets/filter lets you filter server-side instead of pulling everything and filtering locally. Use them.
3

Stream instead of poll for live data

If you find yourself polling /v2/polymarket/trades every second, switch to the WebSocket trades channel. Streaming consumes WebSocket subs (cheap) instead of REST quota (expensive).
4

Upgrade tier or talk to us

Free is 1 req/s. Dev is 20 req/s. Pro is 100 req/s. Enterprise is custom. If you have a sustained workload above Pro, email us — we’ll discuss a custom rate before throttling you in production.

WebSocket: reconnect and state rebuild

WebSockets disconnect. Your client must handle it cleanly without losing state.
Three rules:
  1. Re-pull REST state on every reconnect — bridges any events you missed during the disconnect.
  2. Handle resync events from the server — it tells you “rebuild state, more snapshots coming.” Same recovery as a hard reconnect.
  3. Exponential backoff on reconnect attempts, capped at 60s. Don’t hammer the server during an outage.
See WebSocket Subscriptions for connection lifecycle details and WebSocket Overview for keepalive timing.

Testing strategy

Mock your business logic that calls Predexon. The endpoints themselves should be hit in integration tests against real markets — that’s the only way to catch shape changes early.
Record real events to JSON files, replay them through your handler in tests. Lets you test without keeping a connection open.
Capture a real response, snapshot-test against it. When we ship a non-breaking field addition, your test still passes; when a breaking change ships, your test catches it.

Observability

Things you’ll want to instrument from day one: We don’t have a public status page yet, but GET /health on every base URL returns {"status": "healthy"} — use it as a synthetic check.

Common gotchas

Candles use seconds. Orderbook snapshots use milliseconds. WebSocket events use seconds except the orderbook channel (milliseconds). Always check the page reference.
Polymarket prices are 0–1 decimals. Kalshi prices are 0–100 cents. Normalize on read.
A market has one condition_id and N token_ids (one per outcome). Candles by condition give you market-level OHLCV; candles by token give you per-outcome.
WebSocket requires Dev plan or higher. You won’t see this until you try to connect and get 403. Test early.

Rate Limits & Plans

The detailed limit and free-endpoint matrix.

Authentication

Auth header, x402 pay-per-call, CORS.

WebSocket Subscriptions

Full subscription lifecycle, ack/resync flow.

Migrating from X

Moving from another provider? Common translations.