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 (canonical reference for the endpoints and field names below)

Base URL: https://api.theoddsapi.com   (all endpoints live directly under this host - there is 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}&regions={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/

New to the API? Start with the Quickstart, or try calls live in Swagger.