Stream Live Odds, Don’t Poll
If your app needs live odds, open a WebSocket connection instead of polling REST on a timer. WebSocket pushes updates the moment odds change, uses one connection instead of repeated requests, and doesn’t count against your hourly rate limit. See the WebSocket guide for the full setup, including the snapshot-then-stream pattern and reconnect/replay handling. The rest of this page covers REST caching and batching, which still matters for pre-match data and one-off lookups.Performance Optimization
1. Use Batch Endpoints
Always use the multi-odds endpoint when fetching odds for multiple events: Bad:2. Implement Caching
Cache responses based on data type and freshness requirements:3. Select Bookmakers Wisely
Don’t fetch odds from all 365+ bookmakers:4. Filter Events by Bookmaker
When you only care about events available at specific bookmakers, use thebookmaker parameter on the events endpoint. This returns only events that have odds from that bookmaker:
5. Responses Are Gzip Compressed
Every REST response is sent withContent-Encoding: gzip, whether or not your request includes an Accept-Encoding header. Most HTTP clients (Python requests, Node fetch and axios, Go net/http, browsers) decompress this for you. If your client shows binary data instead of JSON, turn on automatic decompression:
Rate Limit Management
1. Implement Rate Limiting
Track and respect API rate limits:2. Handle 429 Responses
Implement exponential backoff for rate limit errors:3. Monitor Usage
Track your API usage to avoid hitting limits:Error Handling
1. Graceful Degradation
Handle missing data gracefully:2. Validate Responses
Always validate API responses:3. Timeout Handling
Set timeouts for API requests:Security Best Practices
1. Secure API Keys
2. Validate Input
Always validate user input before using it in API calls:Data Management
1. Database Schema
Store odds data efficiently:2. Store Historical Data
Keep historical odds for analysis:3. Cleanup Old Data
Regularly clean up stale data:Monitoring & Logging
1. Log Important Events
2. Set Up Alerts
Monitor critical metrics:Testing
1. Unit Tests
2. Integration Tests
Summary Checklist
Performance
Performance
- ✅ Use batch endpoints when possible
- ✅ Implement appropriate caching
- ✅ Select relevant bookmakers only
- ✅ Minimize unnecessary API calls
Rate Limiting
Rate Limiting
- ✅ Implement rate limiting logic
- ✅ Handle 429 responses with backoff
- ✅ Monitor and track usage
- ✅ Use multi-endpoints efficiently
Error Handling
Error Handling
- ✅ Validate all responses
- ✅ Handle missing data gracefully
- ✅ Implement request timeouts
- ✅ Log errors properly
Security
Security
- ✅ Never expose API keys client-side
- ✅ Use environment variables
- ✅ Validate all user input
- ✅ Implement server-side proxy
Data Management
Data Management
- ✅ Design efficient database schema
- ✅ Store historical data when needed
- ✅ Clean up old data regularly
- ✅ Index time-series queries