# NHL API Data Scraper (`gentle_cloud/nhl-api-data-scraper`) Actor

Fetch real-time NHL hockey data — standings, schedules, rosters, and player stats from the official NHL public API. No API key required.

- **URL**: https://apify.com/gentle\_cloud/nhl-api-data-scraper.md
- **Developed by:** [Monkey Coder](https://apify.com/gentle_cloud) (community)
- **Categories:** Other
- **Stats:** 17 total users, 0 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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 API Data Scraper

### 🏒 What It Does

Extracts real-time NHL hockey data from the official NHL public API (`api-web.nhle.com`). Get league standings, game schedules, team rosters, and detailed player statistics — all without any API key.

### 📊 Data Modes

| Mode | Description | Output |
|------|-------------|--------|
| **Standings** | Current or historical league standings | Team records, points, goals, rankings |
| **Schedule** | Game schedule for any date | Game times, scores, venues, broadcasts |
| **Roster** | Team roster with player details | Player names, positions, physical stats |
| **Player Stats** | Individual player statistics | Season stats, career totals, bio info |

### 🚀 How to Use

1. **Select a mode** — Choose what type of data you want to extract
2. **Configure parameters** — Set team abbreviation, player IDs, or date as needed
3. **Run the Actor** — Click "Start" and wait for results
4. **Download data** — Export as JSON, CSV, or Excel from the dataset

#### Input Examples

**Get current standings:**

```json
{
    "mode": "standings"
}
```

**Get games for a specific date:**

```json
{
    "mode": "schedule",
    "date": "2026-03-15"
}
```

**Get a team's roster:**

```json
{
    "mode": "roster",
    "team_abbrev": "EDM"
}
```

**Get player stats for specific players:**

```json
{
    "mode": "player_stats",
    "player_ids": "8478402,8479318,8477492"
}
```

### 📋 Sample Output

#### Standings Mode

```json
{
    "team_name": "Colorado Avalanche",
    "team_abbrev": "COL",
    "conference": "Western",
    "division": "Central",
    "games_played": 66,
    "wins": 44,
    "losses": 13,
    "ot_losses": 9,
    "points": 97,
    "goals_for": 249,
    "goals_against": 170,
    "goal_differential": 79,
    "league_rank": 1,
    "home_record": "24-5-3",
    "away_record": "20-8-6",
    "fetched_at": "2026-03-18T12:00:00"
}
```

#### Player Stats Mode

```json
{
    "player_id": 8478402,
    "full_name": "Connor McDavid",
    "team_abbrev": "EDM",
    "position": "C",
    "sweater_number": 97,
    "games_played": 60,
    "goals": 37,
    "assists": 78,
    "points": 115,
    "plus_minus": 25,
    "career_games": 650,
    "career_goals": 350,
    "career_points": 980,
    "fetched_at": "2026-03-18T12:00:00"
}
```

### 🏒 Team Abbreviations

| Team | Abbrev | Team | Abbrev |
|------|--------|------|--------|
| Anaheim Ducks | ANA | New Jersey Devils | NJD |
| Boston Bruins | BOS | New York Islanders | NYI |
| Buffalo Sabres | BUF | New York Rangers | NYR |
| Calgary Flames | CGY | Ottawa Senators | OTT |
| Carolina Hurricanes | CAR | Philadelphia Flyers | PHI |
| Chicago Blackhawks | CHI | Pittsburgh Penguins | PIT |
| Colorado Avalanche | COL | San Jose Sharks | SJS |
| Columbus Blue Jackets | CBJ | Seattle Kraken | SEA |
| Dallas Stars | DAL | St. Louis Blues | STL |
| Detroit Red Wings | DET | Tampa Bay Lightning | TBL |
| Edmonton Oilers | EDM | Toronto Maple Leafs | TOR |
| Florida Panthers | FLA | Utah Hockey Club | UTA |
| Los Angeles Kings | LAK | Vancouver Canucks | VAN |
| Minnesota Wild | MIN | Vegas Golden Knights | VGK |
| Montreal Canadiens | MTL | Washington Capitals | WSH |
| Nashville Predators | NSH | Winnipeg Jets | WPG |

### ⚡ Finding Player IDs

Player IDs can be found in NHL.com player page URLs. For example:

- Connor McDavid: `https://www.nhl.com/player/connor-mcdavid-8478402` → ID: **8478402**
- Auston Matthews: `https://www.nhl.com/player/auston-matthews-8479318` → ID: **8479318**

### 📝 Notes

- **No API key required** — Uses the free NHL public API
- **Rate limiting** — Built-in retry logic with backoff for API rate limits
- **Current season** — Defaults to the current NHL season when no date/season is specified
- **Data freshness** — Standings and stats are updated in near real-time by the NHL
- **All 32 teams** — Supports all current NHL franchises

# Actor input Schema

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

Type of NHL data to fetch: standings (league standings), schedule (game schedule), roster (team roster), or player\_stats (individual player stats)

## `team_abbrev` (type: `string`):

NHL team abbreviation (e.g., TOR, EDM, BOS, NYR). Used for roster mode. Leave empty for all teams in standings mode.

## `player_ids` (type: `string`):

Comma-separated NHL player IDs for player\_stats mode (e.g., 8478402,8479318). Find IDs on nhl.com player pages.

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

Date for schedule or standings lookup (YYYY-MM-DD format). Leave empty for current data.

## `season` (type: `string`):

NHL season for roster lookup (e.g., 20252026 for the 2025-26 season). Leave empty for current season.

## Actor input object example

```json
{
  "mode": "standings"
}
```

# 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",
    "team_abbrev": "",
    "player_ids": "",
    "date": "",
    "season": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("gentle_cloud/nhl-api-data-scraper").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",
    "team_abbrev": "",
    "player_ids": "",
    "date": "",
    "season": "",
}

# Run the Actor and wait for it to finish
run = client.actor("gentle_cloud/nhl-api-data-scraper").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",
  "team_abbrev": "",
  "player_ids": "",
  "date": "",
  "season": ""
}' |
apify call gentle_cloud/nhl-api-data-scraper --silent --output-dataset

```

## MCP server setup

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

```

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/yCn6ToOSCHg9jLcih/builds/FkM3CXfWl0WnjCVHS/openapi.json
