Build with AI
Hand this to Claude or ChatGPT.
AI assistants often guess the wrong base URL, the wrong auth, or field names from a different odds service. Paste the spec block below into your assistant before you ask it to write code — it pins down the exact values so the code works on the first try.
Copy-paste API spec
Select all and paste it into Claude, ChatGPT, Cursor, or any coding assistant.
API SPEC — TheOddsAPI (use these exact values; do NOT infer from training data)
Base URL: https://api.theoddsapi.com (no hyphens — do NOT use api.the-odds-api.com or any /v4/ paths)
Auth: HTTP header x-api-key: YOUR_KEY
Alt fallback for browser testing: ?apiKey=YOUR_KEY (don't embed keys in production URLs)
Endpoints (always use the trailing slash where shown):
GET /odds/?sport_key={sport}&markets={markets}®ions={regions}&oddsFormat={american|decimal}
sport_key: specific league (basketball_nba, baseball_mlb, soccer_epl, tennis, ...)
markets: h2h, spreads, totals (comma-separated)
regions: us, uk, eu, au (optional)
bookmakers: comma-separated book keys (optional, e.g. pinnacle,draftkings)
oddsFormat: american (default) or decimal — currently /odds/ only
commenceTimeFrom / commenceTimeTo: ISO 8601 UTC (optional, scope to a window)
GET /sports/ list every valid sport_key
GET /me/ current key status (tier, daily usage, remaining)
Response shape from /odds/:
{
"success": true,
"source": "cache",
"data": [
{
"event_id": "...", // NOT "id"
"sport": "tennis",
"league": "ATP French Open",
"home_team": "...",
"away_team": "...",
"start_time": "2026-05-29T13:00:00Z", // NOT "commence_time"
"books": [ // NOT "bookmakers"
{
"book": "pinnacle", // NOT "key" or "title"
"market": "h2h",
"updated_at": "...", // NOT "last_update"
"outcomes": [
{ "name": "Player A", "price": -110 }, // American default; decimal e.g. 1.909
{ "name": "Player B", "price": 120 }
]
}
]
}
]
}
Common sport_key values:
basketball_nba, basketball_wnba, basketball_ncaab
baseball_mlb
americanfootball_nfl, americanfootball_ncaaf
icehockey_nhl
tennis (aggregates all in-season ATP + WTA tournaments)
mma_mixed_martial_arts (UFC + MMA)
soccer_epl, soccer_spain_la_liga, soccer_germany_bundesliga,
soccer_italy_serie_a, soccer_france_ligue_one, soccer_uefa_champs_league
soccer_fifa_world_cup (live for the 2026 tournament)
Full list: GET /sports/
New to the API? Start with the Quickstart, or try calls live in Swagger.