# NHL Stats API - schedule, scores, standings, rosters (`retrainmap/nhl-stats`) Actor

Read the NHL's public web API (api-web.nhle.com) and get flat rows: standings with GP, W, L, OTL, points, GF/GA, streak; games with state, teams, scores, venue; today's scoreboard; rosters with position, number, shoots/catches; player bio + season/career totals. Default: standings now (32 rows).

- **URL**: https://apify.com/retrainmap/nhl-stats.md
- **Developed by:** [RetrainMap Team](https://apify.com/retrainmap) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## NHL Stats API — schedule, scores, standings, rosters

Flat rows from the NHL's public web API (api-web.nhle.com, no key — the API behind
nhl.com): the current standings with GP, W, L, OTL, points, point %, regulation wins,
GF/GA, home/road/last-10 records and streak; every game in a date window with state,
teams, scores, venue and broadcasters; today's scoreboard; team rosters with position,
number, shoots/catches and bio; player pages with bio, draft, season and career totals.
Normalised, one row per team / game / player, ready for CSV or JSON.

**The default input (standings now) is one request, succeeds within 5 minutes and returns
32 rows** — Apify auto-tests it daily. In the off-season the API keeps serving the last
season's final table; if it ever answers an empty list, the Actor writes the next week of
scheduled games the API points to and says so in the log, the status message and
`RUN_SUMMARY.details.fallback_mode`.

### Data source and status

| | |
|---|---|
| Publisher | National Hockey League (NHL) |
| API | https://api-web.nhle.com/v1 — public, no key. The NHL publishes no formal documentation; the endpoints are the ones behind nhl.com and are documented by the community (https://github.com/Zmalski/NHL-API-Reference) |
| What this Actor reads | `GET /standings/now` (or `/standings/{date}`), `GET /schedule/{date}` (7 days per request, following the API's `nextStartDate`), `GET /score/now`, `GET /roster/{TEAM}/current`, `GET /player/{id}/landing` — plain GETs, at most one per 500 ms by default |
| Refresh cadence | Live: game state, period, clock and scores update during games; standings update after each game (`standings_date` on each row); rosters change with transactions; player totals update after each game. The Actor reads live on every run; `fetched_at` on each row is the fetch time |
| Terms / attribution | NHL, the NHL Shield and team marks are trademarks of the NHL and its teams; the data are © NHL and its terms of service (https://www.nhl.com/info/terms-of-service) govern reuse — personal, non-commercial use unless licensed. You are responsible for using the data within those terms |
| Known caveats | `schedule` serves whole weeks — the Actor cuts to `days` from `date` and, when the default week is empty (off-season), jumps once to the API's next scheduled week and says so; `scores_now` reflects the API's `currentDate` (the next game day in the off-season). Preseason, regular-season and playoff games are all included (`game_type`). Roster `sweater_number` is absent for players without a number yet; `player` rows carry the API's `featuredStats` season (skater fields; goalie seasons carry goalie fields inside `season_stats` / `career_stats`). An unknown team code or player id makes the API answer HTTP 404 and the run fails with that message |

Honesty note: sports data only, as published by the NHL's API — nothing is inferred; for
information, not for wagering; not affiliated with the National Hockey League.

Identification: the requests carry a product-token User-Agent and the operator's
contact address in the standard `From:` header (RFC 9110 §10.1.2).

### Input

| Field | Type | Meaning |
|---|---|---|
| `mode` | select | `standings` (default), `schedule`, `scores_now`, `roster`, `player` |
| `date` | `YYYY-MM-DD` | `schedule`: first day (default today, UTC); `standings`: as-of date (default now) |
| `days` | integer | `schedule` only: 1–28, default 7 |
| `team_abbrevs` | array | `roster` only: `TOR`, `EDM`, `BOS` … |
| `player_ids` | array | `player` only: `8478402` (McDavid), `8477934` (Draisaitl) … |
| `max_records` | integer | Default 500 |
| `request_interval_ms` | integer | Default 500 (floor 250) |
| `contact_email` | string | Sent in the `From:` header |

Example — current rosters of Toronto and Edmonton (2 requests, ~56 rows):

```json
{ "mode": "roster", "team_abbrevs": ["TOR", "EDM"] }
```

### Output (dataset row)

Every row carries `mode`, `nhl_url` and `fetched_at`.

- `standings`: `season_id`, `standings_date`, `conference`, `conference_abbrev`, `division`,
  `division_abbrev`, `team_abbrev`, `team_name`, `team_common_name`, `place_name`,
  `league_rank`, `conference_rank`, `division_rank`, `wildcard_rank`, `games_played`, `wins`,
  `losses`, `ot_losses`, `points`, `point_pctg`, `regulation_wins`, `regulation_plus_ot_wins`,
  `goals_for`, `goals_against`, `goal_differential`, `home_record`, `road_record`, `last_10`
  (`W-L-OTL`), `streak` (e.g. `W3`), `clinch_indicator`, `game_type_id`.
- `schedule` / `scores_now`: `game_id`, `date`, `season`, `game_type_id`, `game_type`,
  `start_time_utc`, `game_state` (FUT / LIVE / OFF / FINAL …), `schedule_state`,
  `away_team_id`, `away_abbrev`, `away_team`, `away_score`, `away_record`, `home_team_id`,
  `home_abbrev`, `home_team`, `home_score`, `home_record`, `venue`, `neutral_site`, `period`,
  `period_type`, `last_period_type` (REG / OT / SO), `clock`, `tv_broadcasts`.
- `roster`: `team_abbrev`, `player_id`, `first_name`, `last_name`, `full_name`, `position`
  (C / L / R / D / G), `group`, `sweater_number`, `shoots_catches`, `height_in`, `weight_lb`,
  `birth_date`, `birth_city`, `birth_country`, `headshot`.
- `player`: `player_id`, `first_name`, `last_name`, `full_name`, `is_active`, `team_abbrev`,
  `team_name`, `position`, `sweater_number`, `shoots_catches`, `height_in`, `weight_lb`,
  `birth_date`, `birth_city`, `birth_state_province`, `birth_country`, `draft_year`,
  `draft_team`, `draft_round`, `draft_overall_pick`, `featured_season`, `season_games_played`,
  `season_goals`, `season_assists`, `season_points`, `season_plus_minus`, `season_stats`
  (object), `career_games_played`, `career_goals`, `career_assists`, `career_points`,
  `career_stats` (object), `in_hhof`, `headshot`.

A run summary (mode, filters, requests, off-season fallback, whether the pay-per-event
budget stopped the run) is stored as `RUN_SUMMARY` in the run's key-value store.

### Pricing (pay per event)

| Event | Price |
|---|---|
| `run-start` — once per run | $0.10 |
| `record` — per row written | $0.005 |

The default standings pull (32 rows) costs $0.26; a full week of games (~50 rows) about
$0.35. Rows stop when your run's maximum charge is reached; the run summary says so.

### Operator

Steelyard Ventures LLC (RetrainMap) — info@steelyardclinical.com. Not affiliated with the
National Hockey League. The Actor writes only to its own dataset and key-value store; it
stores no credentials and sends nothing else.

# Actor input Schema

## `mode` (type: `string`):

standings = one row per team from /standings/now (or /standings/{date}). schedule = one row per game for `days` days from `date` (/schedule/{date}). scores\_now = one row per game on the API's current scoreboard (/score/now). roster = one row per player on each team in team\_abbrevs (/roster/{team}/current). player = one row per player id with bio, season and career totals (/player/{id}/landing).

## `date` (type: `string`):

schedule: first day of the window (default today, UTC); when the default week has no games the Actor jumps to the API's next scheduled week and says so. standings: standings as of this date (default: now).

## `days` (type: `integer`):

schedule only: how many days from `date` (1-28; the API serves 7 days per request).

## `team_abbrevs` (type: `array`):

roster only: three-letter NHL team codes, e.g. TOR, EDM, BOS, NYR, COL (the `team_abbrev` values of the standings rows). An unknown code makes the API answer HTTP 404 and the run fails with that message.

## `player_ids` (type: `array`):

player only: NHL player ids, e.g. 8478402 = Connor McDavid, 8477934 = Leon Draisaitl, 8471675 = Sidney Crosby (the number at the end of an nhl.com/player URL; also the `player_id` of roster rows). An unknown id makes the API answer HTTP 404 and the run fails with that message.

## `max_records` (type: `integer`):

Stop after this many rows.

## `request_interval_ms` (type: `integer`):

Politeness delay towards api-web.nhle.com. Standings and scores are one request; schedule one per 7 days; roster one per team; player one per id. Floor 250 ms.

## `contact_email` (type: `string`):

Sent in the standard From: request header so the data owner can reach the operator (RFC 9110 s10.1.2).

## Actor input object example

```json
{
  "mode": "standings",
  "days": 7,
  "max_records": 500,
  "request_interval_ms": 500,
  "contact_email": "info@steelyardclinical.com"
}
```

# Actor output Schema

## `results` (type: `string`):

One row per team (standings), per game (schedule, scores\_now), per rostered player (roster) or per player (player), flat and normalised.

## `results_csv` (type: `string`):

The same rows as a CSV file.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "standings",
    "max_records": 500
};

// Run the Actor and wait for it to finish
const run = await client.actor("retrainmap/nhl-stats").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "mode": "standings",
    "max_records": 500,
}

# Run the Actor and wait for it to finish
run = client.actor("retrainmap/nhl-stats").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "standings",
  "max_records": 500
}' |
apify call retrainmap/nhl-stats --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,retrainmap/nhl-stats"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/3Lrc33xhRn7zutrir/builds/HJzPCoUdgdEfSkycG/openapi.json
