Important Notes Before You Start
Data Model: Lines vs. Markets
The fundamental change in V2 is how odds data is structured.V1: Flat Lines Model
In V1, each event contains alines object keyed by affiliate_id. Each affiliate entry has separate moneyline, spread, and total objects.
V2: Markets Model
In V2, each event contains amarkets array. Each market has participants with lines and prices organized by sportsbook.
Key Structural Differences
| Aspect | V1 | V2 |
|---|---|---|
| Data access | event.lines[affiliate_id].moneyline | event.markets[].participants[].lines[].prices[affiliate_id] |
| Sportsbook grouping | Top level (by affiliate) | Nested inside lines (prices map) |
| Market types | Fixed: moneyline, spread, total | Extensible: any market ID |
| Player props | Not supported | Full support via market IDs |
| Alternate lines | Limited | Full support, is_main flag |
| Period data | line_periods object | period_id on each market |
Period Data
V1: line_periods
V1 uses a nestedline_periods object for half/quarter data:
V2: period_id
V2 includes period data as separate market entries distinguished byperiod_id:
Delta Endpoints
There are four delta endpoints available. The V2-path delta endpoints (/api/v2/delta and /api/v2/markets/delta) are available to all API plans — they were built as upgrades to the V1 delta and happen to live under the /v2/ path.
| Endpoint | Format | Description |
|---|---|---|
GET /api/v1/delta | V1 lines | Returns full V1 events that changed. Use for legacy integrations. |
GET /api/v1/deltaV2 | V2 markets | Returns V2-formatted data via the V1 path. Useful during migration. |
GET /api/v2/delta | V2 events | Returns changed events with V2 market data. |
GET /api/v2/markets/delta | V2 markets only | Returns only changed market/price data — most granular and efficient. |
Delta Polling Pattern
- Initial fetch: Pass
last_id=0(for markets delta) or a zeroed UUID for event deltas - Store the cursor: Each response includes a
last_idordelta_last_idvalue - Subsequent polls: Pass the stored cursor to get only changes since your last poll
- Replace, don’t merge: Each delta contains the full updated object — replace your cached version entirely
WebSocket Endpoints
V2 has dedicated WebSocket endpoints for different data types, while V1 uses a single endpoint.| Version | Endpoint | Description |
|---|---|---|
| V1 | wss://therundown.io/api/v1/ws | Single stream, all line updates |
| V2 | wss://therundown.io/api/v2/ws/markets | Market/price updates |
market_ids, event_ids, affiliate_ids).
Endpoint Mapping Table
Use this table to find the V2 equivalent of each V1 endpoint.| V1 Endpoint | V2 Equivalent | Notes |
|---|---|---|
GET /api/v1/sports | GET /api/v2/sports | Same response format |
GET /api/v1/affiliates | GET /api/v2/affiliates | Same response format |
GET /api/v1/sports/{id}/events/{date} | GET /api/v2/sports/{id}/events/{date} | Response uses markets model |
GET /api/v1/events/{id} | GET /api/v2/events/{id} | Response uses markets model |
GET /api/v1/sports/{id}/events/delta | GET /api/v2/markets/delta | V2 returns market-level changes |
GET /api/v1/events/{id}/lines | GET /api/v2/events/{id}/markets | Markets replace lines |
wss://therundown.io/api/v1/ws | wss://therundown.io/api/v2/ws/markets | V2 supports more filters |
| N/A | GET /api/v2/events/{id}/markets/history | New in V2 |
| N/A | GET /api/v2/events/{id}/openers | New in V2 |
Migration Code Example
Here is a side-by-side comparison of extracting odds data in V1 vs. V2.V2 Advantages
Player props and new market types
Player props and new market types
V2 supports player props (points, rebounds, assists, combos), team totals, and other market types that V1 cannot represent. New markets are added as new market IDs without API changes.
Alternate lines with is_main flag
Alternate lines with is_main flag
V2 returns all available lines (main and alternates) with an
is_main flag to distinguish the primary line. Use main_line=true to filter to main lines only.Granular delta and WebSocket updates
Granular delta and WebSocket updates
V2 delta and WebSocket endpoints deliver market-level updates rather than full event objects, reducing bandwidth and processing overhead.
Historical data endpoints
Historical data endpoints
V2 adds price history and opening lines endpoints that are not available in V1.
Common Gotchas
The 0.0001 sentinel value
A price of0.0001 means the sportsbook has taken that line off the board — it is not an error. Display it as “Off Board” or “N/A” and never use it in calculations. See Sentinel Values for details.
V1 team IDs are unreliable
V1 events contain bothteams and teams_normalized arrays. The teams array uses internal book-specific IDs that vary by sportsbook and can change between seasons. Always use teams_normalized for stable, canonical team identifiers. In V2, the teams array already uses normalized IDs.
Null vs. empty vs. zero
The API may returnnull, empty strings, empty arrays, or 0 depending on the field and state. Your parsing code should handle all of these:
- A missing
scoreobject means the game hasn’t started - An empty
marketsarray means no odds are available yet - A
0value forgame_clockcan mean the period hasn’t started or has ended — checkevent_statusfor context
line_value_is_participant
This flag on market definitions tells you how to interpret thevalue field on lines:
true(moneyline) — the participant IS the bet. The line value is irrelevant (typically"0").false(spread, total) — the line value is the number (e.g.,"-3.5"for spread,"224.5"for total).