# ESPN Scores & Standings (`timbered_oak/espn-scores-standings`) Actor

Fetches team-level scores and standings for major sports leagues (NFL, NBA, MLB, NHL, etc.) via ESPN's public sports.core.api.espn.com JSON API.

- **URL**: https://apify.com/timbered\_oak/espn-scores-standings.md
- **Developed by:** [Mark](https://apify.com/timbered_oak) (community)
- **Categories:** Other, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.85 / 1,000 game or standings 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/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

## ESPN Scores & Standings

Team-level scores and standings for major sports leagues, pulled from ESPN's
public `sports.core.api.espn.com` JSON API (the `site.api.espn.com` host
returns 403 from some networks, so this actor never touches it).

No player/athlete data is collected — team rows only.

### Input

| Field        | Type    | Required | Default        | Notes |
|--------------|---------|----------|----------------|-------|
| `sport`      | string  | yes      | `football`     | ESPN sport slug: `football`, `basketball`, `baseball`, `hockey`, ... |
| `league`     | string  | yes      | `nfl`          | ESPN league slug: `nfl`, `nba`, `mlb`, `nhl`, ... |
| `mode`       | string  | yes      | `standings`    | `standings` or `scores` |
| `season`     | integer | no       | current year   | e.g. `2025` |
| `seasonType` | integer | no       | `2`            | 1 = preseason, 2 = regular season, 3 = postseason |
| `week`       | integer | no       | `1`            | scores mode only |

The default input (`football`/`nfl`/`standings`) always returns a full set of
current standings rows, in season or out — teams and their (possibly 0-0)
records exist as soon as the season object is created, well before kickoff.

### Output

One dataset row per team (standings mode) or per game (scores mode).

Standings row (real output from a smoke run, 2026 preseason):

```json
{
  "sport": "football",
  "league": "nfl",
  "season": 2026,
  "seasonType": 2,
  "group": "American Football Conference",
  "team": "Buffalo Bills",
  "teamAbbreviation": "BUF",
  "summary": "0-0",
  "wins": "0",
  "losses": "0",
  "ties": "0",
  "winPercent": ".000",
  "pointsFor": "0",
  "pointsAgainst": "0",
  "streak": "-",
  "playoffSeed": "0"
}
```

Scores row (real output, `season:2025, week:1`):

```json
{
  "sport": "football",
  "league": "nfl",
  "season": 2025,
  "seasonType": 2,
  "week": 1,
  "gameId": "401772510",
  "date": "2025-09-05T00:20Z",
  "name": "Dallas Cowboys at Philadelphia Eagles",
  "venue": "Lincoln Financial Field",
  "status": "Final",
  "homeTeam": "Philadelphia Eagles",
  "homeTeamAbbreviation": "PHI",
  "homeScore": 24,
  "awayTeam": "Dallas Cowboys",
  "awayTeamAbbreviation": "DAL",
  "awayScore": 20,
  "winner": "Philadelphia Eagles"
}
```

### Pricing

Pay per event: **$0.00085 per `game-row`** (one charge per dataset row pushed,
whether a game or a standings row) — 15% under the best-rated comparable
actor on the Store. Never charged on an empty result.

### Limits / known gaps

- Standings mode auto-detects the two-conference-group shape used by
  NFL/NBA/NHL/MLB. A single-table league (e.g. soccer) exposes its table at
  a different endpoint and isn't wired up — only add if a buyer needs it.
- Scores mode is week-indexed, which fits weekly-schedule sports (NFL,
  college football). Daily-schedule sports (NBA/MLB/NHL) can still be
  queried — ESPN indexes them by week internally too — but "week" won't map
  to a calendar week the way a buyer might expect.
- ESPN's core API is undocumented and public; it can change shape without
  notice.

# Actor input Schema

## `sport` (type: `string`):

ESPN sport slug, e.g. "football", "basketball", "baseball", "hockey".

## `league` (type: `string`):

ESPN league slug, e.g. "nfl", "nba", "mlb", "nhl".

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

"standings" for current team standings, "scores" for one week's games.

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

Season year, e.g. 2025. Defaults to the current year if omitted.

## `seasonType` (type: `integer`):

1 = preseason, 2 = regular season, 3 = postseason. Defaults to 2.

## `week` (type: `integer`):

Week number for scores mode. Defaults to 1. Ignored in standings mode.

## Actor input object example

```json
{
  "sport": "football",
  "league": "nfl",
  "mode": "standings",
  "seasonType": 2,
  "week": 1
}
```

# Actor output Schema

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

All scraped rows as JSON

# 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 = {
    "sport": "football",
    "league": "nfl",
    "mode": "standings"
};

// Run the Actor and wait for it to finish
const run = await client.actor("timbered_oak/espn-scores-standings").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 = {
    "sport": "football",
    "league": "nfl",
    "mode": "standings",
}

# Run the Actor and wait for it to finish
run = client.actor("timbered_oak/espn-scores-standings").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 '{
  "sport": "football",
  "league": "nfl",
  "mode": "standings"
}' |
apify call timbered_oak/espn-scores-standings --silent --output-dataset

```

## MCP server setup

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

```

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/tbfNFSdPJASXpgr0m/builds/3rQPiJujNeKbHUHmA/openapi.json
