WebSocket is available on all plans. Free plan: 30 connections/day. Pro plan: not included. Pro+ RT and Pro+ Live: unlimited.
WS /api/stream
Connect once and receive odds change events pushed by the server as bookmakers update their lines. Latency is typically 1–3 seconds from scrape to push. For a full walkthrough building a production live feed, see the WebSocket Setup Guide.Authentication: two-step token exchange
WebSocket connections cannot carry custom headers in browsers, and long-lived connections cannot use the same auth mechanism as short-lived HTTP requests. OddsStream uses a short-lived token (5-minute TTL) obtained from the REST API: Step 1 — Get a token:4001.
Why a token, not X-Api-Key directly?
- Browsers can’t set custom headers on WebSocket connections
- The WS server (Railway) is separate from the auth gateway (Next.js/Vercel) — the token is the signed credential that crosses this boundary
- Short TTL limits exposure if a token is intercepted
Connection URL
- Node.js
- Browser
- Python
Filter Parameters
Narrow what you receive by appending filters to the connection URL. Combine them freely.Message Format
Each push message is a JSON object representing one selection’s odds changing. One market update (e.g. a 3-way moneyline) produces 3 separate messages — one per selection.Message Fields
Keepalive
The server drops idle connections after ~5 minutes. Send the string"ping" every 30 seconds. The server responds with "pong".
- JavaScript
- Python
Reconnection
The server restarts for deployments. Implement exponential backoff and re-fetch a token on each reconnect attempt.- JavaScript
- Python
Connection lifecycle
Close codes
Notes
- Scrape frequency varies — 5–30 seconds per bookmaker. Don’t expect sub-second latency.
- Individual selection updates — one message per changed odds line, not grouped by market. A 3-way moneyline update = 3 messages.
- WS does not consume HTTP rate limit quota — streaming is billed separately by plan.
- Token TTL — tokens expire 5 minutes after issue. Re-fetch before each new connection.
- Free plan — 30 WS connections per day. Each connection counts (even reconnects), so implement keepalive to avoid unnecessary reconnects.
- For pre-match monitoring —
GET /api/oddspolled every 30 seconds is more bandwidth-efficient than WS during low-change periods. - For live in-play monitoring — WebSocket is strongly preferred; in-play odds change every 5–10 seconds.