Dataset
NHL shot-level data in Parquet, with shifts and goalie time on ice
Short answer: the NHL History package is play-by-play with shot coordinates, shot type, strength and shooters for every game since 2015-16, plus every shift and official goalie time on ice, as Parquet and CSV for $249. It has no expected goals column, so you fit that yourself.
Is there an xG column?
People search for "NHL shot-level xG", so here is the plain answer first. The package gives you the inputs to an expected goals model, not the output. Each shot attempt has an x and y location on the rink, a shot type, a strength state such as 5v5 or 5v4, the shooter, the goalie in net and the result. We do not ship a per-shot xG value for hockey, in the files or in the API. If you want one, a logistic model on distance, angle, shot type and strength is a good start, and the data supports it.
If a ready-made xG column is the thing you need, our soccer data has one on every located shot, and you can read about it on the Premier League match events page. For hockey today, that part is yours to build.
What is in NHL History
The package (id nhl-history, $249 one time) holds these tables, all keyed on the league's 10-digit game_id:
- games: date, start time, teams, score, game type, venue.
- play_by_play: one row per event, with coordinates, zone, strength, shot type and the players on the event.
- shifts: one row per shift, per player, with a shift source flag.
- shift_audit, one row per game, which says how complete that game's shift chart is.
- skater_game_lines and goalie_game_lines, the per-game lines, with official time on ice for goalies.
- rosters and starting_goalies.
Every table comes as Parquet (zstd) and as CSV. The large ones, such as play_by_play and shifts, are one file per season, for example play_by_play_20252026.parquet. A README, a data dictionary, a row-count file and checksums come with it.
Two bigger tiers add market history. NHL History + Odds ($499) adds moneyline, puck line and total by sportsbook since 2019-20, with opening and closing lines from 2020-21. NHL Complete ($799) adds graded player props from 2022-23 (8.9M rows) and the full intraday line history from 2019-20 (27.5M pre-game rows). These are records of what the market posted. Upgrading later costs the price difference within 90 days.
Coverage and updates
Games run from 2015-16 through the current season. Season ids are eight digits, such as 20242025. Team codes are the ones each team carried that season, so Arizona reads ARI and the same franchise reads UTA from 2024-25. Player and game ids stay the same in every season.
A package includes finished seasons plus the current season as of the latest monthly update on your purchase date. A game's shift chart usually arrives a day after the game, so the newest game can have no shifts yet. The shift audit table flags it. With an API plan of Pro or higher, the current season's files refresh monthly at no charge. Without a plan, an end-of-season update costs a quarter of the package price.
Schema
Real column names from the free sample's play_by_play Parquet file, next to the matching field in the live API.
| Package column | API field (get_plays) | Meaning |
|---|---|---|
| game_id, event_id, season | game_id, event_id, season | Keys |
| sort_order | sort_order | Event order inside the game |
| period, period_type | period, period_type | Period number, and regulation or overtime |
| time_in_period, seconds_elapsed | time_in_period, seconds_elapsed | Game clock |
| type_desc_key | type | goal, shot-on-goal, missed-shot, blocked-shot, hit, faceoff and others |
| strength, away_skaters, home_skaters | strength, away_skaters, home_skaters | State such as 5v5, and skater counts |
| x_coord, y_coord | x_coord, y_coord | Rink location in feet, center ice at 0,0 |
| zone_code | zone | Offensive, neutral or defensive zone for the event owner |
| shot_type | shot_type | wrist, snap, slap, backhand, tip-in, deflected, wrap-around |
| shooting_player_id, goalie_in_net_id | shooting_player_id, goalie_in_net_id | Shooter and the goalie facing the shot |
| blocking_player_id, scoring_player_id | same | Blocker, and scorer on goals |
| assist1_player_id, assist2_player_id | same | Primary and secondary assists |
| home_team_defending_side | not in the shot rows | Which end the home team defends this period |
| away_score, home_score, away_sog, home_sog | away_score, home_score | Running score and shots on goal |
The package also has fields the API's play rows leave out, including time_remaining, situation_code, event_owner_team_id and secondary_reason.
A real sample
Five shot attempts from game 2024030416 (2025 Stanley Cup Final, game 6 in Florida), from the live API on December 6, 2026.
| event_id | period | seconds_elapsed | type | team | strength | x_coord | y_coord | zone | shot_type |
|---|---|---|---|---|---|---|---|---|---|
| 351 | 1 | 17 | blocked-shot | EDM | 5v5 | 54 | 12 | D | none |
| 68 | 1 | 68 | shot-on-goal | EDM | 5v5 | 56 | -22 | O | wrist |
| 151 | 1 | 93 | blocked-shot | EDM | 5v5 | 52 | 26 | D | none |
| 76 | 1 | 100 | blocked-shot | FLA | 5v5 | -58 | 28 | D | none |
| 83 | 1 | 141 | shot-on-goal | EDM | 5v5 | 27 | 41 | O | wrist |
Blocked attempts are in the table next to shots on goal and misses. For a shot-quality model, treat them as their own class or drop them and fit on unblocked attempts.
Load the Parquet files
DuckDB. This counts unblocked 5v5 attempts by shot type and the share that became goals, from every season file at once:
import duckdb
duckdb.sql("""
SELECT shot_type,
count(*) AS attempts,
round(avg((type_desc_key = 'goal')::int), 3) AS goal_rate
FROM read_parquet('play_by_play_*.parquet')
WHERE type_desc_key IN ('goal', 'shot-on-goal', 'missed-shot')
AND strength = '5v5'
AND shot_type IS NOT NULL
GROUP BY shot_type
ORDER BY attempts DESC
""").show()Polars, building the feature table for a first model of your own:
import math
import polars as pl
shots = (
pl.scan_parquet("play_by_play_*.parquet")
.filter(pl.col("type_desc_key").is_in(["goal", "shot-on-goal", "missed-shot"]))
.with_columns(
pl.col("x_coord").abs().alias("ax"),
pl.col("y_coord").abs().alias("ay"),
)
.with_columns(
((89 - pl.col("ax")) ** 2 + pl.col("ay") ** 2).sqrt().alias("distance_ft"),
(pl.col("type_desc_key") == "goal").cast(pl.Int8).alias("is_goal"),
)
.collect()
)
print(shots.select("distance_ft", "is_goal").describe())The 89 is the goal line's distance from center ice in feet. Taking the absolute value of x folds both ends of the rink onto one half, which works for attempts because they are taken in the attacking half. Spot-check a few games against home_team_defending_side before you trust it.
Same events through the API
Set SDHQ_API_KEY from your account.
import json
import os
import urllib.request
payload = {"game_id": "2024030416", "shot_attempts_only": True, "limit": 5}
req = urllib.request.Request(
"https://api.sportsdatahq.com/v1/nhl/get_plays",
data=json.dumps(payload).encode(),
headers={"Content-Type": "application/json", "x-api-key": os.environ["SDHQ_API_KEY"]},
)
with urllib.request.urlopen(req, timeout=30) as resp:
print("HTTP", resp.status)
body = json.load(resp)["data"]
for p in body["plays"]:
print(p["period"], p["seconds_elapsed"], p["type"], p["x_coord"], p["y_coord"], p["shot_type"])curl -s -X POST https://api.sportsdatahq.com/v1/nhl/get_plays \
-H "Content-Type: application/json" -H "x-api-key: $SDHQ_API_KEY" \
-d '{"game_id": "2024030416", "shot_attempts_only": true, "limit": 5}'A call costs 10 credits. There is also a get_shot_map call that returns only shot attempts with shooter and goalie. The hub plan has 1,000 free credits a month; PuckAPI, the hockey brand, has its own docs and 500.
Checked against the live API on 2026-12-06. Questions: hello@sportsdatahq.com.