Skip to main content
This guide walks through building a complete odds screen from scratch — fetching sports, loading events, parsing market data, connecting a WebSocket for live updates, and handling price changes in your UI.

Step 1: Fetch the Sports List

Start by loading the list of available sports. This endpoint is public and does not require authentication.
Use the sport list to populate a sport selector in your UI. Common sport IDs:

Step 2: Fetch Events for a Sport and Date

Once the user selects a sport, fetch events for that sport on a given date. Include market_ids=1,2,3 for moneyline, spread, and total. Use main_line=true to get only the primary line for each market.
Always pass offset=300 to align the date boundary with US Central Time. Without this, games that tip off late at night may show up under the next day’s date.

Step 3: Discover Available Markets

Not every sport or event has the same markets. Before building your odds columns, check which markets actually have data. There are two ways to do this:

By sport and date

Returns all markets with active pricing for a sport on a given date, keyed by sport ID. Use hide_closed_markets=1 to exclude markets that have been taken off the board.

By event ID

Returns only the markets available for a specific event. Useful when building a detail view for a single game.
Use the event_id value returned by GET /api/v2/sports/{sportID}/events/{date} when calling per-event V2 endpoints. Each market object includes: The three core markets for an odds screen are 1 (Moneyline), 2 (Spread), and 3 (Total). See Market IDs for the full list including player props and live markets.

Step 4: Parse Markets for Display

Each event contains a markets array. Index it by market_id to pull moneyline (1), spread (2), and total (3) for each sportsbook.

Step 5: Connect WebSocket for Real-Time Updates

Once your initial data is loaded, connect the V2 Markets WebSocket to receive live price updates. Filter by sport to reduce traffic.

Step 6: Handle Price Updates in the UI

When a WebSocket message arrives, merge the individual price update into your local state. Each message contains a single price change — find the matching event, market, participant, and affiliate, then update the price.

Tips for Production

If the WebSocket disconnects, use GET /api/v2/delta to fetch event deltas or GET /api/v2/markets/delta to fetch market price deltas since your last request. This is much more efficient than refetching the full event list.
When a price moves, briefly highlight the cell green (price improved for the bettor) or red (price worsened). This visual cue helps users notice live movement.
Always check for 0.0001 before displaying a price. Show “Off Board” or “N/A” instead. See Sentinel Values for details.
The sports and affiliates endpoints return reference data that rarely changes. Cache these responses and refresh once per day to avoid unnecessary API calls.
Use affiliate_ids, market_ids, and main_line=true to reduce payload size. Only request the data your UI actually displays.

Next Steps

WebSocket Streaming

Deep dive into WebSocket configuration

Efficient Polling

Delta endpoints and cache strategies for when WebSocket isn’t available

Player Props

Add player prop markets to your screen

Historical Odds

Track line movement over time

Data Model

How events, markets, lines, and prices relate

Sportsbook IDs

Full list of affiliate IDs