# MLB Stats 💰$2/1K — Rosters & Season Stats (`blackfalcondata/mlb-scraper`) Actor

Scrape statsapi.mlb.com for every MLB player in a season: full roster with batting, pitching and fielding stats, plus club, league, division, venue, position, birth city and country, and debut year. One row per player as structured JSON or CSV.

- **URL**: https://apify.com/blackfalcondata/mlb-scraper.md
- **Developed by:** [Black Falcon Data](https://apify.com/blackfalcondata) (community)
- **Categories:** Sports, Lead generation, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 record returneds

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/platform/actors/running/actors-in-store#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

### What does MLB Stats do?

MLB Stats extracts structured player data from [statsapi.mlb.com](https://statsapi.mlb.com). It supports keyword search and controllable result limits, so you can run the same query consistently over time. The actor also offers detail enrichment (extra per-record fields the search results omit).

**New to Apify?** [Sign up free](https://console.apify.com/sign-up?fpr=1h3gvi) and use the included $5 monthly platform credit to test this actor.

### Key features

- **⚾ Whole-season roster in one run** — leave the search box empty and you get every player on the season roster — 1,373 for the 2026 MLB season — not a keyword slice. Pick any past season, or point it at Triple-A, Double-A, High-A or Single-A instead.
- **📊 Full batting, pitching and fielding lines** — each player carries the complete season stat line as the source publishes it — 34 batting fields, 62 pitching fields, plus fielding — alongside the headline columns (AVG, OBP, SLG, OPS, HR, RBI, ERA, WHIP, IP, W-L, SV) as flat top-level fields you can sort a spreadsheet by.
- **🏟️ Club context joined onto every player** — club, league, division, venue, abbreviation and franchise are attached to each player, including players optioned to a minor-league affiliate — not just the ones on a major-league active roster.
- **♻️ Incremental mode** — recurring runs emit only players who are new or whose club, position or status changed — roster churn without re-fetching the league. Seasons never share state, so a 2026 run cannot mark 2025 players as gone.
- **🧹 Empty-field stripping** — drop null, empty-string, and empty-array fields from each record before push. Smaller payloads for AI agents and dashboards that already handle missing fields gracefully.
- **📤 Export anywhere** — Download the dataset as JSON, CSV, or Excel from the Apify Console, or stream live via the Apify API and integrations (Make, Zapier, Google Sheets, n8n, …).

### What data can you extract from statsapi.mlb.com?

Each result includes Core player fields (`listingId`, `statsSeason`, `hittingStats`, `pitchingStats`, `fieldingStats`, `gamesPlayed`, `atBats`, and `hits`, and more) and detail fields when enrichment is enabled (`detailFetched`). In standard mode, all fields are always present — unavailable data points are returned as `null`, never omitted. In compact mode, only core fields are returned.

Enable detail enrichment in the input to fetch each record's detail page — extra fields the search results omit.

### Input

The main inputs are a search keyword and a result limit. Additional filters and options are available in the input schema.

Key parameters:

- **`query`** — Name to match against the season roster — a full or partial player name (e.g. "Ohtani", "Aaron Judge", "Rodriguez"). Matching is case-insensitive and substring-based. LEAVE EMPTY to get the complete roster for the season.
- **`season`** — Season year to pull, e.g. 2026. Defaults to the current year. Historical seasons are served the same way.
- **`sportId`** — 1 = Major League Baseball (default). 11 = Triple-A, 12 = Double-A, 13 = High-A, 14 = Single-A.
- **`startUrls`** — Paste raw search URLs from the target site. Each URL becomes its own search task; results are merged and deduped by record ID across all URLs. When provided AND parseable, startUrls REPLACE the query field (each URL becomes one task). Implement parseStartUrl() in src/searchTasks.ts for your target site — without it, all URLs are skipped and the actor falls back to query. (default: `[]`)
- **`maxResults`** — Maximum total records (0 = unlimited — the whole roster). (default: `25`)
- **`includeDetails`** — Fetch full records — season stats, biography, position, handedness and current club. Turn off for a faster, name-only run. (default: `true`)
- **`includeRosterStatus`** — Add each player's current roster status — Active, Injured 10-Day, Injured 60-Day, Reassigned to Minors, Released — plus the date it took effect. Roughly doubles the amount of data fetched per player. Requires 📋 Include Full Details; without it this option is skipped and not charged. (default: `false`)
- **`includeAwards`** — Add All-Star and Futures Game selections and similar honours, with the season each was won. Adds about 60% to the data fetched per player. Needs 📋 Include Full Details switched on — otherwise it is skipped, and not charged. (default: `false`)
- **`includeTransactions`** — Add signings, trades and injured-list placements with their dates and the league's own wording. This is where injury dates come from. Substantially increases the data fetched per player — leave off unless you need the history. Only runs when 📋 Include Full Details is on; skipped and not charged otherwise. (default: `false`)
- **`compact`** — Core fields only (for AI-agent/MCP workflows). (default: `false`)
- **`excludeEmptyFields`** — Drop null, empty-string, and empty-array fields from each record before push. Smaller payloads for AI agents and dashboards. (default: `false`)
- **`incrementalMode`** — Compare against previous run state. stateKey is optional — defaults to a value derived from search inputs (queries, startUrls) so different filter sets never share state. (default: `false`)
- ...and 18 more parameters

### Input examples

**Whole 2026 season roster** — undefined

→ undefined

```json
{
  "season": 2026,
  "maxResults": 0,
  "includeDetails": true
}
```

**One player by name** — undefined

→ undefined

```json
{
  "query": "Ohtani",
  "season": 2026,
  "includeDetails": true
}
```

**A past season** — undefined

→ undefined

```json
{
  "query": "",
  "season": 2019,
  "maxResults": 500,
  "includeDetails": true
}
```

**Triple-A instead of the majors** — undefined

→ undefined

```json
{
  "query": "",
  "sportId": 11,
  "season": 2026,
  "maxResults": 1000
}
```

**Weekly roster-change monitor** — undefined

→ undefined

```json
{
  "query": "",
  "season": 2026,
  "maxResults": 0,
  "incrementalMode": true,
  "emitExpired": true
}
```

### Output

Each run produces a dataset of structured player records. Results can be downloaded as JSON, CSV, or Excel from the Dataset tab in Apify Console.

### Example player record

```json
{
  "listingId": "0fac9d9cfbdd954979ad050d3e051c6c67ad493ad02fc9a0331b5393c940824d",
  "statsSeason": 2026,
  "pitchingStats": {
    "age": 27,
    "gamesPlayed": 24,
    "gamesStarted": 24,
    "groundOuts": 118,
    "airOuts": 157,
    "runs": 60,
    "doubles": 15,
    "triples": 1,
    "homeRuns": 17,
    "strikeOuts": 99,
    "baseOnBalls": 61,
    "intentionalWalks": 0,
    "hits": 118,
    "hitByPitch": 0,
    "avg": ".242",
    "atBats": 487,
    "obp": ".324",
    "slg": ".382",
    "ops": ".706",
    "caughtStealing": 4,
    "stolenBases": 21,
    "stolenBasePercentage": ".840",
    "caughtStealingPercentage": ".160",
    "groundIntoDoublePlay": 6,
    "numberOfPitches": 2223,
    "era": "3.92",
    "inningsPitched": "128.2",
    "wins": 6,
    "losses": 7,
    "saves": 0,
    "saveOpportunities": 0,
    "holds": 0,
    "blownSaves": 0,
    "earnedRuns": 56,
    "whip": "1.39",
    "battersFaced": 555,
    "outs": 386,
    "gamesPitched": 24,
    "completeGames": 0,
    "shutouts": 0,
    "strikes": 1388,
    "strikePercentage": ".620",
    "hitBatsmen": 0,
    "balks": 0,
    "wildPitches": 0,
    "pickoffs": 2,
    "totalBases": 186,
    "groundOutsToAirouts": "0.75",
    "winPercentage": ".462",
    "pitchesPerInning": "17.28",
    "gamesFinished": 0,
    "strikeoutWalkRatio": "1.62",
    "strikeoutsPer9Inn": "6.92",
    "walksPer9Inn": "4.27",
    "hitsPer9Inn": "8.25",
    "runsScoredPer9": "4.20",
    "homeRunsPer9": "1.19",
    "inheritedRunners": 0,
    "inheritedRunnersScored": 0,
    "catchersInterference": 2,
    "sacBunts": 0,
    "sacFlies": 5
  },
  "fieldingStats": {
    "age": 27,
    "gamesPlayed": 24,
    "gamesStarted": 24,
    "assists": 9,
    "putOuts": 1,
    "errors": 1,
    "chances": 11,
    "fielding": ".909",
    "position": {
      "code": "1",
      "name": "Pitcher",
      "type": "Pitcher",
      "abbreviation": "P"
    },
    "rangeFactorPerGame": "0.42",
    "rangeFactorPer9Inn": "0.70",
    "innings": "128.2",
    "games": 24,
    "doublePlays": 0,
    "triplePlays": 0,
    "throwingErrors": 1
  },
  "gamesPlayed": 24,
  "strikeOuts": 99,
  "baseOnBalls": 61,
  "era": "3.92",
  "inningsPitched": "128.2",
  "wins": 6,
  "losses": 7,
  "saves": 0,
  "whip": "1.39",
  "college": "Virginia",
  "highSchool": "Halifax County",
  "rosterStatus": "Active",
  "rosterStatusCode": "A",
  "rosterStatusDate": "2026-04-16",
  "isActiveRoster": true,
  "isOn40Man": true,
  "awards": [
    {
      "id": "FUTURES",
      "name": "Futures Game Selection",
      "season": "2022",
      "date": "2022-07-07"
    },
    {
      "id": "AASPOMP",
      "name": "SOU Pitcher of the Month",
      "season": "2022",
      "date": "2022-09-18"
    },
    {
      "id": "MILBORGAS",
      "name": "MiLB.com Organization All-Star",
      "season": "2022",
      "date": "2022-11-07"
    },
    {
      "id": "SOUPOWP",
      "name": "SOU Pitcher of the Week",
      "season": "2023",
      "date": "2023-04-16"
    },
    {
      "id": "BAMLART",
      "name": "Baseball America Major League All-Rookie Team",
      "season": "2023",
      "date": "2023-10-05"
    },
    "... 4 more items"
  ],
  "transactions": [
    {
      "date": "2016-07-15",
      "effectiveDate": "2016-07-15",
      "typeDesc": "Assigned",
      "description": "LHP Andrew Abbott assigned to Evoshield Canes."
    },
    {
      "date": "2019-02-14",
      "effectiveDate": "2019-02-14",
      "typeDesc": "Assigned",
      "description": "LHP Andrew Abbott assigned to Virginia Cavaliers."
    },
    {
      "date": "2021-07-20",
      "effectiveDate": "2021-07-20",
      "typeDesc": "Signed",
      "description": "Cincinnati Reds signed LHP Andrew Abbott."
    },
    {
      "date": "2021-08-17",
      "effectiveDate": "2021-08-17",
      "typeDesc": "Assigned",
      "description": "LHP Andrew Abbott assigned to ACL Reds from Reds Organization."
    },
    {
      "date": "2021-08-17",
      "effectiveDate": "2021-08-17",
      "typeDesc": "Assigned",
      "description": "LHP Andrew Abbott assigned to Reds Organization."
    },
    "... 22 more items"
  ],
  "recordType": "player",
  "teamId": 113,
  "name": "Andrew Abbott",
  "teamName": "Cincinnati Reds",
  "clubName": "Reds",
  "franchiseName": "Cincinnati",
  "abbreviation": "CIN",
  "teamCode": "cin",
  "locationName": "Cincinnati",
  "league": "National League",
  "leagueId": 104,
  "division": "National League Central",
  "divisionId": 205,
  "venueId": 2602,
  "venueName": "Great American Ball Park",
  "springVenueId": 3834,
  "fileCode": "cin",
  "springLeagueId": 114,
  "springLeague": "Cactus League",
  "firstYearOfPlay": 1882,
  "season": 2026,
  "active": true,
  "url": "https://www.mlb.com/player/andrew-abbott-671096",
  "portalUrl": "https://www.mlb.com/player/andrew-abbott-671096",
  "playerId": 671096,
  "fullName": "Andrew Abbott",
  "firstName": "Andrew",
  "middleName": "Cole",
  "lastName": "Abbott",
  "useName": "Andrew",
  "useLastName": "Abbott",
  "boxscoreName": "Abbott, A",
  "nameSlug": "andrew-abbott-671096",
  "primaryNumber": "41",
  "primaryPosition": {
    "code": "1",
    "name": "Pitcher",
    "type": "Pitcher",
    "abbreviation": "P"
  },
  "batSide": {
    "code": "L",
    "description": "Left"
  },
  "pitchHand": {
    "code": "L",
    "description": "Left"
  },
  "currentTeam": {
    "id": 113,
    "name": "Cincinnati Reds",
    "link": "https://statsapi.mlb.com/api/v1/teams/113"
  },
  "birthDate": "1999-06-01",
  "currentAge": 27,
  "birthCity": "Lynchburg",
  "birthStateProvince": "VA",
  "birthCountry": "USA",
  "height": "6' 0\"",
  "weight": 192,
  "gender": "M",
  "isPlayer": true,
  "isVerified": true,
  "draftYear": 2021,
  "mlbDebutDate": "2023-06-05",
  "strikeZoneTop": 3.37,
  "strikeZoneBottom": 1.54,
  "link": "https://statsapi.mlb.com/api/v1/people/671096",
  "headshotUrl": "https://midfield.mlbstatic.com/v1/people/671096/spots/120",
  "contentQuality": "full",
  "detailFetched": true,
  "scrapedAt": "2026-08-11T18:26:29.012Z",
  "source": "statsapi.mlb.com"
}
```

### Incremental fields

When incremental mode is on, each record also carries:

- `changeType` — one of `NEW`, `UPDATED`, `UNCHANGED`, `REAPPEARED`, `EXPIRED`. Default output covers `NEW` / `UPDATED` / `REAPPEARED`; set `emitUnchanged: true` or `emitExpired: true` to opt into the others.
- `isRepost`, `repostOfId`, `repostDetectedAt` — populated when a new listing matches the tracked content of a previously expired one. Set `skipReposts: true` to drop detected reposts from the output.

### How to scrape statsapi.mlb.com

1. Go to [MLB Stats](https://apify.com/blackfalcondata/mlb-scraper?fpr=1h3gvi) in Apify Console.
2. Enter a search keyword.
3. Set `maxResults` to control how many results you need.
4. Enable `includeDetails` if you need the extra detail-page fields.
5. Click **Start** and wait for the run to finish.
6. Export the dataset as JSON, CSV, or Excel.

### Use cases

- Extract player data from statsapi.mlb.com for market research and competitive analysis.
- Monitor new and changed players on scheduled runs without processing the full dataset every time.
- Feed structured data into AI agents, MCP tools, and automated pipelines using compact mode.
- Export clean, structured data to dashboards, spreadsheets, or data warehouses.

### How much does it cost to scrape statsapi.mlb.com?

MLB Stats uses [pay-per-event](https://docs.apify.com/platform/actors/paid-actors/pay-per-event) pricing. You pay a small fee when the run starts and then for each result that is actually produced.

- **Run start:** $0.01 per run
- **Per record returned (primary event):** $0.002

You are billed only for the events your run actually triggers. Prices below are the Free plan tier.

| Event | Price (Free tier) | Charged when |
|---|---|---|
| Run start | $0.01 (one-time) | Charged once when the run starts. |
| Record returned (primary) | $0.002 | A record delivered to your dataset: a player, a team, or — in incremental mode with Include Expired on — an EXPIRED marker for a player who is no longer on the roster. All three are charged at this same rate, and team rows and EXPIRED markers are charged at this rate only: the enrichment fees below never apply to them. |
| Roster & injury status | $0.0015 | Current roster or injury status, with the date it took effect. Charged once for every player returned while Include Roster & Injury Status is on — including players with no status to report, because the lookup ran either way. The fields stay on the record so you can see the result. |
| Awards | $0.0015 | All-Star and Futures Game selections and similar honours. Charged once for every player returned while Include Awards is on — including players with no awards, because the lookup ran either way. The field stays on the record as an empty list so you can see the result. |
| Transaction history | $0.0025 | Signings, trades and injured-list placements with their dates. Charged once for every player returned while Include Transaction History is on — including players with no transactions, because the lookup ran either way. An empty list on the record is how you tell that apart from never having asked. |

Example costs (primary event only — other events above add cost when they fire):

- 10 results: **$0.03**
- 25 results: **$0.06**
- 100 results: **$0.21**
- 200 results: **$0.41**
- 500 results: **$1.01**

#### Example: recurring monitoring savings

These examples compare full re-scrapes with incremental runs at different churn rates. Churn is the share of players that are new or whose tracked content changed since the previous run. Actual churn depends on your query breadth, source activity, and polling frequency — the scenarios below are examples, not predictions.

Example setup: 100 players per run, daily polling (30 runs/month). Costs scale linearly with the number of players.

Numbers below are for the primary **Record returned** event. Other events (**Roster & injury status**, **Awards**, **Transaction history**) are billed separately when they fire.

| Churn rate | Full re-scrape run cost | Incremental run cost | Savings vs full re-scrape | Monthly cost after baseline |
|---|---:|---:|---:|---:|
| 5% — stable niche query | $0.21 | $0.02 | $0.19 (90%) | $0.60 |
| 15% — moderate broad query | $0.21 | $0.04 | $0.17 (81%) | $1.20 |
| 30% — high-volume aggregator | $0.21 | $0.07 | $0.14 (67%) | $2.10 |

Full re-scrape monthly cost at the same cadence: $6.30. First month with incremental costs $0.79 / $1.37 / $2.24 for the 5% / 15% / 30% scenarios because the first run builds baseline state at full cost before incremental savings apply.

Platform usage is included in the per-result fee shown above.

### FAQ

#### How many results can I get from statsapi.mlb.com?

The number of results depends on the search query and available players on statsapi.mlb.com. Use the `maxResults` parameter to control how many results are returned per run.

#### Does MLB Stats support recurring monitoring?

Yes. Enable incremental mode to only receive new or changed players on subsequent runs. This is ideal for scheduled monitoring where you want to track changes over time without re-processing the full dataset.

#### Can I integrate MLB Stats with other apps?

Yes. MLB Stats works with Apify's [integrations](https://apify.com/integrations?fpr=1h3gvi) to connect with tools like Zapier, Make, Google Sheets, Slack, and more. You can also use webhooks to trigger actions when a run completes.

#### Can I use MLB Stats with the Apify API?

Yes. You can start runs, manage inputs, and retrieve results programmatically through the [Apify API](https://docs.apify.com/api/v2). Client libraries are available for JavaScript, Python, and other languages.

#### Can I use MLB Stats through an MCP Server?

Yes. Apify provides an [MCP Server](https://apify.com/apify/actors-mcp-server?fpr=1h3gvi) that lets AI assistants and agents call this actor directly. Use compact mode, a single `descriptionFormat`, and `excludeEmptyFields` to keep payloads manageable for LLM context windows.

#### Is it legal to scrape statsapi.mlb.com?

This actor extracts publicly available data from statsapi.mlb.com. Web scraping of public information is generally considered legal, but you should always review the target site's terms of service and ensure your use case complies with applicable laws and regulations, including GDPR where relevant.

#### Your feedback

If you have questions, need a feature, or found a bug, please [open an issue](https://apify.com/blackfalcondata/mlb-scraper/issues?fpr=1h3gvi) on the actor's page in Apify Console. Your feedback helps us improve.

### You might also like

- [Elpris — Danish Electricity Prices & Suppliers](https://apify.com/blackfalcondata/elpris-scraper?fpr=1h3gvi) — Scrape every electricity product Danish suppliers report to elpris.dk — supplier, price bands.
- [Google Trends \[Just 💰$0.49\] — Interest & Related](https://apify.com/blackfalcondata/google-trends-scraper?fpr=1h3gvi) — 💰 $0.49 per 1,000 trending terms — the cheapest paid Google Trends scraper. Scrape live trending.
- [Transfermarkt \[Just 💰$0.5\] — football market values](https://apify.com/blackfalcondata/transfermarkt-market-value-scraper?fpr=1h3gvi) — 💰 $0.5 per 1,000 records. Scrape transfermarkt.com — player market values with full history ·.

### Getting started with Apify

New to Apify? [Create a free account with $5 credit](https://console.apify.com/sign-up?fpr=1h3gvi) — no credit card required.

1. Sign up — $5 platform credit included
2. Open this actor and configure your input
3. Click **Start** — export results as JSON, CSV, or Excel

Need more later? [See Apify pricing](https://apify.com/pricing?fpr=1h3gvi).

### Disclaimer

This actor accesses only publicly available data on statsapi.mlb.com. You are responsible for how you use the extracted data — in particular any personal information such as names, phone numbers, or email addresses — and for complying with MLB Stats's terms of use, applicable data-protection law (including the GDPR where it applies), and the anti-spam rules of your jurisdiction.

This actor is not affiliated with, endorsed by, or connected to MLB Stats.

### Search keywords

mlb stats scraper, mlb stats api, apify mlb stats, mlb stats data extraction, statsapi.mlb.com scraper, statsapi.mlb.com data, statsapi.mlb.com api.

# Actor input Schema

## `query` (type: `string`):

Name to match against the season roster — a full or partial player name (e.g. "Ohtani", "Aaron Judge", "Rodriguez"). Matching is case-insensitive and substring-based. LEAVE EMPTY to get the complete roster for the season.

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

Season year to pull, e.g. 2026. Defaults to the current year. Historical seasons are served the same way.

## `sportId` (type: `integer`):

1 = Major League Baseball (default). 11 = Triple-A, 12 = Double-A, 13 = High-A, 14 = Single-A.

## `startUrls` (type: `array`):

Paste raw search URLs from the target site. Each URL becomes its own search task; results are merged and deduped by record ID across all URLs. When provided AND parseable, startUrls REPLACE the query field (each URL becomes one task). Implement parseStartUrl() in src/searchTasks.ts for your target site — without it, all URLs are skipped and the actor falls back to query.

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

Maximum total records (0 = unlimited — the whole roster).

## `includeDetails` (type: `boolean`):

Fetch full records — season stats, biography, position, handedness and current club. Turn off for a faster, name-only run.

## `includeRosterStatus` (type: `boolean`):

Add each player's current roster status — Active, Injured 10-Day, Injured 60-Day, Reassigned to Minors, Released — plus the date it took effect. Roughly doubles the amount of data fetched per player. Requires 📋 Include Full Details; without it this option is skipped and not charged.

## `includeAwards` (type: `boolean`):

Add All-Star and Futures Game selections and similar honours, with the season each was won. Adds about 60% to the data fetched per player. Needs 📋 Include Full Details switched on — otherwise it is skipped, and not charged.

## `includeTransactions` (type: `boolean`):

Add signings, trades and injured-list placements with their dates and the league's own wording. This is where injury dates come from. Substantially increases the data fetched per player — leave off unless you need the history. Only runs when 📋 Include Full Details is on; skipped and not charged otherwise.

## `compact` (type: `boolean`):

Core fields only (for AI-agent/MCP workflows).

## `excludeEmptyFields` (type: `boolean`):

Drop null, empty-string, and empty-array fields from each record before push. Smaller payloads for AI agents and dashboards.

## `incrementalMode` (type: `boolean`):

Compare against previous run state. stateKey is optional — defaults to a value derived from search inputs (queries, startUrls) so different filter sets never share state.

## `stateKey` (type: `string`):

Optional. Stable identifier for the tracked search universe. Leave empty to auto-generate from search inputs.

## `emitUnchanged` (type: `boolean`):

When incremental mode is on, also emit records whose content has not changed since the last run.

## `emitExpired` (type: `boolean`):

When incremental mode is on, also emit records that were seen before but are no longer found.

## `skipReposts` (type: `boolean`):

When incremental, skip records whose content matches an expired record from a prior run (cross-run duplicate detection).

## `telegramToken` (type: `string`):

Telegram bot token (from @BotFather). Required for Telegram notifications.

## `telegramChatId` (type: `string`):

Telegram chat or channel ID (e.g. "-100123456789"). Required when telegramToken is set.

## `discordWebhookUrl` (type: `string`):

Discord incoming webhook URL. Server Settings → Integrations → Webhooks → New Webhook.

## `slackWebhookUrl` (type: `string`):

Slack incoming webhook URL. api.slack.com/messaging/webhooks.

## `notificationLimit` (type: `integer`):

Maximum number of records included in each notification message (1–20).

## `notifyOnlyChanges` (type: `boolean`):

When Incremental Mode is on, only send notifications for NEW and UPDATED records. Has no effect outside incremental mode.

## `whatsappAccessToken` (type: `string`):

WhatsApp Cloud API permanent access token (System User token from Meta Business). Recipient must have messaged the business number within the last 24h (service-conversation window — free since Nov 2024).

## `whatsappPhoneNumberId` (type: `string`):

Your WhatsApp Business phone-number ID (numeric, from Meta dashboard). Required when whatsappAccessToken is set.

## `whatsappTo` (type: `string`):

Recipient phone in E.164 format without + (e.g. "436641234567"). Recipient must have messaged your business number within last 24h.

## `webhookUrl` (type: `string`):

Receives a JSON POST with {metadata, items} after each run. Universal escape hatch for n8n / Make / Zapier / custom backends.

## `webhookHeaders` (type: `object`):

Optional JSON object of custom headers (e.g. {"Authorization":"Bearer ..."}).

## `appConnector` (type: `string`):

Optional. Pick a connected app under Settings → API & Integrations to receive your results. Best-effort across MCP connectors as Apify expands its catalog.

## `mcpIssueTeam` (type: `string`):

Only when the connected app is an issue tracker: the team (name or ID) the summary issue is created under, if that app requires one.

## `descriptionFormat` (type: `string`):

Choose which representation of the listing description to include. `all` keeps every variant; the others keep only the selected one.

## Actor input object example

```json
{
  "season": 2026,
  "sportId": 1,
  "startUrls": [],
  "maxResults": 25,
  "includeDetails": true,
  "includeRosterStatus": false,
  "includeAwards": false,
  "includeTransactions": false,
  "compact": false,
  "excludeEmptyFields": false,
  "incrementalMode": false,
  "emitUnchanged": false,
  "emitExpired": false,
  "skipReposts": false,
  "notificationLimit": 5,
  "notifyOnlyChanges": false,
  "descriptionFormat": "all"
}
```

# Actor output Schema

## `results` (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 = {
    "query": "",
    "season": 2026,
    "sportId": 1,
    "maxResults": 25,
    "includeRosterStatus": false,
    "includeAwards": false,
    "includeTransactions": false,
    "excludeEmptyFields": false,
    "descriptionFormat": "all"
};

// Run the Actor and wait for it to finish
const run = await client.actor("blackfalcondata/mlb-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 = {
    "query": "",
    "season": 2026,
    "sportId": 1,
    "maxResults": 25,
    "includeRosterStatus": False,
    "includeAwards": False,
    "includeTransactions": False,
    "excludeEmptyFields": False,
    "descriptionFormat": "all",
}

# Run the Actor and wait for it to finish
run = client.actor("blackfalcondata/mlb-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 '{
  "query": "",
  "season": 2026,
  "sportId": 1,
  "maxResults": 25,
  "includeRosterStatus": false,
  "includeAwards": false,
  "includeTransactions": false,
  "excludeEmptyFields": false,
  "descriptionFormat": "all"
}' |
apify call blackfalcondata/mlb-scraper --silent --output-dataset

```

## MCP server setup

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