Skip to content

Guides

How do I get NHL opening and closing odds by sportsbook in Python?

Every sportsbook's opening and closing moneyline and puck line for a game, so you can measure how far the price moved.

Code verified October 10, 2026. One call to get_odds, 10 credits.

The call

Pass bookmaker to keep one book, or snapshot_type to keep only openings or closings.

import requests
import pandas as pd

API_KEY = "YOUR_API_KEY"

resp = requests.post(
    "https://mcp.puckapi.com/v1/get_odds",
    headers={"x-api-key": API_KEY},
    json={
        "game_id": "2025020002",
    },
    timeout=60,
)
resp.raise_for_status()
data = resp.json()["data"]

odds = pd.DataFrame(data["odds"])
print(data["away_team"], "at", data["home_team"], data["game_date"])
ml = odds.pivot_table(index="bookmaker", columns="snapshotType", values="mlHome")
print(ml)
print(odds[odds["snapshotType"] == "closing"][["bookmaker", "mlHome", "mlAway", "spreadHome", "spreadHomeOdds"]])

Replace YOUR_API_KEY with a key from your dashboard. Python needs requests and pandas (pip install requests pandas). JavaScript runs on Node 18 or newer, or in the browser.

What comes back

The data object of the response, trimmed to the first rows. Every field is real output from the run above.

{
  "game_id": "2025020002",
  "home_team": "NYR",
  "away_team": "PIT",
  "game_date": "2025-10-07",
  "odds": [
    {
      "bookmaker": "betmgm",
      "snapshotType": "closing",
      "mlHome": -235,
      "mlAway": 190,
      "spreadHome": -1.5,
      "spreadHomeOdds": 105,
      "spreadAway": 1.5,
      "spreadAwayOdds": -125,
      "capturedAt": "2025-10-07T22:55:02.000Z"
    },
    {
      "bookmaker": "betmgm",
      "snapshotType": "early_opening",
      "mlHome": -225,
      "mlAway": 185,
      "spreadHome": -1.5,
      "spreadHomeOdds": 115,
      "spreadAway": 1.5,
      "spreadAwayOdds": -135,
      "capturedAt": "2025-10-06T23:54:46.000Z"
    },
    "...10 more"
  ],
  "bookmaker_count": 4
}

What to do next

  • get_line_movement (25 credits). The full time series of a game's line by bookmaker.
  • get_game_detail (10 credits). The result and goalie starts, to grade the price.

More guides

Start with 500 free credits

No card. REST or MCP.