Rate Limits
Rate Limits
Section titled “Rate Limits”PolyNode uses per-key rate limiting to ensure fair usage.
Default Limits
Section titled “Default Limits”| Endpoint | Limit |
|---|---|
| All authenticated endpoints | 120 requests per minute per key |
POST /v1/keys (key generation) | 3 per IP per hour |
| WebSocket connections | 1 per key (shared subscription channel) |
How It Works
Section titled “How It Works”- Rate limits are tracked per API key using a sliding window.
- When you exceed the limit, you’ll receive a
429 Too Many Requestsresponse. - The error message includes a Unix timestamp for when you can retry.
Rate Limit Response
Section titled “Rate Limit Response”// HTTP 429{ "error": "Rate limit exceeded. Retry after 1709136060."}Best Practices
Section titled “Best Practices”Use WebSocket for Real-Time Data
Section titled “Use WebSocket for Real-Time Data”Instead of polling REST endpoints, connect via WebSocket for live updates:
// Instead of polling /v1/markets every 5 seconds (12 req/min)...// Use WebSocket (1 connection, unlimited events)const ws = new WebSocket('wss://polynode.dev/ws?key=pn_live_YOUR_KEY');ws.send(JSON.stringify({ action: 'subscribe', type: 'settlements'}));Cache Metadata Locally
Section titled “Cache Metadata Locally”Market metadata (question, slug, outcomes) changes infrequently. Cache it and only refresh periodically:
// Fetch full market list onceconst markets = await fetch('/v1/markets?count=1000', { headers }).then(r => r.json());
// Cache by token_idconst cache = new Map(markets.markets.map(m => [m.token_id, m]));
// Use cache for lookups, refresh every 5 minutesBatch Where Possible
Section titled “Batch Where Possible”Use /v1/markets?count=1000 instead of individual /v1/markets/:id calls to reduce requests.
Use Filtered Subscriptions
Section titled “Use Filtered Subscriptions”WebSocket subscriptions with filters reduce message volume and processing overhead:
{ "action": "subscribe", "type": "settlements", "filters": { "tokens": ["specific-token-id"], "min_size": 100 }}Requesting Higher Limits
Section titled “Requesting Higher Limits”Contact us for custom rate limits for production applications.