# MLB Box Scores — Every Game Since 1871 (`sourcerow/mlb-boxscore-history`) Actor

235,611 Major League Baseball games, 1871 to the last completed season — score by inning, full team box score, umpires, starting lineups and park, one table, same columns everywhere.

- **URL**: https://apify.com/sourcerow/mlb-boxscore-history.md
- **Developed by:** [SourceRow](https://apify.com/sourcerow) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.20 / 1,000 games

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

235,611 Major League Baseball games, from the first professional season in 1871
through the last completed season, in one flat table where every row has the
same 173 columns. Score by inning, full team box score, umpires, starting
lineups, park, attendance and time of game.

### What it does

Retrosheet publishes game logs as fixed-width text with 161 positional fields
and no header. This Actor parses that into typed columns with names, and ships
the historical archive inside the image: seasons already published are served
from disk with no network request at all.

Seasons newer than the archive are fetched from Retrosheet at run time, so the
Actor stays current without being rebuilt. Retrosheet publishes a season once it
has ended.

### What you get

173 fields per row: the game identity and date, both teams with league and game
number, score, line score by inning, innings played, duration, attendance, park,
day or night, the full batting and pitching totals for each side, umpires by
position, the named pairs (winning and losing pitcher, save, game-winning RBI),
the nine starting batters for each side with position, and the provenance
fields.

The table view shows 15 of them; all 173 are in the JSON, CSV and Excel
downloads.

### Input

| Field | Meaning |
|---|---|
| `teams` | Retrosheet team codes, for example `NYA`, `BOS`. Empty means all. |
| `fromSeason` | First season to include. |
| `toSeason` | Last season. Empty means the latest available. |
| `maxGames` | Stop after this many. `0` removes the cap. |

```json
{
  "teams": [],
  "fromSeason": 2022,
  "maxGames": 1000
}
```

### Sample output

One record, trimmed to the fields shown in the table view:

```json
{
  "date": "2022-04-07",
  "season": 2022,
  "game_type": "regular_season",
  "away_team": "HOU",
  "home_team": "ANA",
  "away_score": 3,
  "home_score": 1,
  "winner": "away",
  "innings": 9,
  "park_id": "ANA01",
  "attendance": 44723,
  "away_hits": 8,
  "home_hits": 4,
  "winning_pitcher_name": "Framber Valdez",
  "issues": ""
}
```

### Pricing

| Event | Per 1,000 | Notes |
|---|---|---|
| Game | $0.20 | One charge per game returned |

The complete archive, all 235,611 games, is $47.12. There is no start fee and no
per-row dataset fee.

### What it does not do

**No play-by-play.** This is the game level: one row per game. Pitch-by-pitch
data is a separate Actor.

**Early games are thin.** `issues` marks `missing_box_score` on games where only
the result survives. Almost all of those are before 1903.

**Player identifiers are Retrosheet's.** `winning_pitcher_id` is a Retrosheet
player code, not an MLBAM id. Joining to other sources requires a crosswalk.

**The current season is incomplete until it ends.** Retrosheet publishes a
season once it is finished. Games played this week are not here.

### Notes

Requesting only seasons inside the built-in archive does no network work at all,
so the run cannot be slowed by somebody else's server.

Filtering by `teams` also reduces the live half: only games involving those
teams are fetched.

`issues` is the cheapest quality filter available. Filtering out
`missing_box_score` leaves the games with a full box score.

`game_id` is Retrosheet's own identifier, so this table joins directly onto
Retrosheet play-by-play data.

### Support

Open the **Issues** tab with the `game_id` and the field that looks wrong.

### Licence and attribution

The information used here was obtained free of charge from and is copyrighted by
Retrosheet. Interested parties may contact Retrosheet at "www.retrosheet.org".

Retrosheet permits commercial use explicitly, including selling products based
on the data, on the single condition that the notice above appears prominently.
Every row carries the licence, and every run records it in the run summary.

# Actor input Schema

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

Which teams to include, by their Retrosheet code. A game is returned if either side matches. Leave empty for every team, including the ones that folded — the archive goes back to 1871.

## `fromSeason` (type: `integer`):

First season to include. The archive starts in 1871. The default is a recent season so a first run shows complete box scores — before 1903 most games carry only the result.

## `toSeason` (type: `integer`):

Last season to include. Leave empty for the last season in the archive.

## `maxGames` (type: `integer`):

Stop after this many games. **0 returns everything.** The default keeps a first run small, fast and cheap: without it, pressing Start unchanged would pull the entire archive and bill you for all of it.

## Actor input object example

```json
{
  "teams": [],
  "fromSeason": 2022,
  "maxGames": 1000
}
```

# Actor output Schema

## `games` (type: `string`):

No description

## `summary` (type: `string`):

No description

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("sourcerow/mlb-boxscore-history").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("sourcerow/mlb-boxscore-history").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 '{}' |
apify call sourcerow/mlb-boxscore-history --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,sourcerow/mlb-boxscore-history"
        }
    }
}

```

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/HMfUeAcesW2ECZRq3/builds/wzTQ4uE6bVYKztWWo/openapi.json
