SmartStake Odds API
Pregame and live sportsbook odds in one schema. Pull the current board over REST and keep it current with a Server-Sent Events stream.
Plans and terms
Access needs a paid plan. Use of the API is subject to the Odds API Terms.
Overview
The SmartStake Odds API serves pregame and live odds from sportsbooks, exchanges and prediction markets in one schema.
- REST returns the quotes on the board right now, for chosen events or a whole league.
- The stream pushes every change to those quotes as it happens.
- Same game parlays are priced at each book on request.
- Closing odds give every book's last pregame price for events that have started, back to August 7, 2026.
How fast each book's prices reach you, pregame and live, is on the update frequency page.
Base URL:
https://api.server.smartstake.ca
Get a key
Choose a plan in the Odds API pricing, or from API keys in SmartStake, which lists the plans until you hold a key, and subscribe with a SmartStake account. Your key appears under API keys in SmartStake as soon as payment goes through: open the account menu, or Profile → API keys. Cancel or keep your plan from Manage Subscription (Managing your subscription).
Quick start
export SMARTSTAKE_API_KEY=your-key
# Events on the board for a league
curl --compressed -H "Authorization: Bearer $SMARTSTAKE_API_KEY" \
"https://api.server.smartstake.ca/v1/events?league=mlb"
# Current quotes for one event from two books
curl --compressed -H "Authorization: Bearer $SMARTSTAKE_API_KEY" \
"https://api.server.smartstake.ca/v1/odds?event_id=evt_01M3JFTX43BKN11ZN73APGWD2X&book=draftkings&book=fanduel"
# Stream changes for that event
curl -N --compressed -H "Authorization: Bearer $SMARTSTAKE_API_KEY" \
"https://api.server.smartstake.ca/v1/stream/baseball?event_id=evt_01M3JFTX43BKN11ZN73APGWD2X&book=draftkings&book=fanduel"
Authentication
Send your API key as a bearer token on every request:
Authorization: Bearer your-key
Clients that cannot set headers can pass key=your-key as a query parameter instead. Your key determines which books and leagues you can access and how many streams you can open. Keep it secret.
Compression
Every request must include Accept-Encoding: gzip. Requests without it return 406. Responses larger than 1 KB, league snapshot pages and streams are gzip-compressed.
Most HTTP clients send this header and decompress responses automatically. With curl, add --compressed.
Conventions
- All endpoints use
GET. - Successful responses have the shape
{ "data": ... }. Errors have the shape{ "error": "..." }. - To pass several values for a parameter, repeat it (
book=draftkings&book=fanduel) or separate the values with commas (book=draftkings,fanduel). formatsets the odds format:american(default) ordecimal.- Times are ISO 8601 in UTC (
starts_at) or epoch milliseconds (updated_at).
Keeping a local board
To hold a current copy of the board:
- Open the stream.
- Pull the current quotes over REST.
- Apply each stream event to your copy, keyed by
quote_id. Keep the version with the newestupdated_at.
Open the stream before you pull so that no change is missed between the two. When the stream drops, reconnect with the id of the last event you received (see Resuming a stream): you get every change you missed and do not need to pull again. Pull again only when the stream sends resync-required.
Reference data
| Endpoint | Parameters | Returns |
|---|---|---|
GET /v1/status | none | Readiness, and the last update time for each book |
GET /v1/sports | none | Sports with at least one event on the board |
GET /v1/leagues | sport (optional) | Leagues with at least one event on the board |
GET /v1/books | none | Books your key can access |
GET /v1/events | sport, league (at least one) | Events in start-time order |
GET /v1/markets | sport, league (at least one) | Market keys and names |
GET /v1/teams | league (required) | Teams in a league. See Teams and players. |
GET /v1/players | league (required), team_id | Players in a league. See Teams and players. |
An event has the fields id, sport, league, starts_at, home, away and live.
A sport or league with no events listed drops out of /v1/sports and /v1/leagues until its next event is posted. Your key still includes it. This happens between playoff rounds, for example, when the next game has not been scheduled yet.
Current odds
GET /v1/odds returns the quotes currently on the board. A quote that is not returned is suspended or no longer offered.
How quickly a price change at each book reaches you, pregame and live, is listed on Update frequency.
It works in two modes: by event, or a whole league (see League snapshots).
| Parameter | Description |
|---|---|
event_id | Required. 1 to 5 event ids. |
book | Required. 1 to 5 books. |
market | Market keys from /v1/markets. |
alternate | true for alternate lines only, false for main lines only. |
live | true for live quotes only, false for pregame only. |
format | american (default) or decimal. |
state, platform | Point bet_url at a region and device. See Bet links. |
curl --compressed -H "Authorization: Bearer $SMARTSTAKE_API_KEY" \
"https://api.server.smartstake.ca/v1/odds?event_id=evt_01M3JFTX43BKN11ZN73APGWD2X&book=draftkings&format=decimal"
League snapshots
Call /v1/odds with one league and no event_id to get every quote in that league, in pages. book is optional; without it, every book your key can access is included.
Each page contains whole events in start-time order, about 25,000 quotes. Pass the returned next_cursor as cursor to get the next page. next_cursor is null on the last page.
{
"league": "nfl",
"event_ids": ["evt_01KZCTK537WSKW9Q44E178X194"],
"next_cursor": "2026-10-02T00:15:00Z|evt_01KZCTK537WSKW9Q44E178X194",
"data": [ ... ]
}
Snapshot pages count against a separate per-minute limit. A 429 or 503 response includes a Retry-After header; wait that many seconds and repeat the same request.
import gzip, json, os, time, urllib.error, urllib.parse, urllib.request
API = "https://api.server.smartstake.ca"
HEADERS = {
"Authorization": f"Bearer {os.environ['SMARTSTAKE_API_KEY']}",
"Accept-Encoding": "gzip",
}
def league_snapshot(league, books=()):
cursor, quotes = None, []
while True:
query = [("league", league)] + [("book", book) for book in books]
if cursor:
query.append(("cursor", cursor))
url = f"{API}/v1/odds?{urllib.parse.urlencode(query)}"
try:
with urllib.request.urlopen(urllib.request.Request(url, headers=HEADERS), timeout=120) as response:
body = response.read()
if response.headers.get("Content-Encoding") == "gzip":
body = gzip.decompress(body)
except urllib.error.HTTPError as error:
if error.code in (429, 503):
time.sleep(int(error.headers.get("Retry-After", "5")))
continue
raise
page = json.loads(body)
quotes += page["data"]
cursor = page["next_cursor"]
if cursor is None:
return quotes
quotes = league_snapshot("nfl")
Teams and players
GET /v1/teams and GET /v1/players list the teams and players in a league, with the same ids that quotes carry in team_id and player_id. Use them to label quotes or join them to your own data.
| Parameter | Description |
|---|---|
league | Required. One or more leagues. |
team_id | /v1/players only. Players on these teams only. |
curl --compressed -H "Authorization: Bearer $SMARTSTAKE_API_KEY" \
"https://api.server.smartstake.ca/v1/players?league=nfl&team_id=9454"
{
"data": [
{
"id": 42289,
"name": "Alfred Collins",
"team_id": 9454,
"league": "nfl",
"role": "player",
"position": "DT"
}
]
}
A team has the fields id, name, abbreviation and league. A player has the fields id, name, team_id, league, role and position. abbreviation, position and team_id are null where we do not have them. In individual sports such as tennis, each competitor is also listed as a team, because that is the id quotes carry in team_id.
The lists are refreshed every hour. A player listed in several leagues appears once in each.
Closing odds
Closing odds are each book's last pregame price before an event started: the closing line. Use them to measure closing line value, to backtest, or to see which books moved last.
They cover pregame quotes on every event that started on or after August 7, 2026, for every book, market and line, including player props and alternate lines. An event's closing odds are published on a 15 minute cycle and usually appear 30 to 50 minutes after it starts.
They are the same closes SmartStake uses for closing line value in the Bet Tracker.
Events with closing odds
GET /v1/closing-odds/events lists the events that started on one day.
| Parameter | Description |
|---|---|
date | Required. The UTC day the events started, as YYYY-MM-DD. An evening game in North America often starts on the next UTC day. |
sport, league | Optional filters. |
curl --compressed -H "Authorization: Bearer $SMARTSTAKE_API_KEY" \
"https://api.server.smartstake.ca/v1/closing-odds/events?date=2026-10-20&league=nfl"
{
"data": [
{
"id": "evt_01M0EAWVYT4JS0R7FVXMK3CT9D",
"sport": "football",
"league": "nfl",
"starts_at": "2026-10-20T00:15:00Z",
"home": "san francisco 49ers",
"away": "washington commanders",
"home_team_id": 9454,
"away_team_id": 9431,
"home_team_logo_url": "https://www.smartstake.app/images/teamIcons/9454.webp",
"away_team_logo_url": "https://www.smartstake.app/images/teamIcons/9431.webp",
"quotes": 151853,
"close_version": 1,
"rules_version": 1
}
]
}
| Field | Description |
|---|---|
home_team_id, away_team_id | Ids of the home and away teams, as in /v1/teams. null where we do not have them. |
home_team_logo_url, away_team_logo_url | Team logos, where we have one. Always null in tennis and MMA. |
quotes | The number of closing quotes for the event across all books. |
close_version | Grows each time the event is closed again, after a late price or a moved start time. If you stored the event at a lower version, read its closing quotes again. |
rules_version | The close rules that judged the event's quotes, as on each closing quote. |
Closing quotes
GET /v1/closing-odds returns the closing quotes for up to 10 events.
| Parameter | Description |
|---|---|
event_id | Required. 1 to 10 event ids. |
book | Books to include. Without it, every book your key can access is included. |
market | Market keys to include. |
alternate | true for alternate lines only, false for main lines only. |
format | american (default) or decimal. |
state, platform | Point bet_url at a region and device. See Bet links. |
A major game can have more than 100,000 closing quotes across all books and markets. Filter by book and market when you can.
curl --compressed -H "Authorization: Bearer $SMARTSTAKE_API_KEY" \
"https://api.server.smartstake.ca/v1/closing-odds?event_id=evt_01M0EAWVYT4JS0R7FVXMK3CT9D&book=pinnacle&market=football_points_handicap&alternate=false"
{
"data": [
{
"quote_id": "m~evt_01M0EAWVYT4JS0R7FVXMK3CT9D~football_points_handicap~none~none~-7.0~awayteam~pinnacle",
"event_id": "evt_01M0EAWVYT4JS0R7FVXMK3CT9D",
"sport": "football",
"league": "nfl",
"starts_at": "2026-10-20T00:15:00Z",
"home": "san francisco 49ers",
"away": "washington commanders",
"home_team_id": 9454,
"away_team_id": 9431,
"book": "pinnacle",
"market_name": "Spread",
"market_key": "football_points_handicap",
"label": "Washington Commanders +7",
"participant": "Washington Commanders",
"side": "awayteam",
"line": 7.0,
"odds": -103,
"alternate": false,
"player_id": null,
"team_id": 9431,
"bet_url": "https://www.pinnacle.ca/en/football/nfl/washington-commanders-vs-san-francisco-49ers/1637707533/#all",
"max_bet": 100000.0,
"book_event_id": "1637707533",
"book_market_id": null,
"book_selection_id": null,
"book_player_id": null,
"closed_at": 1792455168011,
"close_state": "exact_on_board",
"removal_label": null,
"rules_version": 1,
"removed_at": null,
"opening_odds": 107,
"opened_at": 1791774801864
}
],
"pending_event_ids": []
}
A closing quote has the fields of the quote object, without live and updated_at, plus:
| Field | Description |
|---|---|
odds | The closing price: the last price the book showed for this quote before the event started. |
closed_at | When that price was set, in epoch milliseconds. Only price changes are recorded, so this is when the price last changed, not when it was last seen. null when unknown. |
close_state | How the closing price stood at the start. See Close states. |
removal_label | How the book removed the quote, read from the shape of the removal. null if the book never removed it, unless it is below_size_floor. See Removal labels. |
rules_version | The close rules that judged this quote: 1 for events that started on or after November 16, 2026, 0 for earlier events. |
removed_at | When the book pulled the quote, if it did before the start, in epoch milliseconds. null otherwise. |
opening_odds | The earliest pregame price we recorded for this quote, in the requested format. null when unknown. |
opened_at | When we recorded that earliest price, in epoch milliseconds. |
odds is always the last price the book actually offered. If a book pulled a line hours before the start, the quote is still returned, with the time it came down in removed_at and a close_state that says whether the line moved or the market went away. To measure against the closing line, keep the quotes with close_state exact_on_board.
Market and selection fields (market_name, label, participant, line, player_id, team_id and bet_url) can be null on some quotes. quote_id, book, market_key, side and the prices are always present.
Close states
close_state | Meaning |
|---|---|
exact_on_board | The price was on the board at the start. A quote pulled within a few minutes of the start, a short window set per book, still counts as on the board. |
line_moved | The book pulled this line but still offered the same side on another line of the market at the start. |
market_gone | The book pulled the market, or an exchange held too little at the price. |
unknown | The record cannot tell, for example after a board reset, when the quote moved to another event, or when the price arrived after the start. |
quiet_feed | The book sent nothing for the event for longer than its usual gap, so whether the price stood is unknown. |
Removal labels
removal_label | Meaning |
|---|---|
polled_expiry | The quote stopped appearing on the board of a book we poll. |
polled_adapter_removal | A book we poll removed the quote explicitly. |
socket_removal | A book that pushes changes to us removed the quote. |
exchange_no_liquidity | An exchange removed the quote, with no liquidity left at the price. |
below_size_floor | The quote was on an exchange's board at the start, but with less size at the price than the minimum we count. Its close_state is market_gone. |
board_reset | The quote was removed when the board was rebuilt. See Board resets. |
event_rebound | The quote moved to another event. |
priced_after_start | The book removed the quote and priced it again after the event started. |
unverified | A removal on rules_version 0, recorded before the labels existed. |
Rules version 0
Events that started before November 16, 2026 come from our earlier closing odds record and carry rules_version 0, with that record's prices, closing times and openers. Their close_state is exact_on_board, line_moved or market_gone, and a removed quote has removal_label unverified. On these events, a quote on the board when the board was rebuilt shortly before the start, and not posted again before the start, counts as pulled at the time of the rebuild.
Opening odds
A quote id includes the line, so opening_odds is the first price for that exact line, not the market's opening line. When a spread moves from -7.5 to -7, the -7 quote opens when the book first posted -7. On rules_version 1, recording starts on November 12, 2026, so a quote first priced before then shows its earliest price since then, not the book's real opener. On rules_version 0, recording starts on August 7, 2026, so openers for events in early August 2026 may be later than the book's real opener.
pending_event_ids lists the events in your request that have no closing odds yet: events that have not started, events that started less than about an hour ago, and ids we do not recognise.
Results
Results are final box scores: the final score, the score of each period, team stats and player stats. They use the same event, team and player ids as quotes, so you can settle your own bets against them, including player props.
A result is published once the game is final, usually within about 15 minutes. Most leagues go back to June 2026. A stat correction after the game updates the result and its updated_at.
Events with results
GET /v1/results/events lists the events with a final result that started on one day.
| Parameter | Description |
|---|---|
date | Required. The UTC day the events started, as YYYY-MM-DD. An evening game in North America often starts on the next UTC day. |
sport, league | Optional filters. |
curl --compressed -H "Authorization: Bearer $SMARTSTAKE_API_KEY" \
"https://api.server.smartstake.ca/v1/results/events?date=2026-10-26&league=nfl"
{
"data": [
{
"event_id": "evt_01M0XS95W37JJYDBZ89Q60K1T1",
"sport": "football",
"league": "nfl",
"starts_at": "2026-10-26T00:20:00Z",
"home": "seattle seahawks",
"away": "kansas city chiefs",
"home_score": 20,
"away_score": 3,
"updated_at": 1793110716017
}
]
}
Box scores
GET /v1/results returns the results for up to 10 events.
| Parameter | Description |
|---|---|
event_id | Required. 1 to 10 event ids. |
curl --compressed -H "Authorization: Bearer $SMARTSTAKE_API_KEY" \
"https://api.server.smartstake.ca/v1/results?event_id=evt_01M0XS95W37JJYDBZ89Q60K1T1"
{
"data": [
{
"event_id": "evt_01M0XS95W37JJYDBZ89Q60K1T1",
"sport": "football",
"league": "nfl",
"starts_at": "2026-10-26T00:20:00Z",
"status": "final",
"home": "seattle seahawks",
"away": "kansas city chiefs",
"home_team_id": 9455,
"away_team_id": 9445,
"home_score": 20,
"away_score": 3,
"regulation_periods": 4,
"periods": [
{ "period": 1, "home": { "points": 0, "fieldGoals": 0, "touchdowns": 0 }, "away": { "points": 0, "fieldGoals": 0, "touchdowns": 0 } }
],
"team_stats": {
"home": { "points": 20, "fieldGoals": 2, "touchdowns": 2 },
"away": { "points": 3, "fieldGoals": 1, "touchdowns": 0 }
},
"players": [
{
"player_id": 42338,
"name": "sam darnold",
"side": "home",
"inactive": false,
"stats": { "passing.yards": 257, "passing.attempts": 28, "passing.completions": 20, "passing.touchdowns": 1, "passing.yards.p1": 0 }
}
],
"updated_at": 1793110716017
}
]
}
| Field | Description |
|---|---|
home_score, away_score | The final score, including overtime or extra innings. |
regulation_periods | How many periods regulation has. Periods after it are overtime or extra innings. |
periods | Each period's stats for each side, in order. |
team_stats | Game totals for each side. |
players | Every player in the box score. side is home or away. player_id matches quotes and /v1/players, and is null when we have not matched the player yet. |
inactive | true for a player who did not play. Most books void a prop on an inactive player. |
stats | Stat names depend on the sport. A suffix such as .p1 is that stat for one period. |
updated_at | When this result last changed, in epoch milliseconds. |
An event that is not final yet, or an id we do not recognise, is left out of data.
Same game parlays
POST /v1/sgp/price prices a same game parlay at each book: the book's own correlated price for the legs together, read from the book when you ask. It answers in up to 15 seconds.
Send two to twelve quote_id values from one event. A quote_id from any book identifies the leg, so you can build the parlay from one book's quotes and price it everywhere.
| Field | Description |
|---|---|
quote_ids | Required. 2 to 12 quote_id values from the same event, one per leg. |
books | Optional. 1 to 20 books to price at. Every supported book your key includes when left out. |
Supported books: DraftKings, FanDuel, BetMGM, bwin, Sports Interaction, Caesars, Fanatics, Betway, theScore, Novig, ProphetX, Sportzino, BetRivers, Bally Bet, Monopoly, LeoVegas, ProLine, NorthStar Bets, BetPlay, Desert Diamond, BetJack and Betinia NJ. bwin and Sports Interaction return BetMGM's price, which they carry.
Every plan includes same game parlays. Legs come from the leagues and books your key includes, and a live leg needs a plan with live odds. Each request counts against your REST rate limit.
curl --compressed -X POST -H "Authorization: Bearer $SMARTSTAKE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"quote_ids": ["m~evt_01M4AA585EGWZ3A7NWEQANBZ2K~basketball_moneyline~none~none~0.0~hometeam~betmgm", "m~evt_01M4AA585EGWZ3A7NWEQANBZ2K~basketball_player_points~none~47051~6.5~over~betmgm"], "books": ["betmgm", "thescore", "betrivers"]}' \
"https://api.server.smartstake.ca/v1/sgp/price"
{
"data": {
"event_id": "evt_01M4AA585EGWZ3A7NWEQANBZ2K",
"legs": 2,
"best": { "book": "betmgm", "status": "priced", "decimal_odds": 2.8, "american_odds": 180 },
"books": [
{ "book": "betmgm", "status": "priced", "decimal_odds": 2.8, "american_odds": 180 },
{ "book": "thescore", "status": "priced", "decimal_odds": 2.34, "american_odds": 134 },
{ "book": "betrivers", "status": "leg_not_offered", "quote_ids": ["m~evt_01M4AA585EGWZ3A7NWEQANBZ2K~basketball_player_points~none~47051~6.5~over~betrivers"] }
]
}
}
best is the longest price, or null when no book priced the parlay. Every book gets a result in books, and a book that cannot price the parlay is a result, not an error:
status | Meaning |
|---|---|
priced | The book priced the parlay. decimal_odds and american_odds are set. |
rejected | The book refuses this combination. reason carries the book's reason when it gives one. |
leg_not_offered | The book has no quote for a leg. quote_ids lists them. |
leg_not_priceable | The book offers a leg but not in a same game parlay. quote_ids lists them. |
leg_unavailable | A leg is suspended or closed at the book. quote_ids lists them. |
line_moved | The book's line on a leg moved since our quote. Pull current odds and try again. |
book_unavailable | The book did not answer in time. |
Novig and ProphetX prices are live quotes from market makers. Each request counts against your requests per minute.
Stream
GET /v1/stream/{sport} opens a Server-Sent Events stream of quote changes. sport is one of football, basketball, baseball, hockey, soccer, tennis or mma.
| Parameter | Description |
|---|---|
league | Leagues to include. |
event_id | Events to include. |
book | Books to include. |
market | Market keys to include. |
alternate | true for alternate lines only, false for main lines only. |
live | true for live quotes only, false for pregame only. |
include_status | true to receive event-status events. |
include_box_scores | true to receive box-score events with live team and player stats. Plans with live odds only. |
format | american (default) or decimal. |
state, platform | Point bet_url at a region and device. See Bet links. |
Changes are sent in batches every 250 ms. A batch contains only the latest version of each quote. The stream is gzip-compressed and each batch is flushed as soon as it is written, so decompress it incrementally as bytes arrive.
Events
| Event | Meaning |
|---|---|
connected | The stream is open. |
quote | One or more quotes are new, changed or back on the board. |
quote-removed | One or more quotes were suspended or pulled. |
event-status | An event's status, score, clock, period or start time changed. Sent only with include_status=true, and only when something changed. |
box-score | An event's live team or player stats changed. Sent only with include_box_scores=true. |
ping | Keep-alive, sent after 25 seconds without other events. |
reconnect | The server is restarting and the stream is closing. Reconnect at once with the last id; nothing is lost. |
resync-required | The stream could not replay what you missed. Keep it open and pull current odds. See Resuming a stream. |
board-reset | The board is being rebuilt and the stream is closing. See Board resets. |
error | Your client read the stream too slowly and the stream is closing. See Slow clients. |
quote and quote-removed carry { "type": "...", "quotes": [ ... ] }. Match removals to your board by quote_id. Some removals include only quote_id, event_id, book, market_key, side, line, live and updated_at.
event: connected
retry: 1000
data: ok
event: quote
id: 1.3f9a0c41b2de.AwAQAKDp...
data: {"type":"quote","quotes":[{"quote_id":"m~evt_01KZCTK5WDFG6R6TWYDZV61GV2~football_player_receptions~none~43576~1.5~over~caesars", ...}]}
event: quote-removed
id: 1.3f9a0c41b2de.AwAQAKDp...
data: {"type":"quote-removed","quotes":[{"quote_id":"m~evt_01KZCTK52NHV0W2Q2PCZVK6R3N~football_player_receptions~none~41593~9.5~under~fanduel", ...}]}
Event status and box scores
With include_status=true or include_box_scores=true, a new stream first sends the current status or box score of every game your filters cover, then an event each time one changes. Nothing is re-sent unless it changed.
Scores and clocks update about every 20 seconds and box scores about every 60 seconds while games are live.
event-status carries { "type": "event-status", "event": { ... } }:
{
"event_id": "evt_01KZCTK5WDFG6R6TWYDZV61GV2",
"sport": "football",
"league": "ncaaf",
"starts_at": "2026-11-14T17:00:00Z",
"home": "iowa state cyclones",
"away": "cincinnati bearcats",
"status": "live",
"period": "2nd Quarter",
"clock": "05:13",
"home_score": 28,
"away_score": 7,
"state": {
"status": "live",
"clock_running": true,
"intermission": false,
"period": 2,
"period_type": "regulation",
"period_label": "Q2",
"final_type": null,
"provider_status": "in"
},
"updated_at": 1794261369816
}
| Field | Values |
|---|---|
event_id, sport, league, starts_at, home, away | Same as on events. sport and league are lowercase. |
status | live, stopped (underway but paused), final, scheduled, postponed, suspended or cancelled. Kept for existing clients; read state.status instead. |
period | The data provider's own period text, such as 2nd Quarter, Halftime or Final (OT), or null. Read state.period and state.period_label instead. |
clock | Game clock text, or null. |
home_score, away_score | Integers, or null before the start. |
updated_at | Epoch milliseconds of the update. |
state.status | scheduled, live, final, postponed, suspended or cancelled. Use this to know where a game is. |
state.clock_running | true while the game is live and play is on; false in a stoppage, an intermission or any status but live. |
state.intermission | true during a break between periods: halftime, the end of a quarter or period, the middle or end of an inning. |
state.period | Integer counting from 1, or null before the start. Overtime continues the count: an NBA first overtime is 5, soccer extra time is 3 and 4, penalties 5. Innings for baseball, sets for tennis, rounds for MMA. |
state.period_type | regulation, overtime, shootout or null. |
state.period_label | Q1–Q4 (quarters), H1/H2 (halves), P1–P3 (hockey periods), OT, 2OT, SO, ET1/ET2 and PEN (soccer), T5/B5/M5/E5 for the top, bottom, middle and end of an inning (I5 when the half is unknown), S1 (tennis sets), R1 (MMA rounds), or null. |
state.final_type | How a final game ended: regulation, overtime, shootout, or null until final. |
state.provider_status | The data provider's own status text, unchanged, or null. Its values differ by source; read state.status rather than this. |
box-score events carry the same state object.
box-score carries { "type": "box-score", "event": { ... } }:
{
"event_id": "evt_01M47ECTR9AXT05K513XEDJQ5R",
"sport": "basketball",
"league": "nba",
"home": "atlanta hawks",
"away": "los angeles lakers",
"status": "Q1 5:57",
"period": "Q1",
"final": false,
"home_score": 17,
"away_score": 12,
"team_stats": { "home": { "points": 17 }, "away": { "points": 12 } },
"periods": [],
"players": [
{ "player_id": 46727, "name": "dyson daniels", "team": "home", "inactive": false,
"stats": { "assists": 2, "blocks": 0, "fieldGoalsAttempted": 1, "fieldGoalsMade": 1, "minutes": 5.98 } }
],
"last_play": null,
"updated_at": 1794261369816
}
player_id matches player_id on player prop quotes. Stat names depend on the sport. status is the data provider's own text; use final to know when a box score is complete.
Resuming a stream
Every event carries an id: your position in the stream after that event. Keep the last one you received. When the stream drops for any reason, reconnect with it in the Last-Event-ID header (browsers' EventSource does this for you), or as last_event_id=... for clients that cannot set headers:
curl --compressed -N \
-H "Authorization: Bearer $SMARTSTAKE_API_KEY" \
-H "Last-Event-ID: 1.3f9a0c41b2de.AwAQAKDp..." \
"https://api.server.smartstake.ca/v1/stream/basketball?league=nba"
The stream first sends the latest version of every quote that changed while you were away, then carries on live. An id works on any of our servers, so this also covers our own restarts: before a server restarts it sends reconnect and closes, and reconnecting straight away with the last id loses nothing.
A quote can arrive twice across a reconnect. Apply quotes by quote_id and keep the newest updated_at, as you would anyway.
We keep about the last 10 minutes of changes. If your id is older than that, comes from before a board reset, or the gap is too large to replay, you receive resync-required instead:
event: resync-required
data: {"type":"resync-required","reason":"cursor_too_old","message":"..."}
Keep the stream open and pull current odds over REST. Quotes on the stream are newer than anything you held.
Slow clients
The stream only sends as fast as your client reads. If your client reads too slowly, updates wait on our side and age. When the oldest unsent update has waited more than 10 seconds, you receive an error event and the stream closes, rather than keep delivering stale prices:
event: error
data: {"error":"Your client read this stream too slowly: ...","reason":"client_too_slow","waited_seconds":12,"limit_seconds":10,"docs":"https://www.smartstake.app/api#slow-clients"}
To avoid it:
- Read the stream on its own thread or process and hand events to a queue. Do slow work, such as database writes or model runs, outside the read loop.
- Batch your writes rather than writing once per quote.
- Filter the stream to the leagues, books and markets you use.
- Compare each quote's
updated_atwith your own clock to see when your client is falling behind.
After an error, reconnect with the last id. The replay can be large, so fix the slow reader first.
Example: recording the stream
The API serves the current board and its changes, not historical odds. This script records a stream to a JSON Lines file, one line per event with the time it was received, and reconnects automatically, resuming from the last event it received. It uses only the Python standard library.
import codecs, json, os, sys, time, urllib.request, zlib
API = "https://api.server.smartstake.ca"
SPORT = sys.argv[1] if len(sys.argv) > 1 else "football"
QUERY = "book=draftkings&book=fanduel&format=decimal"
OUTPUT = f"quotes_{SPORT}_{time.strftime('%Y%m%d')}.jsonl"
def stream_lines(response):
inflater = zlib.decompressobj(16 + zlib.MAX_WBITS)
decoder = codecs.getincrementaldecoder("utf-8")()
pending = ""
while chunk := response.read1(65536):
pending += decoder.decode(inflater.decompress(chunk))
*lines, pending = pending.split("\n")
yield from lines
last_event_id = None
def record(output):
global last_event_id
headers = {
"Authorization": f"Bearer {os.environ['SMARTSTAKE_API_KEY']}",
"Accept-Encoding": "gzip",
}
if last_event_id:
headers["Last-Event-ID"] = last_event_id
request = urllib.request.Request(f"{API}/v1/stream/{SPORT}?{QUERY}", headers=headers)
event = None
with urllib.request.urlopen(request, timeout=90) as response:
for line in stream_lines(response):
if line.startswith("event: "):
event = line[len("event: "):]
elif line.startswith("id: "):
last_event_id = line[len("id: "):]
elif line.startswith("data: ") and event in ("quote", "quote-removed", "board-reset", "resync-required"):
output.write(json.dumps({
"received_ms": int(time.time() * 1000),
"event": event,
"payload": json.loads(line[len("data: "):]),
}) + "\n")
output.flush()
with open(OUTPUT, "a") as output:
delay = 1
while True:
try:
record(output)
delay = 1
except Exception as error:
print("reconnecting after", error, file=sys.stderr)
time.sleep(delay)
delay = min(delay * 2, 60)
else:
time.sleep(1)
Run one process per sport, for example python record_stream.py basketball.
The quote object
{
"quote_id": "m~evt_01KZCTK5WDFG6R6TWYDZV61GV2~football_player_receptions~none~43576~1.5~over~caesars",
"event_id": "evt_01KZCTK5WDFG6R6TWYDZV61GV2",
"sport": "football",
"league": "nfl",
"starts_at": "2026-10-04T17:00:00Z",
"home": "tampa bay buccaneers",
"away": "green bay packers",
"home_team_id": 9451,
"away_team_id": 9438,
"book": "caesars",
"market_name": "Player Receptions",
"market_key": "football_player_receptions",
"label": "Cade Otton Over 1.5",
"participant": "Cade Otton",
"side": "over",
"line": 1.5,
"odds": -530,
"alternate": true,
"live": false,
"player_id": 43576,
"team_id": null,
"bet_url": null,
"max_bet": null,
"book_event_id": null,
"book_market_id": null,
"book_selection_id": null,
"book_player_id": null,
"updated_at": 1790787140829
}
| Field | Description |
|---|---|
quote_id | Stable id for one book's price on one side of one line. See Quote ids. |
event_id | The event. |
sport, league | The event's sport and league. |
starts_at | Scheduled start time. |
home, away | Team or competitor names. |
home_team_id, away_team_id | Ids of the home and away teams, as in /v1/teams. null where we do not have them. |
book | The book offering the price. |
market_name, market_key | Display name and stable key of the market. |
label | Readable description of the selection. |
participant | Player or team the selection refers to, if any. |
side | One of hometeam, awayteam, over, under, draw, yes, no, even, odd. |
line | This side's line. null for moneylines and yes/no markets. |
odds | The price, in American or decimal format. |
alternate | true for alternate lines. |
live | true for in-play quotes. |
player_id, team_id | Ids of the player or team the market is about, if any. A club has one team_id in every competition it plays in. |
bet_url | Link to the selection on the book's site, where available and enabled for your key. See Bet links. |
max_bet | The largest stake the book accepts, where the book publishes it. |
book_event_id, book_market_id, book_selection_id, book_player_id | The book's own ids for the event, market, selection and player, as the book publishes them. null where the book has none. |
updated_at | When this price last changed, in epoch milliseconds. |
Exchange and prediction market prices are what it costs to take the price, net of the venue's fee: Kalshi, Polymarket and Polymarket US prices include the taker fee, and ProphetX prices are net of its commission on winnings. Novig pregame prices carry no fee.
Bet links
Many books run a different site in each state or province, and some open a bet slip in their app through a separate link. Pass where your user is and what they are on, and bet_url comes back ready to open:
| Parameter | Description |
|---|---|
state | Two-letter state or province code, such as NJ or ON. |
platform | desktop (default) or mobile. mobile returns the app link for books that have one. |
Both work on /v1/odds and on streams. Without them, bet_url is the link as we collected it. An unrecognised value returns 400.
curl --compressed -H "Authorization: Bearer YOUR_KEY" \
"https://api.server.smartstake.ca/v1/odds?event_id=evt_01M3JFTX43BKN11ZN73APGWD2X&book=fanduel&state=NJ&platform=mobile"
| Book | state | platform=mobile |
|---|---|---|
betmgm | State site | App link |
fanduel | State site | App link |
draftkings | App link | |
novig | App link | |
prophetx | App link | |
thescore | App link (United States) | |
hard_rock, hardrock_on | Ontario site | Ontario app link |
bet365 | State or province site | |
betrivers | State site | |
caesars | State site (desktop only) | |
bally_bet, bet99, bwin, pinnacle | Canadian or international site |
For every other book, and where a book has no site in the state you pass, bet_url is returned unchanged. A link opens the selection on the book; whether the user can bet there is still up to the book.
Quote ids
A quote_id is made of segments separated by ~:
m ~ event ~ market_key ~ team ~ player ~ line ~ side ~ book
Removing the last two segments (side and book) gives an id shared by every book's quotes on both sides of the same line. Use it to group quotes and to find the opposite side (over and under, hometeam and awayteam, yes and no). Spread lines are written from the home side in the id, so both sides of a spread share it.
The team segment of a team market, such as a team total, is the team_id. When we find that two team ids are the same club and merge them, the quotes on that team's markets carry the surviving team_id, so their quote_id changes.
Board resets
Occasionally the odds board is rebuilt. When a rebuild starts:
- Every open stream receives
board-resetwith"phase": "started"and closes. - Every endpoint except
/v1/statusreturns503with aRetry-Afterheader, and/v1/statusreportsboard_reset_in_progress: true.
Discard every quote you hold. When requests succeed again, reconnect and pull. The board fills back in as books publish prices, so it can be incomplete for a few minutes after a reset.
Limits
Default limits for each key:
| Limit | Value |
|---|---|
| Open stream connections | 7 |
| Requests per minute | 120 |
| League snapshot pages per minute | 10 |
Events and books per /v1/odds request | 5 each |
Events per /v1/closing-odds request | 10 |
Events per /v1/results request | 10 |
| Time an update can wait for a slow client | 10 seconds |
Per-minute limits reset at the start of each minute. A Hobby key covers the five books and five leagues picked at checkout; /v1/books lists the books. It works while the account holds SmartStake Premium and is paused while it does not. Contact us to change your key's limits, books or leagues.
Errors
| Status | Meaning | What to do |
|---|---|---|
400 | A parameter is missing or invalid. | Fix the request. |
401 | The API key is missing or unknown. | Check your key. |
403 | A requested book or league is not included in your key. | Remove it, or contact us. |
404 | Unknown endpoint or sport. | Check the path. |
406 | The request did not include Accept-Encoding: gzip. | Add the header. |
429 | A request, snapshot or stream limit was exceeded. | Wait for Retry-After seconds. |
502 | The odds board, closing odds, results, or teams and players are briefly unavailable. | Retry with backoff. |
503 | A board reset is in progress, snapshot capacity is busy, or same game parlay pricing is unavailable. | Wait for Retry-After seconds. |