MLB Roster & Player Stats Exporter avatar

MLB Roster & Player Stats Exporter

Pricing

from $2.50 / 1,000 player stat records

Go to Apify Store
MLB Roster & Player Stats Exporter

MLB Roster & Player Stats Exporter

Export public MLB player biographies and season hitting, pitching, and fielding statistics from current team rosters or known player IDs to JSON, CSV, or Excel.

Pricing

from $2.50 / 1,000 player stat records

Rating

0.0

(0)

Developer

Fetch Cat

Fetch Cat

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

a month ago

Last modified

Features

Limited permissions

Share

Export public MLB player biographies and season statistics from team IDs or known player IDs. MLB Stats Scraper saves structured records for baseball player statistics analysis, fantasy research, reporting, and API workflows—without an MLB login.

Roster mode returns the team's currently available roster, not a historical roster for the selected season. The season setting selects statistics. Missing biography values and unavailable statistics remain null.

Quick start

  1. Choose roster and enter an MLB team ID, such as 147 for the New York Yankees.
  2. Select a statistics season and group. Start with a small record limit.
  3. Run the Actor and open its default dataset. Export results as JSON, CSV, or Excel.
{
"mode": "roster",
"teamIds": [147],
"season": 2025,
"statGroups": ["hitting"],
"includeStats": true,
"maxItems": 20
}

Prefer a video guide? This short Apify walkthrough shows you how to set up and run an Actor. It uses a different Actor, but the setup steps are the same.

Ready-to-run examples

Choose a public example to see its settings before starting a run:

What you get

  • Roster research: player identity, team assignment, jersey number, status, and position from selected teams.
  • Known-player lookups: public biographies and season statistics for explicit player IDs. Team assignment fields are null in this mode.
  • Statistics: one row per player and requested group, with the first available season-stat split from that group. Additional splits are not expanded into separate rows.
  • Bio-only exports: set includeStats to false for one row per player, with statGroup and stats set to null.
  • Attribution: each record includes its source URL and retrieval timestamp.

Analysts can join records by playerId. Reporters can retain the source link. Data teams and agents can retrieve the default dataset through the API. Nested stats keys vary between hitting, pitching, and fielding.

Who is it for?

  • Baseball analysts reviewing available player biographies and requested season statistics.
  • Fantasy researchers comparing selected player records in their own analysis.
  • Sports reporters retaining source-backed player and roster context.
  • Data developers joining player IDs and group-specific statistics into their own datasets.

How you can use the data

  • Review the currently exposed Yankees roster with 2025 hitting stats. Use team ID 147, the existing season and hitting group with a small row cap. Keep roster team context separate from the statistics year: this does not reconstruct the 2025 roster.
  • Look up one known player's available pitching statistics. Use the existing player ID 592450, season 2025, pitching group and one-row cap. Retain sourceUrl and playerId for attribution, with team fields null in known-player mode and absent stats left unknown.
  • Prepare a biography-only sample. Use the existing team ID with statistics disabled and a ten-row cap. Each player produces one biography row with statGroup and stats null, while currentAge remains the source's present value rather than age in an older season.
  • Join narrow statistics groups in your own analysis. Keep playerId, season and statGroup together. Multiple groups can create several rows per player, and each group retains only its first available season split. Compute comparisons or rankings yourself rather than assuming a leaderboard or complete traded-player split history.

Input settings

Setting / API keyMeaning
Export mode — moderoster (default) or playerStats.
MLB team IDs — teamIdsRoster mode only. Omitted or empty lists use [147].
MLB player IDs — playerIdsA nonempty list is required for playerStats. Ignored in roster mode.
Season — seasonStatistics year, from 1876 to 2100. The form defaults to 2025. Runtime omission uses the current UTC year.
Include season statistics — includeStatsDefaults to true. Set false for biography rows in either mode.
Statistic groups — statGroupshitting, pitching, fielding. Omitted input uses all three.
Maximum player records — maxItemsTotal row cap, 1–1000. The form defaults to 20. Runtime omission uses 25.

Field help explains defaults and mode-specific behavior. Use explicit values in repeatable API workflows.

Example inputs

Known-player lookup:

{
"mode": "playerStats",
"playerIds": [592450],
"season": 2025,
"statGroups": ["pitching"],
"maxItems": 1
}

Biography-only roster:

{
"mode": "roster",
"teamIds": [147],
"includeStats": false,
"maxItems": 10
}

Output data

Shape-only illustration, not an observed player record:

{
"recordType": "mlbPlayerRosterStat",
"playerId": 592450,
"fullName": "<source player name>",
"teamId": null,
"teamName": null,
"season": 2025,
"statGroup": "pitching",
"stats": null,
"sourceUrl": "https://statsapi.mlb.com/api/v1/people/592450?hydrate=stats(group=[pitching],type=[season],season=2025)",
"retrievedAt": "<UTC retrieval timestamp>"
}
FieldsMeaning
recordTypeAlways mlbPlayerRosterStat.
playerId, fullName, firstName, lastName, nameSlugPlayer identity. Optional names can be null.
teamId, teamName, jerseyNumber, rosterStatusRoster context. Team and roster status are unavailable in player-ID mode.
positionCode, positionName, positionAbbreviationRoster position or the player's primary position.
birthDate, birthCity, birthStateProvince, birthCountry, currentAge, height, weightBiography values when supplied. Age is the source's current age, not an age calculated for the requested season.
batSide, pitchHand, mlbDebutDateBatting side, throwing hand, and debut date.
season, statGroup, statsRequested year and group, plus the first available statistics object. Statistics can be null.
sourceUrl, sourceTeamId, retrievedAtSource request, roster team ID (or null), and retrieval time.

Download your results

Open your run's dataset, choose Export and select JSON, CSV or Excel. JSON keeps nested fields together. CSV and Excel are useful when you want to review the records in a spreadsheet.

See Apify's download and export guide for the available formats and field options.

Pricing

The start event is charged once per run. The result event applies to every saved row, including biography-only rows and rows with null statistics. One player can produce several paid rows when multiple groups are requested.

Use a small row cap and select only the needed statistic groups. See the live Pricing tab for current rates and plan discounts.

Tips for best results

  • Set season, groups and row limit explicitly. Omitted runtime values differ from form prefills for some fields.
  • Keep roster date context separate from statistics season. Selecting an older season does not retrieve an old roster.
  • Limit groups when you need fewer rows. The cap counts records rather than unique players.
  • Retain null statistics as unavailable. Do not turn missing season or group data into zero performance.
  • Inspect summary remaining and partial counts. A cap or deadline can leave a useful but incomplete sample.

Limits and caveats

Only public MLB roster and player information is supported without an MLB login. There is no supported proxy input or connection selector. This tool is not affiliated with or endorsed by MLB and does not replace every MLB data service.

Roster mode returns currently available membership, while season selects statistics rather than historical roster dates. Known-player mode requires explicit player IDs and does not provide team assignment or roster status. Source currentAge is current rather than calculated for the requested season. Form defaults and runtime omission behavior differ as listed in Input settings.

Each player and requested group can produce a row, using the first available season-stat split only. The saved-row cap is not a unique-player count. Missing biography and statistics values remain null. An empty group list produces no rows when statistics are enabled. Results follow source and input order with no statistic sorting or leaderboard.

Schedules, standings, scores, game details and every split for traded players are outside scope. Source units can be skipped when unavailable, and record or time limits can stop collection. Check RUN_SUMMARY saved, failed, remaining and partial values. A failed run without useful records needs investigation rather than being treated as a complete export.

PENDING_WORK exists only when source units remain. It does not track an unsaved roster tail cut off by the row cap and does not automatically resume collection. Join exports, compute comparisons and manage any future collection in your own workflow.

Automation and integrations

Save your settings for next time

Once you have an input that works for you, save it as an Apify task. This keeps your settings together so you can use them again without filling in the form from scratch.

Run on a schedule

Need fresh results regularly? You can schedule the Actor or a saved task to run at a time that suits you.

Each scheduled run collects the data again. If you want to compare results or highlight changes, add that step in your own workflow.

Send results to your other tools

Use n8n, Make or Zapier to connect this scraper to the rest of your workflow. For example, you could pass its results to an AI assistant or add records to a spreadsheet. Follow the Apify integration guides for your chosen tool.

For a custom connection, an Apify webhook can notify your app when a run finishes or fails. Your app can then fetch the results or handle the failure.

API usage

Want to collect this data from your own app or automation? The examples below send input to the scraper and show how to collect its results.

The Node.js and Python examples wait for the run to finish before reading its results. The cURL example starts the run and returns its details. Wait for that run to finish, then use its defaultDatasetId to fetch the results.

For setup instructions, see Apify's JavaScript client guide, Python client guide and Actor runs API reference.

cURL

curl -X POST 'https://api.apify.com/v2/acts/fetch_cat~mlb-stats-scraper/runs' \
-H "Authorization: Bearer $APIFY_TOKEN" \
-H 'Content-Type: application/json' \
--data @- <<'JSON'
{
"mode": "roster",
"teamIds": [
147
],
"season": 2025,
"statGroups": [
"hitting"
],
"includeStats": true,
"maxItems": 20
}
JSON

Node.js

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('fetch_cat/mlb-stats-scraper').call({
"mode": "roster",
"teamIds": [
147
],
"season": 2025,
"statGroups": [
"hitting"
],
"includeStats": true,
"maxItems": 20
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);

Python

import os
from apify_client import ApifyClient
client = ApifyClient(os.environ['APIFY_TOKEN'])
run = client.actor('fetch_cat/mlb-stats-scraper').call(run_input={'mode': 'roster', 'teamIds': [147], 'season': 2025, 'statGroups': ['hitting'], 'includeStats': True, 'maxItems': 20})
print(client.dataset(run['defaultDatasetId']).list_items().items)

MCP and AI agents

You can ask your AI assistant to collect data with MLB Roster & Player Stats Exporter and help you work with the results. The scraper returns the data, and your assistant can then summarize it, compare records or prepare notes.

Connect your assistant through the Apify MCP server. MCP gives your assistant a way to find this scraper, run it and read the results. Follow the official setup and sign-in guide for your app.

Easier setup with an Apify plugin

If you use a supported coding assistant, the official Apify plugin can set up the connection for you. It connects your assistant to Apify and includes instructions for common tasks. Follow the guide for your particular app.

Use Apify AI in Console

Prefer to keep everything in Apify? Open Apify AI in Console and ask it to find Fetch Cat's MLB Roster & Player Stats Exporter. You can describe the data you want and ask questions about the results.

Apify AI is currently in beta. It asks for confirmation before starting an Actor, and normal run charges apply.

Choose your assistant

Connect just this scraper

To keep your setup focused on this scraper, add this server configuration to a compatible MCP client:

{
"mcpServers": {
"apify": {
"url": "https://mcp.apify.com?tools=fetch_cat/mlb-stats-scraper"
}
}
}

Sign in to Apify when your client asks. If your client uses a Bearer token instead, follow its setup guide and keep the token in its secure configuration. Configuration formats vary by app, so use the linked guide if your client needs a different format.

Use Apify's general server

Already connected to the general Apify MCP server at https://mcp.apify.com? You can use it to find this scraper without adding another server. Ask your assistant to use MLB Roster & Player Stats Exporter by Fetch Cat, or give it the identifier fetch_cat/mlb-stats-scraper.

Your assistant can check the available settings and retrieve the results from the returned run. If the run is still working, it should follow that run rather than start it again. Both connection options use Apify's hosted service.

Example requests

  • “Use Fetch Cat’s MLB Roster and Player Stats Exporter to collect up to 5 rows from team 147's currently available roster with 2025 hitting statistics. Keep player IDs and roster context without calling it the 2025 roster.”
  • “Retrieve player 592450's available 2025 pitching statistics with a one-row cap. Keep the source URL and null team context, and mark missing statistics as unavailable rather than zero.”
  • “Collect up to 5 biography-only rows from the current team 147 roster with statistics disabled. Keep player IDs, positions and source links, without treating current age as age in a historical season.”

Normal Apify charges apply. Check the live Pricing tab before asking your assistant to run a larger batch.

Pay with x402

If your AI agent has a funded wallet, it can pay for Apify usage through x402. This experimental option lets an agent use Apify without a conventional account.

Apify AGI provides a prepaid API token with a spending cap after payment. Your agent can use that token to run this scraper through the Apify API or an authenticated MCP connection.

Some MCP setups also support paying for each request directly. That is a different payment option, so check the official guide for its availability.

Follow the official guide for wallet setup, supported payment options and current terms. Apify handles the payments. Keep wallet keys and payment tokens in your agent's secure configuration.

Other ways for agents to pay

Apify also supports MPP for prepaid access through AGI and Skyfire for eligible Actors. If your agent already uses one of these, see the agentic payment guide to choose the right setup.

FAQ

Can I use this as an MLB stats API workflow?

Yes. It wraps public roster and player-stat lookups in an Apify run and dataset. It is not a replacement for every MLB data service or endpoint.

Can I export baseball player statistics to Excel or CSV?

Yes, through Apify dataset exports. The stats object is nested and group-dependent. JSON preserves its structure most directly.

Does selecting 2025 give me the 2025 roster?

No. It selects the statistics year for players in the currently returned roster. Use known playerIds to request a particular player's available season statistics.

Do I need an MLB account or proxy settings?

No MLB account is needed. There is no supported proxy input or connection selector.

Why did I get fewer rows or null statistics?

Coverage depends on the source, requested group, and season. Check the row cap and RUN_SUMMARY. A failed run with no useful records needs investigation rather than being treated as a complete export.

Support and feedback

For custom additions or integrations, email hello@fetchcat.dev.

Found an error or have a feature request? Open an issue with the run URL, a non-sensitive input example and what you expected.

Need help sharing it? See Apify’s guide to sharing a run when reporting an issue. Sharing a run can give the developer access to its input, logs and results, so use a run that contains no sensitive data. Please leave out API tokens, passwords, cookies, private documents and personal data. Use a public sample URL or a redacted example instead.

Tried this scraper? We'd love to hear how it worked for you. Leave a review to help others choose the right tool and help us improve it. Your feedback means a lot to us.

Made with care for curious people, AI agents and the possibilities in data. ♥