# ESPN Scores, Standings & Teams API (`rawtojson/espn-stats-api`) Actor

Live and past scores, league standings and team lists for 40+ ESPN leagues (soccer, NBA, NFL, NHL, MLB...) as clean JSON, no key needed.

- **URL**: https://apify.com/rawtojson/espn-stats-api.md
- **Developed by:** [Juan Francisco](https://apify.com/rawtojson) (community)
- **Categories:** Other
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 result rows

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/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 Scores, Standings & Teams API (JSON, no key)

**ESPN stats API alternative**: get live and past scores, league tables and team lists for 40+ ESPN leagues (LaLiga, Premier League, Champions League, NBA, NFL, NHL, MLB, college sports...) as clean, flat JSON. No API key, no login, no browser.

### Who is it for

- Sports apps, Telegram/Discord score bots and newsletters that need daily results.
- Betting-model builders and fantasy-league tools that need standings and fixtures in a spreadsheet.
- AI agents and dashboards that want one stable JSON schema across sports.

### What you get

Three row types, selected with `dataTypes`:

- `match` (scoreboard): date, status, venue, home/away team, score, per-period line scores, record, TV channels, ESPN link.
- `standing`: rank, team, group/conference, note (for example "Champions League") and all stats (played, wins, points, goal difference...).
- `team`: team id, name, abbreviation, colour, logo, ESPN club page.

#### Example input

```json
{ "leagues": ["soccer/esp.1", "basketball/nba"], "dataTypes": ["scoreboard", "standings"], "maxItems": 60 }
```

#### Example output (standing)

```json
{
  "type": "standing", "sport": "soccer", "league": "esp.1", "group": "2026-27 LALIGA",
  "rank": 1, "teamId": "83", "team": "Barcelona", "abbreviation": "BAR", "note": "Champions League",
  "stats": { "gamesPlayed": 13, "wins": 12, "ties": 0, "losses": 1, "points": 36, "pointsFor": 51, "pointsAgainst": 15, "pointDifferential": 36 },
  "checkedAt": "2026-11-23T18:40:58.840Z"
}
```

League codes follow ESPN: `soccer/esp.1`, `soccer/eng.1`, `soccer/ger.1`, `soccer/ita.1`, `soccer/uefa.champions`, `basketball/nba`, `basketball/wnba`, `football/nfl`, `football/college-football`, `hockey/nhl`, `baseball/mlb`.

### Pricing (pay per event)

| | This Actor | Leader in the niche (`mrbridge/espn-mcp-server`, 103 users/30d) |
|---|---|---|
| Unit | **$0.002 per result row** ($2 per 1,000) | $0.01 per query (an MCP tool call, one answer) |
| 20 league-table rows | $0.04 | $0.01 per call |
| A full NBA day (about 10 games) | $0.02 | $0.01 to $0.07 depending on calls |

Measured platform cost on Apify: about $0.0015 per 1,000 rows (256 MB, a 60-row run costs less than $0.0001), so you only pay for results. You never pay when ESPN blocks the request or the selection is empty.

### Schedule and Google Sheets

Run it from the Apify Scheduler (for example every day at 08:00 with `dateFrom` empty = today), then use the **Google Sheets** integration or a **webhook** to push the dataset to your sheet, bot or database.

### FAQ

**Is it real time?** It returns what ESPN publishes at the moment of the run (live scores included). Schedule it every few minutes for live boards.
**Past dates?** Set `dateFrom` / `dateTo` (max 14 days per run) for the scoreboard.
**Standings of a league that is off-season?** ESPN may return the last or an empty table; the Actor says so in the log.
**Why a row per team and not nested JSON?** Flat rows import cleanly into Sheets, Excel and BI tools.

### Legal

The data comes from ESPN's public, undocumented JSON endpoints. ESPN's terms limit its content to personal, non-commercial use; you are responsible for how you use and republish the data (scores and tables are facts, but logos and editorial text are ESPN's). The Actor sends polite, rate-limited requests (about 3 per second) with an honest User-Agent and does not bypass any login or protection. It may stop working if ESPN changes or blocks those endpoints. Not affiliated with ESPN.

### En español

Marcadores, clasificaciones y equipos de más de 40 ligas de ESPN (LaLiga, Premier, Champions, NBA, NFL...) en JSON limpio, sin clave ni login. Pon `leagues` como `deporte/liga` (por ejemplo `soccer/esp.1`), elige `dataTypes` y listo. Precio: 0,002 $ por fila. Programa la ejecución en el Scheduler y envía el resultado a Google Sheets o a un webhook.

# Actor input Schema

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

ESPN leagues as sport/league, for example soccer/esp.1 (LaLiga), soccer/eng.1 (Premier League), basketball/nba, football/nfl, hockey/nhl, baseball/mlb.

## `dataTypes` (type: `array`):

What to return per league: scoreboard (matches with scores), standings (league table) and teams (team list).

## `dateFrom` (type: `string`):

Optional. First day of the scoreboard (YYYY-MM-DD). Empty means today's scoreboard.

## `dateTo` (type: `string`):

Optional. Last day of the scoreboard (YYYY-MM-DD). Maximum 14 days from the start date.

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

Maximum number of rows to return (and pay for).

## Actor input object example

```json
{
  "leagues": [
    "soccer/esp.1",
    "basketball/nba"
  ],
  "dataTypes": [
    "scoreboard",
    "standings"
  ],
  "maxItems": 500
}
```

# Actor output Schema

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

Matches, standings and teams.

# 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": [
        "soccer/esp.1",
        "basketball/nba"
    ],
    "dataTypes": [
        "scoreboard",
        "standings"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("rawtojson/espn-stats-api").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": [
        "soccer/esp.1",
        "basketball/nba",
    ],
    "dataTypes": [
        "scoreboard",
        "standings",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("rawtojson/espn-stats-api").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": [
    "soccer/esp.1",
    "basketball/nba"
  ],
  "dataTypes": [
    "scoreboard",
    "standings"
  ]
}' |
apify call rawtojson/espn-stats-api --silent --output-dataset

```

## MCP server setup

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

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/ZolU5csyJK5yu3vQk/builds/LC572ZssjTOEgBfgU/openapi.json
