# MLB Stats Scraper | Game Logs, Statcast Pitches, Lineups (`zen-studio/mlb-stats-scraper`) Actor

Scrape MLB stats in bulk: every player's game log, daily slates with probable pitchers, lineups, weather and umpires, pitch-by-pitch Statcast with all columns, season stats with WAR, wRC+ and splits, rosters with injured list, standings. MLB and minor leagues, back to 1901.

- **URL**: https://apify.com/zen-studio/mlb-stats-scraper.md
- **Developed by:** [Zen Studio](https://apify.com/zen-studio) (community)
- **Categories:** Sports, Developer tools, Integrations
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.79 / 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.
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

[![Every player's game line, in bulk. 58,380 player game lines in one run.](https://api.apify.com/v2/key-value-stores/pJ7iaZsTFhR3k9tjV/records/mlb-stats-scraper-hero.jpg)](https://console.apify.com/actors/IrNhPyQscsb9etFaE/input)

From <strong>Zen Studio</strong>, creators of <a href="https://apify.com/zen-studio/prizepicks-player-props">PrizePicks Player Props</a> and <a href="https://apify.com/zen-studio/draftkings-odds">DraftKings Odds</a>, with <strong>35,000+ combined runs</strong>. Established sports-data tools for odds, player props and research.

### Why choose this actor?

<strong>58,380 player game lines in one run.</strong> Collect batting and pitching game logs across a date range or season. Get player names, teams, opponents and game-level stats as structured rows, ready for analysis and model training.

<strong>46 data types, including the detail behind the box score.</strong> Choose pitch-by-pitch tracking with velocity, spin and bat speed; season stats with WAR and wRC+; player splits; or daily games with probable pitchers, lineups, weather and umpires. Odds and player props are available too.

<strong>Follow players across games and seasons.</strong> Filter by player name, team or league level. Consistent player and game identifiers connect the actor’s game logs, pitches and season records. Supported modes also cover minor-league baseball.

**[Get player game logs](https://console.apify.com/actors/IrNhPyQscsb9etFaE/input)**

### Quick start

Try 50 player game lines from a completed day. Remove maxResults for the full selection, set a date range, or use seasons instead of dates for a season-wide export.

```json
{
  "mode": "playerGames",
  "startDate": "2026-09-14",
  "maxResults": 50
}
```

<a href="https://console.apify.com/actors/IrNhPyQscsb9etFaE/input">Open actor input</a> to select the data type, dates and teams. Export JSON, CSV or Excel.

Available detail varies by season, league and record type. Statcast measurements are added after games, not live. Odds, props and Statcast leaderboards are MLB-only.

<table><tr><td colspan="5" style="background:#D7263D;color:#FFFFFF;padding:10px 14px;font-size:13px;font-weight:700">Zen Studio · Sports Data</td></tr><tr><td style="background:#F5CFD5;padding:8px 10px;border:1px solid #EBC1C9;vertical-align:top"><span style="white-space:nowrap"><img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-IrNhPyQscsb9etFaE-Zkfh6wBrCS-mlb-stats-scraper-icon.png" width="20" height="20" alt="" style="display:inline-block;vertical-align:middle;margin:0"/>&nbsp;<a href="https://apify.com/zen-studio/mlb-stats-scraper" style="color:#461D24;text-decoration:none;font-weight:700;font-size:13px">MLB Stats</a></span><br><span style="color:#65313C;font-size:12px;white-space:nowrap">You are here</span></td><td style="background:#FCE7EB;padding:8px 10px;border:1px solid #EBC1C9;vertical-align:top"><span style="white-space:nowrap"><img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-4AmgQeem8dEgMEiRF-VGffbe665M-prizepicks-scraper-logo.jpeg" width="20" height="20" alt="" style="display:inline-block;vertical-align:middle;margin:0"/>&nbsp;<a href="https://apify.com/zen-studio/prizepicks-player-props" style="color:#461D24;text-decoration:none;font-weight:700;font-size:13px">PrizePicks</a></span><br><span style="color:#65313C;font-size:12px;white-space:nowrap">Player prop lines</span></td><td style="background:#FCE7EB;padding:8px 10px;border:1px solid #EBC1C9;vertical-align:top"><span style="white-space:nowrap"><img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-W8rOXiLSj8wrgF96k-PQehXxTEV5-draftkings-real-time-api-logo.png" width="20" height="20" alt="" style="display:inline-block;vertical-align:middle;margin:0"/>&nbsp;<a href="https://apify.com/zen-studio/draftkings-odds" style="color:#461D24;text-decoration:none;font-weight:700;font-size:13px">DraftKings</a></span><br><span style="color:#65313C;font-size:12px;white-space:nowrap">Odds & props</span></td><td style="background:#FCE7EB;padding:8px 10px;border:1px solid #EBC1C9;vertical-align:top"><span style="white-space:nowrap"><img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-vZGwNIMCrwkjp76uR-6jWYFxsPSD-sleeper-fantasy-api-logo.jpg" width="20" height="20" alt="" style="display:inline-block;vertical-align:middle;margin:0"/>&nbsp;<a href="https://apify.com/zen-studio/sleeper-player-props" style="color:#461D24;text-decoration:none;font-weight:700;font-size:13px">Sleeper</a></span><br><span style="color:#65313C;font-size:12px;white-space:nowrap">Picks & multipliers</span></td><td style="background:#FCE7EB;padding:8px 10px;border:1px solid #EBC1C9;vertical-align:top"><span style="white-space:nowrap"><img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-l6JP3yaLczAdUaiSf-yDHq17ycGp-bet365-icon_lc6m4t.png" width="20" height="20" alt="" style="display:inline-block;vertical-align:middle;margin:0"/>&nbsp;<a href="https://apify.com/zen-studio/bet365-real-time-odds" style="color:#461D24;text-decoration:none;font-weight:700;font-size:13px">Bet365</a></span><br><span style="color:#65313C;font-size:12px;white-space:nowrap">Live & pre-match</span></td></tr></table>

#### Copy to your AI assistant

Copy this block into ChatGPT, Claude, Cursor, or any LLM to start using this actor.

```
zen-studio/mlb-stats-scraper on Apify. MLB and minor-league baseball data, 46 record types, one per run.
Call: ApifyClient("TOKEN").actor("zen-studio/mlb-stats-scraper").call(run_input={...}), then
client.dataset(run["defaultDatasetId"]).list_items().items for rows.

mode (string, required in practice, prefilled "games") picks the record type. Date-addressed modes use
startDate/endDate (YYYY-MM-DD; empty = today): games, playerGames, teamGames, inningLines, plateAppearances,
pitchEvents, runnerMovements, gameOdds, playerProps, lineMovement, transactions, highlights. Every other mode
uses seasons (string[] of years, empty = current season): playerSeasons, playerSplits, fieldingSeasons,
rosters, standings, teams, venues, teamHistory, seasonCalendar, leaders, gameHighLows, staff, homeRunDerby,
players, draft, draftProspects, prospectRankings, freeAgents, awards, milestones, injuries, futures,
playoffOdds, teamBettingRecords, statcastBatting, statcastPitching, statcastFielding, statcastCatching,
statcastRunning, statcastTeams, pitchTypes, rollingForm, parkFactors, absChallenges.

Common inputs: level (string, "mlb" default; also aaa, aa, high_a, single_a, rookie, winter, other_minors,
college, independent, international, negro_leagues), teams (string[], names/abbreviations/ids), players
(string[], names or ids), gameTypes (string[], R regular, F wildcard, D division, L league, W world series,
S spring, E exhibition, A all-star), maxResults (integer).

Dependencies that decide what you get:
- Dates outrank seasons on date-addressed modes. Set one or the other, not both.
- players only applies to player-level modes: playerGames, playerSeasons, playerSplits, fieldingSeasons,
  rosters, pitchEvents, plateAppearances, runnerMovements, players, transactions, draft, draftProspects,
  prospectRankings, freeAgents, awards, milestones, leaders, gameHighLows, staff, highlights, homeRunDerby,
  injuries, playerProps, futures and the Statcast player boards. On games, teamGames, standings, venues or
  odds-by-game it is refused with a message naming the modes that do accept it, not silently ignored.
- Statcast leaderboards, all odds/props modes and injuries are Major League Baseball only. Another level is
  refused, not returned empty.
- pitchEvents has includeStatcast (boolean, prefilled true) to attach Statcast columns to each pitch, and
  pitchEventTypes to restrict to pitches, pickoffs, step-offs, automatic calls or in-game actions.
- playerSeasons/playerSplits take statGroups (hitting, pitching) and splitCodes (600+ situation codes).
  Fielding season lines are their own mode, fieldingSeasons.
- transactions treats a season as the calendar year, because moves happen all winter.
- Statcast is not published while a game is in progress: live pitches arrive with has_statcast false and null
  measurement columns, filling in after the game is final.

Every row carries record_type, the MLB player_id and/or team_id, and game_pk where a game applies, so rows
join to each other and to zen-studio's odds and props actors.

Row types bill at different rates per 1,000 rows; the current figures are on the actor's pricing panel.
Set maxTotalChargeUsd on a run to cap spend: the run stops cleanly at the cap rather than over-delivering.

Full input schema: https://apify.com/zen-studio/mlb-stats-scraper/input-schema
```

### What you can collect

Pick one record type per run with the **What to collect** setting. All forty-six
are below, grouped by what they describe.

#### Games and players

| Record type | One row is | Addressed by |
|---|---|---|
| `games` | A game, with probable pitchers, lineups, weather, umpire crew, venue geometry, series context and attendance | Dates |
| `playerGames` | A player's batting or pitching line for one game, with batting order and position | Dates |
| `teamGames` | A team's totals for one game | Dates |
| `playerSeasons` | A player's season line, with sabermetrics, expected stats and WAR | Seasons |
| `playerSplits` | A player's season split: versus left, versus right, home, away and 600 more situations | Seasons |
| `fieldingSeasons` | A player's fielding season, per position | Seasons |
| `rosters` | A player on a team roster, with injured-list status | Seasons |
| `standings` | A team's standing, with games back, wild card, streak and run differential | Seasons |
| `teams`, `venues`, `teamHistory`, `seasonCalendar` | Reference data | Seasons |

#### Pitch and play level

| Record type | One row is | Addressed by |
|---|---|---|
| `pitchEvents` | A pitch, pickoff, step-off, automatic call or in-game action, with tracking and Statcast measurements | Dates |
| `plateAppearances` | A plate appearance, with result, count, score and runners | Dates |
| `runnerMovements` | One runner moving on one play | Dates |
| `inningLines` | A team's line for one inning | Dates |

#### Statcast leaderboards

`statcastBatting`, `statcastPitching`, `statcastFielding`, `statcastCatching`,
`statcastRunning`, `statcastTeams`, `pitchTypes`, `rollingForm` and `parkFactors`.
Expected stats, barrels, sprint speed, arm strength, framing, pitch arsenals and
park factors.

`absChallenges` sits alongside them: automatic ball-strike challenges, for Major
League Baseball and Triple-A.

#### Odds and props

`gameOdds`, `playerProps`, `lineMovement`, `futures`, `playoffOdds`,
`teamBettingRecords` and `injuries`, each joined back to the MLB game, team and
player ids so they line up with the stat records.

#### People and league

`players`, `transactions`, `draft`, `draftProspects`, `prospectRankings`,
`freeAgents`, `awards`, `milestones`, `leaders`, `gameHighLows`, `staff`,
`homeRunDerby` and `highlights`.

### How to scrape MLB stats

The opening shows the smallest useful run. From there, a date range for one team:

```json
{
  "mode": "playerGames",
  "startDate": "2026-08-01",
  "endDate": "2026-08-31",
  "teams": ["NYY"]
}
```

A whole season of pitch-by-pitch Statcast:

```json
{
  "mode": "pitchEvents",
  "seasons": ["2026"]
}
```

Triple-A instead of the majors:

```json
{
  "mode": "games",
  "startDate": "2026-08-12",
  "level": "aaa"
}
```

#### Main settings

| Setting | Type | Meaning |
|---|---|---|
| `mode` | string | Which record type to collect. One per run |
| `startDate`, `endDate` | date | For date-addressed types. Leave both empty for today |
| `seasons` | array | Years, for season-addressed types. Takes second place to dates |
| `level` | string | MLB, Triple-A down to Rookie, winter, college, independent, international or the Negro Leagues |
| `teams` | array | Team names, abbreviations or ids |
| `players` | array | Player names or ids. Only for player-level record types |
| `gameTypes` | array | Regular season, postseason rounds, spring training, All-Star |
| `maxResults` | integer | Stop after this many rows |

Record types have their own extra settings, such as the stat groups on season
lines, the situations on splits, the roster type, the event types on pitch
events, and the sportsbooks and prop markets on odds. They appear in the Input
tab under the record type that uses them.

### What data you get

One `playerGames` row, captured from a real run. The `season_*` block is omitted
below for length: it repeats the same `batting_*`, `pitching_*` and `fielding_*`
keys with the player's season-to-date totals, 111 further fields, so this batting
row is 194 fields in all. A pitching row swaps the `batting_*` block for 54
`pitching_*` keys and runs to about 215.

```json
{
  "record_type": "player_game",
  "game_pk": 823244,
  "official_date": "2026-03-25",
  "game_date": "2026-03-26T00:05:00Z",
  "season": 2026,
  "game_type": "R",
  "double_header": "N",
  "game_number": 1,
  "day_night": "night",
  "venue_id": 2395,
  "venue_name": "Oracle Park",
  "status_detailed_state": "Final",
  "team_id": 147,
  "team_name": "New York Yankees",
  "team_abbreviation": "NYY",
  "opponent_id": 137,
  "opponent_name": "San Francisco Giants",
  "opponent_abbreviation": "SF",
  "is_home": false,
  "player_id": 676609,
  "player_name": "José Caballero",
  "boxscore_name": "Caballero",
  "jersey_number": "72",
  "position_code": "6",
  "position_name": "Shortstop",
  "position_type": "Infielder",
  "position_abbreviation": "SS",
  "all_positions": [
    "SS"
  ],
  "roster_status_code": "A",
  "roster_status_description": "Active",
  "parent_team_id": 147,
  "game_status_is_current_batter": false,
  "game_status_is_current_pitcher": false,
  "game_status_is_on_bench": false,
  "game_status_is_substitute": false,
  "batting_order_code": "700",
  "batting_order_slot": 7,
  "is_starting_batter": true,
  "pitching_order": null,
  "is_starting_pitcher": false,
  "batting_summary": "1-4 | RBI, R",
  "batting_games_played": 1,
  "batting_fly_outs": 0,
  "batting_ground_outs": 2,
  "batting_air_outs": 1,
  "batting_runs": 1,
  "batting_doubles": 0,
  "batting_triples": 0,
  "batting_home_runs": 0,
  "batting_strike_outs": 0,
  "batting_base_on_balls": 0,
  "batting_intentional_walks": 0,
  "batting_hits": 1,
  "batting_hit_by_pitch": 0,
  "batting_at_bats": 4,
  "batting_caught_stealing": 0,
  "batting_stolen_bases": 0,
  "batting_stolen_base_percentage": null,
  "batting_ground_into_double_play": 1,
  "batting_ground_into_triple_play": 0,
  "batting_plate_appearances": 4,
  "batting_total_bases": 1,
  "batting_rbi": 1,
  "batting_left_on_base": 3,
  "batting_sac_bunts": 0,
  "batting_sac_flies": 0,
  "batting_catchers_interference": 0,
  "batting_pickoffs": 0,
  "batting_at_bats_per_home_run": null,
  "batting_pop_outs": 1,
  "batting_line_outs": 0,
  "fielding_games_started": 1,
  "fielding_caught_stealing": 0,
  "fielding_stolen_bases": 0,
  "fielding_stolen_base_percentage": null,
  "fielding_caught_stealing_percentage": null,
  "fielding_assists": 4,
  "fielding_put_outs": 0,
  "fielding_errors": 1,
  "fielding_chances": 5,
  "fielding_fielding": 0,
  "fielding_passed_ball": 0,
  "fielding_pickoffs": 0
}
```

Pitching lines carry `pitching_*` keys in the same shape, 54 of them, including
innings, earned runs, strikeouts, pitch counts, strikes and inherited runners. A
row always carries both the game context and the player context, so the file is
usable without joining anything else. Use JSON or JSONL to keep nested fields
such as `all_positions`; CSV flattens them.

### Coverage and limits

- **History runs deep but unevenly.** Plays exist from 1950, full pitch
  sequences from 1988, pitch tracking from 2008, exit velocity and launch angle
  from 2015, induced break and extension from 2017, arm angle from 2023, bat
  speed from 2024. Earlier rows carry the columns as nulls rather than dropping
  them.
- **Minor leagues are a first-class level**, from Triple-A to Rookie, plus
  winter, college, independent and international leagues, and the Negro Leagues
  for games, team totals, inning lines, season stats, standings, teams and
  rosters.
- **Statcast leaderboards, every odds and props record type, and injuries are
  Major League Baseball only.** Ask for another level and the actor says so
  rather than finishing with an empty run. `absChallenges` is the exception
  inside that group: it covers Major League Baseball and Triple-A.
- **Live games work for the slate, plays and pitch events.** Statcast is not
  published while a game is in progress, so pitches from a live game arrive with
  `has_statcast` false and their measurement columns null. They fill in once the
  game is final.
- **Out of season a date range is empty, not an error.** The run finishes
  normally and says why.

### FAQ

**Which record type should I pick?**
For prop and fantasy models, `playerGames`. For the day's card, `games`. For
pitch physics, `pitchEvents`. For season-level modelling, `playerSeasons` and
`playerSplits`.

**How far back can I go?**
It depends on the record type; see Coverage above. Season-level records reach
much further back than pitch tracking does.

**Can I get data for a game happening right now?**
Yes for the slate, plate appearances and pitch events. Statcast measurements are
not published for a game in progress, so those columns are null until the game
finishes.

**How do I join this to odds or props?**
Every row carries the MLB player id and game id. The odds record types carry them
too, and so do the sibling actors above.

**Can I filter by player?**
On player-level record types, yes. A game row, team line, standing or venue has
no player to match, so the actor tells you instead of returning nothing.

**What happens if I ask for a date with no games?**
The run finishes successfully with zero rows and explains why.

**Is there a free tier?**
Yes. The Store pricing panel on this page has the current rates for each row
type.

**Something looks wrong.**
Open an issue on the Issues tab with the input you used and what you expected.

### Support

Questions, bugs and requests for extra fields go in the **Issues** tab. We read
every one.

# Actor input Schema

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

One record type per run. Date-based types (games, game logs, box scores, pitch by pitch, play by play, odds, props, transactions, highlights) use the dates below; the rest use seasons.

## `startDate` (type: `string`):

First day to collect for date-based types. Leave dates and seasons empty to get today.

## `endDate` (type: `string`):

Last day to collect. Leave empty for a single day.

## `seasons` (type: `array`):

Years, one per line, for example <b>2026</b>. Leave empty for the current season. Dates, when set, take priority for date-based types.

## `level` (type: `string`):

Major League Baseball, a minor-league level or another league. Leave empty for MLB.

## `gameTypes` (type: `array`):

Leave empty for regular season and postseason. Season tables use the first type selected, regular season by default.

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

Keep only these teams. Names, nicknames or abbreviations: <b>Yankees</b>, <b>NYY</b>, <b>New York Yankees</b>.

## `players` (type: `array`):

Keep only these players, by full name (<b>Aaron Judge</b>) or player id. For pitches, a player matches as pitcher or batter. Only for player-level record types: games, team lines, odds, standings and venues have no player to match, and will say so.

## `pitchEventTypes` (type: `array`):

Which events to return in <b>Pitch events</b> mode. Leave empty for all of them.

## `includeStatcast` (type: `boolean`):

In <b>Pitch events</b> mode, add Statcast measurements (expected stats, run value, bat speed, arm angle and more) to every pitch for MLB, Triple-A and Single-A. Turn off for faster runs with the tracking and call data only.

## `statGroups` (type: `array`):

For player season stats and splits. Leave empty for both.

## `splitCodes` (type: `array`):

Situations for player splits, one per line. Leave empty for <b>vl</b> (vs left-handed), <b>vr</b> (vs right-handed), <b>h</b> (home), <b>a</b> (away), <b>d</b> (day), <b>n</b> (night). Others include <b>g</b> (grass), <b>t</b> (turf), <b>risp</b> (runners in scoring position) and monthly and count situations.

## `fieldingByPosition` (type: `boolean`):

Adds a row for each position a player fielded (C, 1B, 2B, 3B, SS, LF, CF, RF) with outs above average and fielding run value at that position, next to the season total. Takes longer.

## `absLevels` (type: `array`):

ABS challenges mode only. Leave empty for both MLB and Triple-A.

## `absChallengeTypes` (type: `array`):

ABS challenges mode only. Leave empty for every type.

## `parkBatSides` (type: `array`):

Which batters the park factors cover. Leave empty for all three.

## `parkConditions` (type: `array`):

Game conditions to include. Leave empty for all of them.

## `parkRollingYears` (type: `array`):

Seasons per park factor (1, 2 or 3 years ending in the chosen season). Leave empty for all three.

## `oddsProviders` (type: `array`):

Keep only these sportsbooks, e.g. <code>DraftKings</code> or <code>ESPN BET</code>. A partial name matches. Leave empty for every sportsbook.

## `propTypes` (type: `array`):

Keep only these prop markets, e.g. <code>Total Strikeouts</code> or <code>Home Runs</code>. A partial name matches. Leave empty for every market.

## `standingsTypes` (type: `array`):

Leave empty for regular season standings.

## `rosterType` (type: `string`):

Leave empty for the 40-man roster.

## `transactionTypes` (type: `array`):

Only these types, by code or name, e.g. <code>TR</code> (Trade), <code>SFA</code> (Signed as Free Agent), <code>SC</code> (Status Change, which covers injured list moves). Leave empty for every type.

## `prospectList` (type: `string`):

Which MLB Pipeline ranking to return. Rankings are always the current list; the season picks the stats shown next to each prospect.

## `awards` (type: `array`):

Only awards whose name contains one of these terms, e.g. <code>MVP</code>, <code>Cy Young</code>, <code>Gold Glove</code>. Leave empty for every award.

## `leadersLimit` (type: `integer`):

For league leaders: ranks per category. Leave empty for 50. Ties can add a few rows; 150 is the most any category has.

## `leadersPlayerPool` (type: `string`):

For league leaders. Leave empty for qualified players.

## `highLowTypes` (type: `array`):

For single-game highs. Leave empty for all three.

## `staffTypes` (type: `array`):

For staff. Leave empty for all. Umpires, official scorers and datacasters are league-wide and are skipped when teams are set.

## `maxResults` (type: `integer`):

Stop after this many records. Leave empty for no limit.

## Actor input object example

```json
{
  "mode": "games",
  "includeStatcast": true
}
```

# Actor output Schema

## `records` (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 = {
    "mode": "games",
    "includeStatcast": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("zen-studio/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 = {
    "mode": "games",
    "includeStatcast": True,
}

# Run the Actor and wait for it to finish
run = client.actor("zen-studio/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 '{
  "mode": "games",
  "includeStatcast": true
}' |
apify call zen-studio/mlb-stats-scraper --silent --output-dataset

```

## MCP server setup

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