# ESPN Rosters & Player Stats Scraper (`w3crawler/espn-rosters-player-stats-scraper`) Actor

Scrape team rosters and player career statistics from ESPN across 16 leagues and 5 sports. No account or proxy required.

- **URL**: https://apify.com/w3crawler/espn-rosters-player-stats-scraper.md
- **Developed by:** [w3crawler](https://apify.com/w3crawler) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 1,000 rosters & player stats

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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 Rosters & Player Stats Scraper

Read public ESPN roster feeds across 16 leagues and write normalized player records to an Apify dataset. Optional, separately bounded player-statistics requests add career or season stat categories when ESPN publishes them. The Actor uses direct HTTPS requests only and does not log in, use a proxy, bypass access controls, or invent missing player values.

### Get started

1. Open the [Actor Store page](https://apify.com/w3crawler/espn-rosters-player-stats-scraper) and select **Try for free** or open the **Input** tab.
2. Add one or more league codes to `leagues`. Optionally filter by `teams`; otherwise `maxTeams` bounds team discovery for each league.
3. Set `season` if you need a specific season, and decide whether to enable `fetchPlayerStats`. Statistics require one extra public request per player and can be slow for large leagues.
4. Start the Actor, open the dataset, and export the players as JSON, CSV, or Excel. Open **Run summary** (`OUTPUT`) to check player, duplicate, and request counts.

### Input

`leagues` is required and must contain between 1 and 16 supported codes. Other fields are optional; unsupported field names and out-of-range values are rejected before requests start.

| Field | Type | Required? | Default | Meaning |
| --- | --- | --- | --- | --- |
| `leagues` | string array | Required | `["nba"]` | League codes to scrape: `nba`, `nfl`, `mlb`, `nhl`, `mls`, `wnba`, `ncaam`, `ncaaw`, `ncaaf`, `epl`, `laliga`, `ucl`, `bundesliga`, `seriea`, `ligue1`, `ligamx`. |
| `teams` | string array | Optional | Not supplied | Team abbreviations (case-insensitive, such as `LAL`) or ESPN numeric team IDs. Omit to fetch all teams for the selected leagues. |
| `maxTeams` | integer | Optional | `32` | Maximum teams discovered per league when no explicit teams are supplied, 1–32. |
| `season` | integer | Optional | Not supplied | Season end year, such as `2026` for the NBA 2025-26 season. Leave empty for the current season; range 1990–2100. |
| `fetchPlayerStats` | boolean | Optional | `false` | Make one extra public request per player for statistics. Categories depend on the sport. |
| `maxItems` | integer | Optional | `500` | Maximum source-backed player records across all leagues, 1–50,000. Diagnostics do not consume this limit. |
| `requestDelayMs` | integer | Optional | `300` | Minimum delay between public ESPN requests, 0–5,000 ms. |

Full default input:

```json
{
  "leagues": ["nba"],
  "maxTeams": 32,
  "fetchPlayerStats": false,
  "maxItems": 500,
  "requestDelayMs": 300
}
```

The Actor reads public ESPN data only. Proxy settings, credentials, and arbitrary source URLs are not accepted.

### Output

The dataset contains one row per player. Optional fields are omitted when the roster or statistics response does not publish them; values are not inferred, and no diagnostic or placeholder rows are written.

| Field | Type | Availability | Meaning |
| --- | --- | --- | --- |
| `recordType` | string enum | Always | Record discriminator; `espn-player`. |
| `sourceName` | string | Always | Human-readable source name. |
| `sourceKind` | string enum | Always | Provenance: `public-espn-api` or `fixture-public-espn`. |
| `sourceUrl` | string | Always | Exact public ESPN roster URL used for the row. |
| `sport` | string | Always | Sport path associated with the league. |
| `league` | string | Always | Normalized league code. |
| `season` | integer | Always | Season year reported by ESPN. |
| `teamId` | string | Always | Public ESPN team identifier. |
| `teamName` | string | Always | Team display name. |
| `teamAbbreviation` | string | Always | Team abbreviation. |
| `teamSlug` | string | Always | Team slug used in ESPN routes. |
| `playerId` | string | Always | Public ESPN player identifier. |
| `fullName` | string | Always | Player full name. |
| `firstName` | string | Always | Player first name. |
| `lastName` | string | Always | Player last name. |
| `jersey` | string | Always | Jersey number. |
| `position` | string | Always | Position name. |
| `positionAbbreviation` | string | Always | Position abbreviation. |
| `rosterGroup` | string | When the roster publishes it | Roster group, such as `offense` or `starters`. |
| `age` | number | Always | Player age. |
| `dateOfBirth` | string | Always | Date of birth in ISO UTC. |
| `height` | number | Always | Height in inches. |
| `weight` | number | Always | Weight in pounds. |
| `displayHeight` | string | Always | Display height, such as `6' 5"`. |
| `displayWeight` | string | Always | Display weight, such as `184 lbs`. |
| `college` | string | When the roster publishes it | College name. |
| `experienceYears` | number | Always | Years of professional experience. |
| `status` | string | Always | Player roster status, such as `Active`. |
| `headshotUrl` | string | Always | Public player headshot URL. |
| `birthCity` | string | Always | Birth city. |
| `birthState` | string | When the roster publishes it | Birth state or region. |
| `birthCountry` | string | Always | Birth country. |
| `handedness` | string | When published | Player handedness, when ESPN exposes it. |
| `playerUrl` | string | Always | Public ESPN player page. |
| `statistics` | object array | When `fetchPlayerStats` is enabled and stats exist | Stat categories, each with `category` and `entries` of `{ name, value, displayValue }`. |
| `scrapedAt` | string | Always | Time the row was saved, in ISO UTC. |

The example below is a real saved row from the 2026-10-25 run. That run had `fetchPlayerStats: false`, so `statistics` and `handedness` are absent.

```json
{
  "recordType": "espn-player",
  "sourceName": "ESPN public roster feeds",
  "sourceKind": "public-espn-api",
  "sourceUrl": "https://site.api.espn.com/apis/site/v2/sports/basketball/nba/teams/lal/roster",
  "sport": "basketball",
  "league": "nba",
  "season": 2027,
  "teamId": "13",
  "teamName": "Los Angeles Lakers",
  "teamAbbreviation": "LAL",
  "teamSlug": "los-angeles-lakers",
  "playerId": "5113969",
  "fullName": "Cameron Carr",
  "firstName": "Cameron",
  "lastName": "Carr",
  "jersey": "43",
  "position": "Guard",
  "positionAbbreviation": "G",
  "age": 21,
  "dateOfBirth": "2004-11-21T08:00:00.000Z",
  "height": 77,
  "weight": 184,
  "displayHeight": "6' 5\"",
  "displayWeight": "184 lbs",
  "college": "Baylor",
  "experienceYears": 0,
  "status": "Active",
  "headshotUrl": "https://a.espncdn.com/i/headshots/nba/players/full/5113969.png",
  "birthCity": "Eden Prairie",
  "birthState": "MN",
  "birthCountry": "USA",
  "playerUrl": "https://www.espn.com/nba/player/_/id/5113969/cameron-carr",
  "scrapedAt": "2026-10-25T20:50:27.918Z"
}
```

### Run summary

**Run summary** is stored separately from the dataset in the run's key-value store under `OUTPUT` (also mirrored at `OUTPUT_SUMMARY`).

| Field | Meaning |
| --- | --- |
| `source` | Public source label recorded for the run. |
| `status` | Actor outcome: `SUCCEEDED` or `FAILED`. |
| `runStatus` | Canonical run status; matches `status`. |
| `dataStatus` | Completeness of saved rows: `COMPLETE`, `PARTIAL`, `NO_RESULTS`, or `FAILED`. |
| `leagues` | League codes used for the run. |
| `season` | Season year used for saved players. |
| `requestedItemCount` | Item limit requested for the run. |
| `recordsStored` | Player rows saved. |
| `normalCount` | Non-diagnostic rows saved. |
| `diagnosticCount` | Operational issues recorded without dataset rows. |
| `diagnosticItems` | Diagnostic dataset rows; always 0. |
| `diagnosticRowsStored` | Diagnostic rows stored in the dataset; always 0. |
| `uniquePlayerIds` | Distinct player IDs saved. |
| `duplicateCount` | Duplicate players removed. |
| `attemptedRequests` | Public ESPN requests attempted. |
| `typeCounts` | Saved record counts by `recordType`. |
| `fixtureMode` | Whether the run used an offline QA fixture instead of live ESPN responses. |
| `completedAt` | Time the summary was written, in ISO UTC. |

| Status | Data status | Meaning |
| --- | --- | --- |
| `SUCCEEDED` | `COMPLETE` | Eligible players were saved without an extraction problem. |
| `SUCCEEDED` | `PARTIAL` | Some players were saved, but a later team or statistics request failed. |
| `SUCCEEDED` | `NO_RESULTS` | The roster feeds completed cleanly without usable players. |
| `FAILED` | `FAILED` | A fatal error occurred before any usable player was saved. |

Example `OUTPUT` from the saved run:

```json
{
  "source": "ESPN public roster feeds",
  "status": "SUCCEEDED",
  "runStatus": "SUCCEEDED",
  "dataStatus": "COMPLETE",
  "leagues": ["nba"],
  "season": 2027,
  "requestedItemCount": 5,
  "recordsStored": 5,
  "normalCount": 5,
  "diagnosticCount": 0,
  "diagnosticItems": 0,
  "diagnosticRowsStored": 0,
  "uniquePlayerIds": 5,
  "duplicateCount": 0,
  "attemptedRequests": 2,
  "typeCounts": {
    "espn-player": 5
  },
  "fixtureMode": false,
  "completedAt": "2026-10-25T20:50:27.919Z"
}
```

### Coverage and limitations

The Actor reads public ESPN roster feeds for the 16 supported leagues. It does not log in, use credentials or a proxy, request arbitrary URLs, or bypass CAPTCHAs, rate limits, device checks, or WAFs. Team discovery and player coverage depend on what ESPN publishes for the selected league and season.

`season` is the season end year: `2026` selects the NBA 2025-26 season, and an empty value uses the current season. Rosters can change during the season; a saved player row is a point-in-time snapshot and may not reflect later trades, waivers, or injuries. Some rosters omit `rosterGroup`, `college`, `birthState`, or `handedness`. With `fetchPlayerStats` enabled, each player requires one additional request and statistics are present only where ESPN exposes categories; the shape of `statistics` differs by sport. Failed teams or statistics requests are counted in the run summary and never become placeholder player rows.

### Usage and support

Cost depends on Apify compute, the number of leagues and teams, the number of players, and whether `fetchPlayerStats` is enabled. Start with one league, a small `maxTeams` or explicit team filter, and statistics disabled; then enable statistics only for the leagues whose stat coverage you need. `requestDelayMs` controls pacing, and `maxItems` caps saved players. See the Actor's Pricing tab for current account rates.

Use the [Actor Issues page](https://apify.com/w3crawler/espn-rosters-player-stats-scraper/issues) to report a problem. Include the run ID, the input used, and the run summary; do not include tokens, cookies, or private data. This Actor is not affiliated with, endorsed by, or sponsored by ESPN. Use it only for public data and in accordance with ESPN's terms, robots guidance, and applicable law. Public roster records can contain personal information; use the output only for lawful purposes.

# Actor input Schema

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

League codes to scrape. Supported: nba, nfl, mlb, nhl, mls, wnba, ncaam, ncaaw, ncaaf, epl, laliga, ucl, bundesliga, seriea, ligue1, ligamx.

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

Optional filter by team abbreviation (case-insensitive, e.g. 'LAL') or ESPN numeric team ID. Omit to fetch all teams in the selected leagues.

## `maxTeams` (type: `integer`):

Maximum teams discovered when no explicit teams are supplied (1–32).

## `season` (type: `integer`):

Year the season ends (e.g. 2026 for NBA 2025-26). Leave empty for current season.

## `fetchPlayerStats` (type: `boolean`):

If enabled, makes one extra API call per player to fetch career statistics (points, rebounds, assists, goals, tackles, etc. depending on sport). Significantly slower for large leagues.

## `maxItems` (type: `integer`):

Maximum number of source-backed player records to return across all leagues (1–50,000); diagnostics do not consume this limit.

## `requestDelayMs` (type: `integer`):

Minimum delay between direct public ESPN requests; 0–5000 ms.

## Actor input object example

```json
{
  "leagues": [
    "nba"
  ],
  "maxTeams": 32,
  "fetchPlayerStats": false,
  "maxItems": 500,
  "requestDelayMs": 300
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing source-backed public roster player records only.

## `runSummary` (type: `string`):

JSON run summary stored under the fixed OUTPUT key.

# 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("w3crawler/espn-rosters-player-stats-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("w3crawler/espn-rosters-player-stats-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 w3crawler/espn-rosters-player-stats-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,w3crawler/espn-rosters-player-stats-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/oeVlHaNEGgrg081YE/builds/86ORuBLW6pcSMjfaM/openapi.json
