# MLB Odds API

The Odds API covers MLB odds for live and upcoming games in a simple JSON API.

Not a developer? Current MLB odds can also be accessed in Excel or Google Sheets. For website owners, the odds widget brings bookmaker odds into websites with a simple HTML tag.

# Features

  • MLB odds are covered for live and upcoming games.

  • Featured markets, including moneyline, spreads, totals are covered for several bookmakers. See the full list of bookmakers.

  • Additional markets including player props, innings markets, and more are covered for most US bookmakers. See the full list of betting markets.

  • Odds are refreshed at regular intervals. More information on update intervals can be found here.

  • MLB scores are covered, with final scores available for games completed up to 3 days ago.

  • Current odds data and scores are available on all usage plans, including the free usage plan.

  • Historical MLB odds data is available on paid usage plans. Historical odds for featured markets (moneyline, spreads, totals) are available from mid-2020. Historical odds for other markets are available from May 2023. More information on historical odds data can be found here.

  • The API response includes deep links to bookmaker websites.

# Querying MLB Odds

Featured markets (moneyline, spreads and totals) can be queried using the odds endpoint. For additional markets including player props, use the event-odds endpoint.

Parameters

To query current MLB odds for featured markets, the following parameters need to be provided:

  • sport   In this case baseball_mlb
  • regions   Regions of bookmakers to return, for example us
  • markets   For example, h2h for moneyline, spreads and totals
  • apiKey   Get a free API key

See the documentation for more options

Example API Request

https://api.the-odds-api.com/v4/sports/baseball_mlb/odds?regions=us&markets=h2h,spreads,totals&oddsFormat=american&apiKey=YOUR_API_KEY

Example API Response

The API will return live and upcoming MLB games, including start times, home and away teams, and odds from bookmakers for the specified regions and markets.

[{
    "id": "d537f87ae371eead1102a5016d6c2659",
    "sport_key": "baseball_mlb",
    "sport_title": "MLB",
    "commence_time": "2024-08-20T22:41:00Z",
    "home_team": "Miami Marlins",
    "away_team": "Arizona Diamondbacks",
    "bookmakers": [
    {
        "key": "betmgm",
        "title": "BetMGM",
        "last_update": "2024-08-20T17:54:21Z",
        "markets": [
        {
            "key": "h2h",
            "last_update": "2024-08-20T17:54:21Z",
            "outcomes": [
                {"name": "Arizona Diamondbacks", "price": -150},
                {"name": "Miami Marlins", "price": 125}
            ]
        },
        {
            "key": "spreads",
            "last_update": "2024-08-20T17:54:21Z",
            "outcomes": [
                {"name": "Arizona Diamondbacks", "price": 105, "point": -1.5},
                {"name": "Miami Marlins", "price": -130, "point": 1.5}
            ]
        },
        {
            "key": "totals",
            "last_update": "2024-08-20T17:54:21Z",
            "outcomes": [
                {"name": "Over", "price": -115, "point": 7.5},
                {"name": "Under", "price": -105, "point": 7.5}
            ]
        }
        ]
    },
    ...

The usage cost of the API call in this example is

usage cost = [number of markets] x [number of regions] = 3 x 1 = 3 credits

See the API documentation for details.

# Query Any MLB Markets

Any supported MLB markets can be queried one game at a time using the event-odds endpoint.

Parameters

To query current MLB odds for any market, including player props, innings markets and more, the following parameters need to be provided:

  • sport   In this case baseball_mlb
  • eventId   This example uses the id of Diamondbacks @ Marlins (id d537...). A list of current event ids can be queried using the events endpoint.
  • regions   Regions of bookmakers to return, for example us
  • markets   For example h2h_1st_5_innings (1st 5 innings moneyline), batter_home_runs, pitcher_strikeouts
  • apiKey   Get a free API key

See the documentation for more options.

Example API Request

https://api.the-odds-api.com/v4/sports/baseball_mlb/events/d537f87ae371eead1102a5016d6c2659/odds?regions=us&markets=h2h_1st_5_innings,batter_home_runs,pitcher_strikeouts&oddsFormat=american&apiKey=YOUR_API_KEY

Example API Response

The response will contain the specified MLB game including odds from the specified bookmakers and markets.

{
    "id": "d537f87ae371eead1102a5016d6c2659",
    "sport_key": "baseball_mlb",
    "sport_title": "MLB",
    "commence_time": "2024-08-20T22:41:00Z",
    "home_team": "Miami Marlins",
    "away_team": "Arizona Diamondbacks",
    "bookmakers": [{
      "key": "betmgm",
      "title": "BetMGM",
      "last_update": "2024-08-20T17:54:21Z",
      "markets": [
        {
          "key": "batter_home_runs",
          "last_update": "2024-08-20T17:54:42Z",
          "outcomes": [
            {"name": "Over", "description": "Eugenio Suarez", "price": 525, "point": 0.5},
            {"name": "Under", "description": "Eugenio Suarez", "price": -750, "point": 0.5},
            {"name": "Over", "description": "Derek Hill", "price": 1000, "point": 0.5},
            {"name": "Under", "description": "Derek Hill", "price": -2000, "point": 0.5},
            ...
          ]
        },
        {
          "key": "h2h_1st_5_innings",
          "last_update": "2024-08-20T17:54:42Z",
          "outcomes": [
            {"name": "Arizona Diamondbacks", "price": -145},
            {"name": "Miami Marlins", "price": 115}
          ]
        },
        {
          "key": "pitcher_strikeouts",
          "last_update": "2024-08-20T17:54:42Z",
          "outcomes": [
            {"name": "Over", "description": "Eduardo Rodriguez", "price": -125, "point": 4.5},
            {"name": "Under", "description": "Eduardo Rodriguez", "price": -105, "point": 4.5},
            {"name": "Over", "description": "Edward Cabrera", "price": -150, "point": 4.5},
            {"name": "Under", "description": "Edward Cabrera", "price": 115, "point": 4.5
            }
          ]
        }
      ]
    },
    ...

The usage cost of the API call in this example is

usage cost = [number of markets] x [number of regions] = 3 x 1 = 3 credits

If you only need featured markets (moneyline, spreads, totals), it will be more cost-efficient to query the odds endpoint since it will return multiple games.

See the API documentation for details.

# Other Sports

See the full list of sports covered by The Odds API.

# Stay Updated

Follow us on X.com or Bluesky to stay updated on new sports, bookmakers, markets and features.