Skip to content

Guides

How do I get NHL shot locations for a shot map in Python?

Every shot attempt in a game with rink x and y, shot type, strength, shooter and goalie, and a distance to the net computed in pandas.

Code verified November 18, 2026. One call to get_shot_map, 10 credits.

The call

Use season with team for a team's whole year, or player_id for one shooter. Page with offset for large sets.

import requests
import pandas as pd

API_KEY = "YOUR_API_KEY"

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

shots = pd.DataFrame(data["shots"])
# x runs -100..100 along the rink and the nets are near +/-89, so fold both ends together.
shots["distance_ft"] = ((89 - shots["x_coord"].abs()) ** 2 + shots["y_coord"] ** 2) ** 0.5
print(shots.groupby(["team", "type"]).size().unstack(fill_value=0))
print(shots.groupby("type")["distance_ft"].mean().round(1))

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.

Or use the official client: pip install puckapi

What comes back

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

{
  "shots": [
    {
      "type": "shot-on-goal",
      "x_coord": 84,
      "y_coord": -10,
      "shot_type": "wrist",
      "strength": "5v5",
      "team": "PIT",
      "shooter": 8471675,
      "goalie": 8478048,
      "game_id": "2025020002",
      "period": 1,
      "seconds_elapsed": 21
    },
    {
      "type": "shot-on-goal",
      "x_coord": 87,
      "y_coord": -5,
      "shot_type": "wrist",
      "strength": "5v5",
      "team": "PIT",
      "shooter": 8471675,
      "goalie": 8478048,
      "game_id": "2025020002",
      "period": 1,
      "seconds_elapsed": 22
    },
    "...119 more"
  ],
  "summary": {
    "returned": 121,
    "by_type": {
      "shot-on-goal": 53,
      "missed-shot": 23,
      "blocked-shot": 42,
      "goal": 3
    }
  },
  "count": 121,
  "next_offset": null
}

What to do next

  • get_plays (10 credits). Everything else that happened, with strength state and zone.
  • get_goalie_stats (5 credits). Goals saved above expected for the goalies in the shots.

The data this uses

Every row above comes from NHL shot data with rink coordinates and NHL play-by-play data. Every NHL shot attempt since 2010-11 with rink coordinates, shot type, shooter and goalie, by game, team-season or player. REST or MCP, 500 free credits every month.

More guides

The same guide for other sports

Rather ask Claude? 28 free Claude skills call these endpoints for you.

Start with 500 free credits every month

No card. REST or MCP.