Advanced NHL stats in your own code
The numbers you see on onice, as JSON: expected goals, Corsi, on-ice and individual statistics for skaters and goalies, lines and pairs, with-or-without, game reports and shot maps. Start with a free key and move to a paid plan when you need more.
Create a free account and get a key Documentation Plans and limits
Your first request in three steps
- Make an account. It takes a minute: an e-mail address and a password, then the link we send you.
- Make a key on your account page and copy it. Send it in the
X-API-Keyheader. - Ask for data. The five skaters with the best expected-goals share at 5-on-5 this season (at least 100 minutes):
curl -H "X-API-Key: YOUR_KEY" \
"https://onice.dev/api/v1/tables/skaters?seasons=20252026&sit=5v5&toi=100&sort=xgf_pct&limit=5"import requests
r = requests.get(
"https://onice.dev/api/v1/tables/skaters?seasons=20252026&sit=5v5&toi=100&sort=xgf_pct&limit=5",
headers={"X-API-Key": "YOUR_KEY"},
timeout=30,
)
r.raise_for_status()
for row in r.json()["data"]:
print(row["player"], row["team"], row["xgf_pct"])const r = await fetch("https://onice.dev/api/v1/tables/skaters?seasons=20252026&sit=5v5&toi=100&sort=xgf_pct&limit=5", {
headers: { "X-API-Key": "YOUR_KEY" },
});
if (!r.ok) throw new Error(await r.text());
const { data } = await r.json();
for (const row of data) console.log(row.player, row.team, row.xgf_pct);
Replace YOUR_KEY with your key. Every endpoint has a console on the documentation page where you can try it first.
Python and AI assistants
You do not have to write the requests yourself. The Python package onice asks the API for you, reads a long list page after page and tells what every answer cost. The same package has an MCP server, so that an assistant such as Claude, Cursor or ChatGPT can look up players, tables and definitions on onice.dev while you talk to it.
pip install onice
import onice
client = onice.Client("YOUR_KEY")
client.find_player("mcdavid")
page = client.skaters(seasons="20252026", sit="5v5", sort="xgf_pct", limit=50)
print(page.data[0], page.cost, page.remaining)
For an assistant, add this to its settings (it needs uv, which runs the server without installing it, and your key). The server runs on your computer and spends the quota of your own key.
{
"mcpServers": {
"onice": {
"command": "uvx",
"args": ["onice-mcp"],
"env": { "ONICE_API_KEY": "YOUR_KEY" }
}
}
}
Then ask, for example: "Who had the best expected-goals share at 5-on-5 among defensemen this season, and how does the best of them compare with the second?" Every answer shows what it cost, in the same requests as everything else.
What comes back
A meta block (the filters that were applied, the number of rows, paging) and the rows in data. Every value is documented in the glossary and the way the models are built in the methodology.
{
"meta": {
"api": "v1",
"metrics_version": "3",
"count": 3,
"total": 1023,
"offset": 0,
"filters": {
"seasons": [
20252026
],
"stype": 2,
"sit": "all",
"score": "all",
"rate": "n",
"loc": "B",
"toi": 0.0,
"split": true
}
},
"data": [
{
"player_id": 8481542,
"player": "Moritz Seider",
"position": "D",
"team_id": 17,
"team": "DET",
"cf": 2285,
"ca": 1852,
"cf_pct": 55.2333,
"ff": 1719,
"fa": 1276,
"ff_pct": 57.3957,
"sf": 1139,
... (cut for display)
What is in the API
- Team, skater and goalie tables in every situation (5v5, power play, penalty kill and more), by season, score state and location
- Player pages as JSON: profile, game log, teammates, opposition, scoring, shifts, similar players
- Lines, pairs and with-or-without combinations
- Game reports: gameflow, shots with expected goals, shifts
- Standings, schedule, head-to-head and rolling form
The full list, with every parameter, is in the API documentation.