Overview
The WebSocket feed delivers real-time odds updates with the same response format as the REST API/odds endpoint. Instead of polling, you receive instant updates whenever odds change.
Add-on Feature: WebSocket access is available as an add-on. Subscribe through odds-api.io to enable it for your account.
Connection
Endpoint:- API key passed as query parameter
- One connection per API key
- New connections automatically close older ones
/bookmakers/selected/select endpoint.
Filter Parameters
| Parameter | Type | Max | Description |
|---|---|---|---|
markets | comma-separated | 20 | Required. Market names (e.g., ML,Spread,Totals) |
sport | comma-separated | 10 | Filter by sport slugs (e.g., football,basketball) |
leagues | comma-separated | 20 | Filter by league slugs (e.g., england-premier-league) |
eventIds | comma-separated | 50 | Filter by specific event IDs |
status | single value | - | live or prematch |
Using
leagues or eventIds is recommended to reduce bandwidth. You cannot use both together.Example URLs
Error Responses (400 Bad Request)
| Error | Cause |
|---|---|
Too many sports. Maximum 10 allowed. | Exceeded limit |
Too many leagues. Maximum 20 allowed. | Exceeded limit |
Too many event IDs. Maximum 50 allowed. | Exceeded limit |
Too many markets. Maximum 20 allowed. | Exceeded limit |
Cannot use both 'leagues' and 'eventIds' filters together. | Mutual exclusion |
Invalid status filter. Use 'prematch' or 'live' | Invalid value |
Message Types
| Type | Description |
|---|---|
welcome | Connection confirmed with active filters |
created | New match added |
updated | Match or market changed |
deleted | Match removed |
no_markets | Match exists but currently no markets available |
Welcome Message
Sent immediately after connection:Message Format
Quick Start
Handling Message Types
Best Practices
Use Filters to Reduce Bandwidth
Use Filters to Reduce Bandwidth
Use
leagues or eventIds filters when you only need specific data. This reduces bandwidth and improves performance.Implement Reconnection Logic
Implement Reconnection Logic
Always implement exponential backoff for reconnections to handle network issues gracefully.
Handle All Message Types
Handle All Message Types
Handle
welcome, created, updated, deleted, and no_markets to keep your data in sync.One Connection Per API Key
One Connection Per API Key
New connections automatically close older ones. Don’t create multiple connections with the same API key.
Process Updates Asynchronously
Process Updates Asynchronously
If receiving many updates, process them asynchronously to avoid blocking your main thread.
Benefits Over REST API
| Feature | REST API | WebSocket |
|---|---|---|
| Latency | 100-500ms (polling) | <150ms (push) |
| Request overhead | Multiple HTTP requests | Single persistent connection |
| Real-time updates | Manual polling | Automatic push |
| Bandwidth | Higher (repeated headers) | Lower (single connection) |
| Best for | Batch requests | Live updates |
Get Access
Enable WebSocket Access
Subscribe to WebSocket as an add-on through your odds-api.io account