Build with AI
Hand this to Claude or ChatGPT.
Last updated 2026-06-08
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.
No code at all
Prefer not to write any code? Add the official Claude Connector and just ask for odds in plain English. Open the Connector →
Copy-paste API spec
Select all and paste it into Claude, ChatGPT, Cursor, base44, Lovable, Replit, v0, bolt.new, or any AI coding assistant.
Works with no-code AI app builders. See our base44 integration guide for a walkthrough.
API SPEC - TheOddsAPI (use these exact values; do NOT infer from training data)
Base URL: https://api.theoddsapi.com (use this exact host - hyphenated variants are a different service. No /v4/ path prefix.)
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}&bookmakers={books}&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 (e.g. pinnacle,draftkings,fanduel)
*** STRONGLY RECOMMENDED for AI tools - see size note below ***
oddsFormat: american (default; e.g. -110, +145) or decimal (e.g. 1.909, 2.45)
Supported on /odds/, /best-lines/, /props/, /historical/odds, /edges/.
commenceTimeFrom / commenceTimeTo: ISO 8601 UTC (optional, scope to a window)
GET /best-lines/?sport_key={sport} best price per outcome across all books
GET /props/?sport_key={sport} player props (Business+ tier)
GET /edges/?sport_key={sport} Pinnacle-anchored cross-book edges (Business+)
GET /historical/odds?sport_key={sport}&from={iso}&to={iso} archive snapshots (Business+)
GET /sports/ list every valid sport_key
GET /me/ current key status (tier, daily usage, remaining)
RESPONSE-SIZE NOTE (for AI tools using web_fetch):
A full /odds/ response (~15 games x 30-50 books) is tens of KB and can
EXCEED the response-size limit of many AI fetch tools (Cowork web_fetch,
Claude.ai web tools, no-code platforms). ALWAYS scope with bookmakers=
or regions= so the response stays small. Example:
/odds/?sport_key=baseball_mlb&markets=h2h&bookmakers=pinnacle,draftkings,fanduel
Response shape from /odds/:
{
"success": true,
"source": "cache",
"data": [
{
"event_id": "abc123...", // NOT "id"
"sport": "baseball",
"league": "MLB",
"home_team": "Cincinnati Reds",
"away_team": "Atlanta Braves",
"start_time": "2026-05-29T23:40:00Z", // NOT "commence_time"
"books": [ // NOT "bookmakers"
{
"book": "pinnacle", // NOT "key" or "title"
"market": "h2h",
"updated_at": "2026-05-29T22:15:00Z", // NOT "last_update"
"outcomes": [
{ "name": "Cincinnati Reds", "price": 116 }, // matches event.home_team
{ "name": "Atlanta Braves", "price": -125 } // matches event.away_team
]
}
]
}
]
}
IMPORTANT: outcomes[].name matches event.home_team or event.away_team literally.
Do NOT write `if outcome.name == "Home Team"` - that string never appears in the
data. Write `if outcome.name == event.home_team`.
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/
Tell your AI to use the API, not web search
AI assistants default to web search when asked about odds - which means hallucinated
or stale numbers from random scoreboard pages instead of your paid data. Pin this
prompt at the start of any AI session where you want odds, and it will route every
question through web_fetch against TheOddsAPI.
PINNED PROMPT - paste at the start of any AI session for odds work.
────────────────────────────────────────────────────────────────────
You have a paid TheOddsAPI account. Whenever I ask about odds,
matchups, lines, or props, do NOT use web search. Instead, use your
web_fetch tool to call this URL:
https://api.theoddsapi.com/odds/?sport_key={sport_key}&markets=h2h&bookmakers=pinnacle,draftkings,fanduel&apiKey=YOUR_KEY
Replace {sport_key} with the league I'm asking about: basketball_nba,
baseball_mlb, soccer_epl, tennis, icehockey_nhl, mma_mixed_martial_arts,
americanfootball_nfl, etc. Always include &bookmakers= to scope the
response - the full response is too large for fetch tools.
Parse the response using these EXACT field names:
event_id, start_time, books, book, outcomes
(do NOT use commence_time, bookmakers, key, last_update)
outcomes[].name will be a real team or player name that matches
event.home_team or event.away_team - do not treat "Home Team" as a
literal value.
If I ask for "best line" or "best moneyline," compare prices across the
books in the response and tell me which book has the best number for
the side I'm asking about. Show matchups in a readable list with start
times in my local timezone.
If web_fetch errors or returns nothing, tell me - do NOT fall back to
web search.
────────────────────────────────────────────────────────────────────
New to the API? Start with the Quickstart, or try calls live in Swagger.