# MLB Stats Scraper — Standings, Schedules & Player Stats (`northbell/mlb-stats-scraper`) Actor

MLB (mlb.com) standings, schedules and results, team and player season stats and league leaders from MLB's own stats API, one clean row each. Run it again or on a schedule to see rank changes, games that changed status or score, and stat movement since the last run. No login.

- **URL**: https://apify.com/northbell/mlb-stats-scraper.md
- **Developed by:** [Northbell](https://apify.com/northbell) (community)
- **Categories:** Sports, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.40 / 1,000 stats rows

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

## MLB Stats Scraper — Standings, Schedules & Player Stats

Pick what you want — **standings, schedules and results, team stats, player stats or league leaders** — and get one clean row per team, game, player or leader, straight from MLB's own stats API: **record, games back, streak, run differential, score, status, probable pitchers, batting and pitching lines, ranks**. **$0.50 per 1,000 rows**, no login, no API key.

Run it again, or put it on a schedule, and every row also tells you **what changed since the last run**: standings teams that moved up or down (`rankChange`, positive means moved up), games that went from scheduled to live to final (`statusChanged`, `scoreChanged`), new games (`isNew`), and for stats and leaders the change in OPS, ERA, rank and value. MLB's API gives the numbers as they are now; the movement since your last look comes from your own runs.

### What you get

Every row has `type` (`standing`, `game`, `team-stats`, `player-stats`, `leader` or `error`) and `observedAt`.

**Standings** (`"mode": "standings"`)

| Field | What it is |
|---|---|
| `season`, `league`, `division`, `team`, `teamAbbreviation`, `teamId` | the team and its division |
| `rank`, `leagueRank`, `overallRank`, `wildCardRank` | MLB's own order: place in the division, in the league, among all 30 teams, and in the wild-card race (`null` for division leaders) |
| `wins`, `losses`, `record`, `pct`, `gamesPlayed` | the record (`98-64`), winning percentage as a number (`0.605`) and games played |
| `gamesBack`, `wildCardGamesBack` | games behind the division leader (`0` for the leader); and the wild-card gap as text, exactly as MLB shows it: `+3.0` for a team inside the wild-card places, `4.5` for a team outside, `null` for division leaders and for the team holding the last place |
| `streak`, `lastTen`, `homeRecord`, `awayRecord` | `W4`, `7-3`, `55-26`, `43-38` |
| `runsScored`, `runsAllowed`, `runDifferential` | runs for and against |
| `clinchIndicator`, `divisionChamp`, `magicNumber`, `eliminationNumber`, `wildCardEliminationNumber`, `eliminated` | MLB's clinch letter (`x`, `y`, `z`, `w`), whether the team is its division's champion (true only for a team MLB flags and ranks first in its division: MLB's own flag was also true for a second-place wild-card team on the 2026-10-08 table), the division magic and elimination numbers, the wild-card elimination number, and `true` when MLB marks the team out of both races |
| `previousRank`, `rankChange`, `previousRecord`, `gamesSinceLastRun` | the change since your previous run (`null` on the first run) |

**Games** (`"mode": "schedule"`)

| Field | What it is |
|---|---|
| `gamePk`, `url` | MLB's game id and the mlb.com Gameday page |
| `date`, `gameDay` | the start time (ISO, UTC) and the MLB day the game is listed under (US Eastern, `YYYY-MM-DD`) |
| `rescheduledTo`, `rescheduledFrom` | for a postponed game, the day it was moved to; for the makeup game, the day it was moved from (otherwise `null`) |
| `gameType`, `gameTypeCode`, `series`, `seriesGameNumber`, `gamesInSeries`, `note` | `regular season`, `wild card`, `division series`, `league championship series`, `world series`, `spring training`, `exhibition` or `all-star game`; the series (`NL Division Series`), the game's place in it, and MLB's note such as `NLDS 'B' Game 3` |
| `status`, `statusDetail`, `statusReason` | `scheduled`, `in progress`, `final`, `delayed`, `postponed`, `suspended` or `canceled`; MLB's own wording (`Final`, `Completed Early`, `Postponed`); and the reason when MLB gives one (`Rain`, `Inclement Weather`, `Tied`) |
| `away`, `home` (+ `Abbreviation`, `Id`, `Score`, `Record`) | each side: team name, abbreviation, id, runs (`null` before the game) and its record |
| `winner` | the winning team's name, `tie` for a game that ended level (spring training), `null` otherwise |
| `inning`, `inningState` | `inning` is the current inning while a game is live and the number of innings played once it is final; `inningState` (`Top`, `Middle`, `Bottom`, `End`) only while live |
| `awayHits`, `homeHits`, `awayErrors`, `homeErrors` | the hits and errors line, once the game has started |
| `venue`, `dayNight`, `doubleHeader`, `gameNumber` | where and when it is played; `gameNumber` is 1 or 2 in a doubleheader |
| `awayProbablePitcher`, `homeProbablePitcher`, `winningPitcher`, `losingPitcher`, `savePitcher` | the probable starters as MLB lists them, and the pitchers of record for a final game |
| `awayInningRuns`, `homeInningRuns` | runs scored in each inning once the game has started, first inning first (a half inning not played, like the home 9th of a home win, is `null`) |
| `outs`, `balls`, `strikes` | the count while a game is live; `null` otherwise |
| `isNew`, `previousStatus`, `statusChanged`, `previousHomeScore`, `previousAwayScore`, `scoreChanged` | the change since your previous run (`null` on the first run) |

**Team stats** (`"mode": "teamStats"`) — one row per team: `gamesPlayed`, `wins`, `losses`; batting `runsScored`, `hits`, `doubles`, `triples`, `homeRuns`, `rbi`, `walks`, `battingStrikeouts`, `stolenBases`, `battingAverage`, `onBasePercentage`, `sluggingPercentage`, `ops`; pitching `era`, `whip`, `inningsPitched`, `runsAllowed`, `earnedRuns`, `pitchingStrikeouts`, `walksAllowed`, `homeRunsAllowed`, `saves`, `strikeoutsPer9`; fielding `errors`, `fieldingPercentage`; and `opsRank` and `eraRank` (1 is best, among the teams in the answer). Change since the last run: `previousOps`, `opsChange`, `previousEra`, `eraChange`, `gamesSinceLastRun`.

**Player stats** (`"mode": "playerStats"`) — one row per player and side (`group`: `hitting` or `pitching`): `player`, `playerId`, `team`, `teamAbbreviation`, `position`, `numTeams`, `gamesPlayed`. Hitting rows add `plateAppearances`, `atBats`, `runs`, `hits`, `doubles`, `triples`, `homeRuns`, `rbi`, `walks`, `strikeouts`, `stolenBases`, `battingAverage`, `onBasePercentage`, `sluggingPercentage`, `ops`. Pitching rows add `gamesStarted`, `wins`, `losses`, `saves`, `holds`, `inningsPitched`, `outsPitched`, `strikeouts`, `walks`, `hitsAllowed`, `homeRunsAllowed`, `earnedRuns`, `era`, `whip`, `strikeoutsPer9`. Change since the last run: `previousOps` and `opsChange` for hitters, `previousEra` and `eraChange` for pitchers, and `gamesSinceLastRun`.

**Leaders** (`"mode": "leaders"`) — one row per place in each category: `group`, `category`, `rank`, `player`, `playerId`, `team`, `teamAbbreviation`, `value` (a number) and `valueText` (as MLB writes it, `.316`). Change since the last run: `isNew` (entered the list), `previousRank`, `rankChange`, `previousValue`, `valueChange`.

### Use it for

- **Fantasy, newsletters and sports apps**: a clean feed of today's games, yesterday's finals and the league table instead of parsing web pages
- **Score and status alerts**: poll a day's games and react when `scoreChanged` or `statusChanged` is `true`
- **Race trackers**: wild-card gaps, magic numbers and who moved up or down since yesterday
- **Analysis and models**: team and player season lines, one row each, with OPS and ERA ranks, in a sheet or a database
- **Leaderboards**: home runs, batting average, ERA, strikeouts, saves or any of 49 categories, with the movement since last time

### Input

Today's standings (the default):

```json
{ "mode": "standings" }
```

Games for a range of days, for two teams:

```json
{ "mode": "schedule", "dates": "2026-10-06 to 2026-10-09", "teams": ["NYY", "LAD"] }
```

Season stats of the qualified players, or of every player on a team:

```json
{ "mode": "playerStats", "playerGroup": "hitting" }
{ "mode": "playerStats", "teams": ["Yankees"], "playerPool": "all" }
```

League leaders, postseason only:

```json
{ "mode": "leaders", "categories": ["homeRuns", "RBI", "ERA", "saves"], "leadersPerCategory": 5, "gameType": "postseason" }
```

Leave **Season** empty for the current season (before opening day, the last finished one). **Dates** is for schedule mode: a day, a range up to 366 days, or `today`, `yesterday`, `tomorrow`, `today+3`; empty means today. In standings mode **Dates** takes one day and gives the table as it stood on that day. **Teams** keeps only these teams (abbreviation, team name or full name).

What the Actor remembers (to show the change since the last run) is kept in a named key-value store in your Apify account, so the second run already shows changes. Schedule it (Apify → Schedules) to follow live games or a daily table.

### Pricing

**$0.50 per 1,000 rows**, plus $0.01 per run. A row is one team, game, player or leader. Error rows (a team name that matches nothing, a request MLB refused) are free. The $0.01 run-start fee is the one charge every run pays, even one that returns nothing.

For scale, measured on 2026-10-08: the standings and the team stats are 30 rows each ($0.015); one team's 2026 regular season is 162 game rows; the 91 days from April to June 2026 had 1,215 games, about 13 a day (July 4, 2026 had 15); the default league leaders (4 categories, 10 places) came to 41 rows; the qualified players of the 2026 regular season are 181 rows (135 hitters and 46 pitchers, about $0.09), and every player with an appearance is 1,619 rows (751 hitters and 868 pitchers, about $0.81). Set a maximum charge on the run to cap the cost of big requests.

### Notes

- **Public data only.** The Actor reads MLB's public stats API (statsapi.mlb.com). It is not affiliated with or endorsed by Major League Baseball or any club, and MLB can change this API without notice. MLB's answers carry MLB Advanced Media's copyright notice; check its terms for how you may use the data. The rows hold numbers and facts only (records, scores, stat lines, names); no logos, photos, video or article text are taken.
- **Days are US Eastern time.** A game that starts at 22:30 ET on Oct 8 belongs to Oct 8 (`gameDay`) even though it is Oct 9 in UTC, Europe and Asia; `date` is the exact start in UTC. Empty dates mean today in US Eastern time. There is no country or language setting. A day with no games returns no rows (the run log says so).
- **Schedule mode returns every kind of game in the dates**, so a February-to-March range includes spring training and exhibition games (`gameType` says which). A range is read in 14-day pieces, one request each. Postponed and cancelled games are rows too (`status`, `statusReason`). MLB lists a postponed game under its original day and again under its makeup day with the same `gamePk`; you get one row per `gamePk`, the latest listing inside your dates, so a range that holds only the original day returns the `postponed` row with `rescheduledTo`.
- **Standings** are the regular season and take MLB's own order, so tiebreakers are already applied. After the regular season ends they show the final table. `magicNumber`, `eliminationNumber` and `wildCardEliminationNumber` are filled only while a race is still open and are `null` once it is decided (every team on the 2026-10-08 table has them `null`; a look-back to 2026-09-20 had several filled). A look-back date (`Dates`) does not read or change what the Actor remembers about the live table.
- **Team stats ranks.** `opsRank` and `eraRank` are computed over the teams in MLB's answer before your `Teams` filter: all 30 in the regular season, only the clubs that have played in the postseason (12 on 2026-10-08).
- **Player stats.** Rows are ordered by plate appearances (hitters) or innings pitched (pitchers). With no teams listed, *Automatic* returns the qualified players of the league (enough plate appearances or innings to be eligible for the batting and ERA titles); with teams listed it returns everyone whose club at the end of the season (or today, in the current season) is one of those teams and who has a stat line. With no teams listed, a player who played for more than one club has one line with the season totals, `numTeams` above 1 and the club MLB lists on it. With teams listed, a player is listed under his last club only and the line holds only that club's games, `numTeams` 1 (checked live on the 2025 season: a player traded to the Cubs had 120 games in the league-wide list and 34 in the Cubs list; a player traded away from Arizona was not in the Arizona list at all). The hitting lines of *All players* (and of a team list) also include pitchers who batted (`position` P). `inningsPitched` is written the baseball way: `214.2` is 214 and two thirds innings (`outsPitched` is the same figure in outs). Only the stat line is returned for a player: no age, birth date or home town.
- **Leaders.** Categories are the ones MLB lists, for example `homeRuns`, `battingAverage`, `onBasePlusSlugging`, `runsBattedIn`, `stolenBases`, `earnedRunAverage`, `walksAndHitsPerInningPitched`, `strikeouts`, `saves`, `wins`, `holds`; short names (`HR`, `AVG`, `OPS`, `RBI`, `ERA`, `WHIP`, `SB`) work too. A name that exists for both batters and pitchers goes to the batters (`homeRuns`, `walks`, `hits`, `runs`) except `strikeouts`, which goes to pitchers; write `hitting:strikeouts` or `pitching:homeRuns` to choose. Players tied at the last place are all returned, so a category can give a few more rows than you asked for. Rate stats (`battingAverage`, `earnedRunAverage`) list qualified players only. With **Teams** listed you get the leaders of each team (the rank is inside that team), one request per team; a rate stat such as `earnedRunAverage` can then return fewer rows than you asked for, because few pitchers of one club qualify (one LAD pitcher in the 2025 list). If MLB has no numbers for the season you ask for, the run returns no rows and says so in the log.
- **Regular season or postseason.** Team stats, player stats and leaders take the regular season by default; *Postseason* returns the postseason games only. In the middle of the postseason the lists are short and small samples lead the rate stats (several pitchers can share a 0.00 ERA).
- **Fields that are only filled in some cases:** `statusReason` (when MLB gives one: a postponement, a game ended early, a tie), `rescheduledTo` / `rescheduledFrom` (postponed games and their makeup games), `inningState` (live games), `inning`, the scores, hits, errors and `winner` (once the game has started or ended), `winningPitcher` and `losingPitcher` (final games; none for a tie), `savePitcher` (only when there was a save), `note` (postseason and special games), `awayAbbreviation` and `homeAbbreviation` (not set for teams outside MLB in exhibition games), `wildCardRank`, `wildCardGamesBack` and the elimination numbers (see above). Missing values are `null`, never a guess.
- **Since the last run** compares with your previous run of the same mode and season. Standings: the table of the last run that included the team. Games: a game stays remembered for 21 days after you last got it, so a team's schedule keeps its old results; on the first run every change field is `null`, from the second `isNew` is `true` for a game not seen before and `false` for one you had, and `statusChanged` / `scoreChanged` stay `null` for a new game. Players, team stats and leaders keep the last values of each player, team or place; running with different teams each time simply remembers each of them from the last time it appeared. Player lines of a run with **Teams** are remembered per club, apart from the league-wide totals, so a stint is never compared with a total. If you run with different dates each time the games are different each time, so the change fields mostly stay empty: to follow live games, run it several times on the same day with the same dates.

To follow NFL, NBA, NHL, college sports and soccer too, see [ESPN Scores Scraper](https://apify.com/northbell/espn-scores-scraper).

### For AI agents

`{"mode": "standings"}` returns 30 `standing` rows with `division`, `rank`, `record`, `gamesBack`, `streak`, `runDifferential`. `{"mode": "schedule", "dates": "2026-10-08"}` returns the `game` rows of that day: `status`, `away`, `home`, `awayScore`, `homeScore`, `venue`, `awayProbablePitcher`, `homeProbablePitcher`. `{"mode": "leaders", "categories": ["homeRuns"], "leadersPerCategory": 5}` returns `leader` rows with `rank`, `player`, `team`, `value`. Rows have `type`: `standing`, `game`, `team-stats`, `player-stats`, `leader` or `error`; error rows carry `step` and `message` and are free.

# Actor input Schema

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

Standings: one row per team (division, record, games back, streak, run differential). Schedule: one row per game (score, status, venue, probable and deciding pitchers). Team stats: one row per team (batting, pitching, fielding). Player stats: one row per player. Leaders: the top players for each category you list.

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

The year, for example 2025. Leave empty for the current season (before opening day, the last finished one). Used by standings, team stats, player stats and leaders. Schedule mode uses Dates instead.

## `dates` (type: `string`):

Schedule mode: a day (2026-10-08), a range (2026-10-06 to 2026-10-09, up to 366 days) or today, yesterday, tomorrow, today+3. Empty means today (US Eastern time, the way MLB counts days). Standings mode: one day, to get the table as it stood on that day. Ignored by the other modes.

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

Optional. Keep only these teams, one per line: an abbreviation (NYY, LAD), a team name (Yankees) or a full name (New York Yankees). Empty means all 30 teams. Leaders mode returns the leaders of each listed team instead of the league.

## `categories` (type: `array`):

Leaders mode: one category per line, such as homeRuns, battingAverage, runsBattedIn, stolenBases, earnedRunAverage, strikeouts, saves, wins. Short names like HR, AVG, RBI, ERA and WHIP work too. Strikeouts means pitcher strikeouts; write hitting:strikeouts for batter strikeouts.

## `leadersPerCategory` (type: `integer`):

How many places to return for each category (1 to 50). Players tied at the last place are all returned, so a category can give a few more rows.

## `playerGroup` (type: `string`):

Player stats mode: hitting lines, pitching lines or both. A player who bats and pitches appears once in each.

## `playerPool` (type: `string`):

Automatic: the qualified players of the league (enough plate appearances or innings to lead the rate stats), or everyone on the teams you list. Qualified: only those players. All: every player with at least one appearance.

## `gameType` (type: `string`):

For team stats, player stats and leaders: the regular season, or the postseason games only. Standings are always the regular season. Schedule mode returns every kind of game in the dates you give.

## Actor input object example

```json
{
  "mode": "standings",
  "categories": [
    "homeRuns",
    "battingAverage",
    "earnedRunAverage",
    "strikeouts"
  ],
  "leadersPerCategory": 10,
  "playerGroup": "both",
  "playerPool": "auto",
  "gameType": "regular"
}
```

# Actor output Schema

## `standings` (type: `string`):

One row per team: division, record, games back, streak and rank change since the last run.

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

One row per game: status, score, venue, pitchers and what changed since the last run.

## `teams` (type: `string`):

One row per team: batting, pitching and fielding totals with OPS and ERA ranks.

## `players` (type: `string`):

One row per player: batting or pitching season line.

## `leaders` (type: `string`):

The top players of each category with rank change since the last run.

# 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 = {
    "categories": [
        "homeRuns",
        "battingAverage",
        "earnedRunAverage",
        "strikeouts"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("northbell/mlb-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 = { "categories": [
        "homeRuns",
        "battingAverage",
        "earnedRunAverage",
        "strikeouts",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("northbell/mlb-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 '{
  "categories": [
    "homeRuns",
    "battingAverage",
    "earnedRunAverage",
    "strikeouts"
  ]
}' |
apify call northbell/mlb-stats-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,northbell/mlb-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/ZEepcp7xCW8LIpjdx/builds/UTyrBff8u4rUynwET/openapi.json
