Authentication
Store the key as an env var, not in code
Store the key as an env var, not in code
Use one key per environment (dev / staging / prod)
Use one key per environment (dev / staging / prod)
Free tier covers dev easily. Use a separate Dev or Pro key for staging so you can verify rate-limit behavior matches prod.
One platform key for multi-user products
One platform key for multi-user products
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.Retries and exponential backoff
Retry 5xx errors with exponential backoff. Never retry 4xx — those are your bug, not ours.Rate limit handling
You’ll hit429 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.- Re-pull REST state on every reconnect — bridges any events you missed during the disconnect.
- Handle
resyncevents from the server — it tells you “rebuild state, more snapshots coming.” Same recovery as a hard reconnect. - Exponential backoff on reconnect attempts, capped at 60s. Don’t hammer the server during an outage.
Testing strategy
Don't mock Predexon endpoints in unit tests
Don't mock Predexon endpoints in unit tests
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.
Replay historical WebSocket events for handler tests
Replay historical WebSocket events for handler tests
Record real events to JSON files, replay them through your handler in tests. Lets you test without keeping a connection open.
Snapshot endpoint responses
Snapshot endpoint responses
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
Timestamp units differ by endpoint
Timestamp units differ by endpoint
Candles use seconds. Orderbook snapshots use milliseconds. WebSocket events use seconds except the orderbook channel (milliseconds). Always check the page reference.
Cents vs decimals
Cents vs decimals
Polymarket prices are 0–1 decimals. Kalshi prices are 0–100 cents. Normalize on read.
condition_id vs token_id
condition_id vs token_id
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 plan gating
WebSocket plan gating
WebSocket requires Dev plan or higher. You won’t see this until you try to connect and get
403. Test early.What to read next
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.
