# ESPN Box Score Scraper - NBA, NFL, MLB, NHL Player Game Stats (`neverempty/espn-box-score-scraper`) Actor

Player and team box scores for every NBA, WNBA, NFL, MLB, NHL and college football and basketball game: points, rebounds, assists, yards, touchdowns, hits, strikeouts, innings, goals, saves, time on ice. One row per player per game, by date, team, player or game. Finished and live games.

- **URL**: https://apify.com/neverempty/espn-box-score-scraper.md
- **Developed by:** [NeverEmpty](https://apify.com/neverempty) (community)
- **Categories:** Sports
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.90 / 1,000 stat line returneds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## ESPN Box Score Scraper - NBA, NFL, MLB, NHL Player Game Stats

**Get the full box score of every game as flat rows, one row per player per game: points, rebounds, assists and minutes in the NBA, passing, rushing and receiving yards in the NFL, hits, runs, strikeouts and innings pitched in MLB, goals, shots, saves and time on ice in the NHL, plus team totals.** Pick a date or a date range, a team, a player or a single game, for the NBA, WNBA, NFL, MLB, NHL and college football and basketball.

Box scores feed fantasy lineups, player prop models, daily recap posts, scouting sheets and season stat databases. This Actor puts last night's games into a spreadsheet, database or bot in one run, with every number already split into its own field, so you do not have to copy box scores by hand or pull "8-21" apart into makes and attempts.

### What you get

- **Every player who played** - one row per player per stat group: `points`, `rebounds`, `assists`, `minutes`, `plusMinus` in basketball; `passing`, `rushing`, `receiving`, `defensive`, `kicking` and more in football; `batting` and `pitching` in baseball; `forwards`, `defenses` and `goalies` in hockey.
- **Numbers ready to add up** - shooting lines such as "8-21" come as `fieldGoalsMade` and `fieldGoalsAttempted`, innings pitched "5.2" also comes as `outsPitched` (17), and times such as "59:35" also come in seconds (`timeOnIceSeconds`, `possessionTimeSeconds`).
- **The game around each line** - `gameDate`, `team`, `opponent`, `teamScore`, `opponentScore`, `result` (W, L or T), `homeAway`, `season`, `seasonType` (preseason, regular season or playoffs) and `gameStatus`.
- **Player details** - `player`, `playerId`, `position`, `jersey`, `starter` and `ejected`.
- **Team totals** (on by default) - one row per team with totals such as rebounds, turnovers and points in the paint, total yards, third-down conversions and attempts, penalties and possession time, power plays and faceoffs, or team batting, pitching and fielding.
- **Players who did not play**, if you want them - with the reason (for example coach's decision or injury).
- **Live games** - a game in progress returns its current numbers with `result` empty, so you can follow a night as it happens.

### Leagues

| Sport | Short names |
|---|---|
| Basketball | `nba`, `wnba`, `ncaab` (men's college basketball, Division I) |
| Football | `nfl`, `ncaaf` (college football, FBS) |
| Baseball | `mlb` |
| Hockey | `nhl` |

Common names work as well: "college football", "college basketball", "cfb", "cbb".

### Why this Actor

- **The whole night in one run.** Give a date (or nothing for yesterday) and every finished game of that day comes back, not one game at a time.
- **Only the teams or players you follow.** `teams` reads only the games those teams played; `players` keeps only those players' lines. You pay only for the rows returned.
- **Up to 62 days per run** for season backfills: one run per two months builds a full season of player game logs.
- **Paste a game page address** from espn.com to get just that game.
- **Every empty result explains itself** in a free row: a day without games, games that have not started or were postponed, an unknown league, a name that matched nothing, a refused or unreadable page.

### Input

| Field | What it does |
|---|---|
| `leagues` | One or more short names from the table above. |
| `startDate` | First game day, YYYY-MM-DD (US Eastern date, as on the schedule). Empty = yesterday. |
| `endDate` | Last game day. Empty = the same day as `startDate`. At most 62 days per run. |
| `gameIds` | Optional game page addresses (https://www.espn.com/nba/game/\_/gameId/401909994) or bare game IDs. With games and no dates, only these games are read. |
| `teams` | Only games of these teams, and only their rows. Names, nicknames, cities or abbreviations. |
| `players` | Only these players (name, part of a name, or player ID). Team total rows are left out. |
| `includeTeamStats` | On (default) = add one team total row per team per game. |
| `includeDidNotPlay` | Off (default). On = also add players who did not play, with the reason. |
| `maxRows` | Stop after this many rows. |

Example - every NBA and NHL box score from last night:

```json
{
    "leagues": ["nba", "nhl"]
}
```

Example - one player's game log for a month:

```json
{
    "leagues": ["nba"],
    "startDate": "2026-11-01",
    "endDate": "2026-11-30",
    "teams": ["Magic"],
    "players": ["Franz Wagner"]
}
```

### Output

One row per player per stat group per game:

```json
{
    "league": "nba",
    "gameId": "401909994",
    "gameDate": "2026-11-17T00:00Z",
    "season": 2027,
    "seasonType": 2,
    "gameStatus": "Final",
    "team": "Orlando Magic",
    "teamAbbreviation": "ORL",
    "homeAway": "away",
    "teamScore": 115,
    "opponent": "Boston Celtics",
    "opponentScore": 105,
    "result": "W",
    "kind": "player",
    "statGroup": "player",
    "player": "Franz Wagner",
    "playerId": "4566434",
    "position": "F",
    "starter": true,
    "stats": {
        "minutes": 38,
        "points": 21,
        "rebounds": 8,
        "assists": 9,
        "fieldGoalsMade": 8,
        "fieldGoalsAttempted": 21,
        "threePointFieldGoalsMade": 0,
        "threePointFieldGoalsAttempted": 2,
        "freeThrowsMade": 5,
        "freeThrowsAttempted": 5,
        "plusMinus": 14
    },
    "gameUrl": "https://www.espn.com/nba/game/_/gameId/401909994",
    "status": "ok"
}
```

`gameDate` is the start time in UTC, so an evening game in the US carries the next day's date. `seasonType` is 1 for the preseason, 2 for the regular season and 3 for the playoffs. A team total row has `kind: "team"`, `player: null` and `statGroup` `team` (or `team-batting`, `team-pitching`, `team-fielding` in MLB).

#### Free rows

Rows with a `status` other than `ok` explain an empty or shorter result and are never charged:

| status | Meaning |
|---|---|
| `no-games` | There were no games of that league on that day. |
| `not-played-yet` | The games had not started when the run read them, so there is no box score yet. |
| `no-box-score` | A game was postponed or canceled, or has no player box score. |
| `no-such-league` | A league name was not recognised, or the input had no league. |
| `invalid-input` | A date was not a real YYYY-MM-DD date, the range was backwards or longer than 62 days, or a game could not be recognised. |
| `no-filter-match` | None of the teams or players you asked for were found. |
| `blocked` | The page refused the request after three attempts, or robots.txt did not allow it. |
| `unreadable` | The page did not answer with a readable box score or schedule. |
| `row-limit-reached` | `maxRows` was reached; the rest were not returned and not charged. |
| `budget-reached` | The run hit the maximum total charge you set; the rest were not returned and not charged. |

### Pricing

You pay per row returned (`stat-line-returned`). An NBA game is about 25 rows with team totals, an NHL game about 40, an NFL game about 85 (one row per player per stat group). Free rows are not charged, and there is no start fee. Use `players` or turn off `includeTeamStats` to pay for fewer rows.

### Tips

- Schedule a run every morning with no dates: it reads yesterday, so a fantasy or stats sheet stays current on its own.
- Run in the evening with today's date to get live numbers from games in progress.
- Combine `teams` and `players` for a cheap player game log: only that team's games are read.

### More sports and odds data from the same developer

- [ESPN Standings Scraper - NBA, NFL, MLB, NHL & Soccer Tables](https://apify.com/neverempty/espn-standings-scraper) — league tables with wins, losses, streaks and playoff seeds
- [Live Sports Scores Scraper - NBA, NFL, MLB, NHL, NCAAF, EPL](https://apify.com/neverempty/sports-scores-api) — live, finished and upcoming games in one row shape
- [ESPN Injury Report Scraper & Change Monitor](https://apify.com/neverempty/espn-injury-report-scraper) — every current injury report, with a change monitor
- [Sports Betting Odds Scraper - NFL, NBA, MLB, Soccer, Line Moves](https://apify.com/neverempty/sports-betting-odds-scraper) — odds with line moves
- [Action Network Scraper - Public Betting Splits Monitor](https://apify.com/neverempty/action-network-betting-splits) — public betting splits: tickets % and money % per game
- [UFC Stats Scraper: MMA Fights, Fighters, Events, Round-by-Round](https://apify.com/neverempty/ufc-stats-scraper) — fight, fighter and round-by-round stats

### Thanks for using this Actor

If this Actor saved you time, a short review helps other people find it. If something does not work as expected, open an issue on the Actor page and it will be looked at.

# Actor input Schema

## `leagues` (type: `array`):

Which leagues to read box scores for. Use a short name: nba, wnba, ncaab, nfl, ncaaf, mlb, nhl. Common names also work (college football, college basketball). A name that is not recognised comes back as a free row that says so.

## `startDate` (type: `string`):

First game day to read, as YYYY-MM-DD (US Eastern date, the date on the schedule). Empty = yesterday. One run reads at most 62 days.

## `endDate` (type: `string`):

Last game day to read, as YYYY-MM-DD. Empty = the same day as the From date.

## `gameIds` (type: `array`):

Optional. Game page addresses from espn.com (for example https://www.espn.com/nba/game/\_/gameId/401909994) or bare game IDs. A bare ID is read in the first league listed above. When games are given and no dates, only these games are read.

## `teams` (type: `array`):

Empty = every team. Otherwise team names, nicknames, cities or abbreviations (Lakers, LAL, Kansas City Chiefs, Gonzaga). Only games of these teams are read, and only their rows are returned and charged.

## `players` (type: `array`):

Empty = every player. Otherwise player names (full name or part of it, at least 3 letters) or player IDs. Team total rows are left out when players are given.

## `includeTeamStats` (type: `boolean`):

On = each game also returns one row per team with the team totals (for example rebounds, turnovers, total yards, possession time, power plays).

## `includeDidNotPlay` (type: `boolean`):

On = players listed on the roster who did not play also get a row, with the reason (for example coach's decision or injury) and empty stats.

## `maxRows` (type: `integer`):

The run stops after returning this many rows. Rows that were read but not returned are not charged, and later games are not read.

## Actor input object example

```json
{
  "leagues": [
    "nba"
  ],
  "includeTeamStats": true,
  "includeDidNotPlay": false,
  "maxRows": 10000
}
```

# Actor output Schema

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

One row per player per stat group per game: league, game, date, status, team, opponent, scores, result, player, position, starter, and a stats object with every box score number for that sport. Optional team total rows. Empty results come back as free rows that say why.

# 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 = {
    "leagues": [
        "nba"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("neverempty/espn-box-score-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 = { "leagues": ["nba"] }

# Run the Actor and wait for it to finish
run = client.actor("neverempty/espn-box-score-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 '{
  "leagues": [
    "nba"
  ]
}' |
apify call neverempty/espn-box-score-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,neverempty/espn-box-score-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/tBaF5GG1Bvsa51gbS/builds/FvCwBOPqjsTKsqMHe/openapi.json
