MLB Roster & Player Stats Exporter
Pricing
from $2.50 / 1,000 player stat records
MLB Roster & Player Stats Exporter
Export official MLB roster player bios and season statistics.
Pricing
from $2.50 / 1,000 player stat records
Rating
0.0
(0)
Developer
Hanna Nosova
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
a day ago
Last modified
Categories
Share
MLB Stats Scraper: Roster & Player Statistics
MLB Stats Scraper exports official public MLB roster bios and season player statistics into clean, analysis-ready records. Build a repeatable MLB stats API workflow for fantasy research, baseball player statistics analysis, editorial research, and roster reporting—without an MLB login.
Each result combines player identity, team and position context, biographical details, the selected season/stat group, the complete available statistics object, and a source link. A single request can cover one team, multiple teams, or a known list of player IDs.
Who is it for?
- Fantasy and sports analysts who need current roster context alongside season statistics.
- Reporters and researchers building reproducible baseball player statistics exports.
- Data teams and developers that need structured player data in an Apify dataset for downstream workflows.
- AI agents that need a bounded, attributable MLB roster or player-stat lookup.
What you get
One normalized record is exported for each player and requested statistic group. Rows retain the official statistics object and source URL for traceability.
- Player identity:
playerId,fullName,firstName,lastName, andnameSlug - Roster context:
teamId,teamName,jerseyNumber,rosterStatus, and position fields - Player bio: birth details, age, height, weight, batting side, throwing hand, and MLB debut date when supplied
- Statistics:
season,statGroup, and the complete availablestatsobject - Provenance:
sourceUrl,sourceTeamId, andretrievedAt
Input recipe
{"mode": "roster","teamIds": [147, 121],"season": 2025,"statGroups": ["hitting", "pitching", "fielding"],"includeStats": true,"maxItems": 50}
Input settings
| Input | Description |
|---|---|
mode | Use roster for selected team rosters or playerStats for explicit player IDs. |
teamIds | MLB team IDs used by roster mode. For example, 147 is the New York Yankees. |
playerIds | MLB player IDs required by playerStats mode. |
season | Season year for official player statistics. |
statGroups | Any combination of hitting, pitching, and fielding. |
includeStats | Set to false for roster biographies only. |
maxItems | Global player-record cap. Start low when testing a workflow. |
Example output
{"recordType": "mlbPlayerRosterStat","playerId": 645305,"fullName": "Ali Sánchez","teamId": 147,"teamName": "New York Yankees","positionAbbreviation": "C","season": 2025,"statGroup": "hitting","stats": { "gamesPlayed": 12, "hits": 5, "avg": ".217" },"sourceUrl": "https://statsapi.mlb.com/api/v1/teams/147/roster?...","retrievedAt": "2026-08-27T00:00:00.000Z"}
Output fields
| Field | Description |
|---|---|
recordType | Stable mlbPlayerRosterStat record label. |
playerId, fullName, firstName, lastName, nameSlug | Official player identity. |
teamId, teamName, jerseyNumber, rosterStatus | Roster assignment and status. |
positionCode, positionName, positionAbbreviation | Official primary roster position. |
birthDate, birthCity, birthStateProvince, birthCountry, currentAge, height, weight | Public player bio fields when supplied. |
batSide, pitchHand, mlbDebutDate | Official player profile details. |
season, statGroup, stats | Requested season, group, and complete official statistic object. |
sourceUrl, sourceTeamId, retrievedAt | Source provenance and retrieval time. |
Use cases
Build a team roster export
Choose mode: "roster", add one or more teamIds, and use a moderate maxItems value. Select only the statistic groups your analysis needs to keep the output focused.
Look up known players
Choose mode: "playerStats" and supply playerIds. This works well when a separate workflow already has a shortlist of public MLB player IDs.
Create a bio-only roster dataset
Set includeStats to false to return roster and player biography fields without a requested statistics object.
Pricing
You are charged once when a run begins and for each exported player-stat record. Rates vary by Apify plan; see the live Actor Pricing tab for current per-result rates before large exports.
Tips and limits
- Use a low
maxItemsvalue to validate input and output before a larger export. - A player can have one row for each requested statistic group; this keeps hitting, pitching, and fielding values unambiguous.
- The source can omit an optional player biography value or a statistic for a player. Those values are returned as
null, never guessed. - This focused version exports roster and player-stat records. It does not export schedules, standings, scores, or game-detail entities.
- Results reflect the selected season and data currently available from the official public source.
API usage
Use the Actor API with the same JSON input shown above. Results are written to the run's default dataset.
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'], maxItems: 25,});const { items } = await client.dataset(run.defaultDatasetId).listItems();console.log(items);
Python
from apify_client import ApifyClientclient = ApifyClient("YOUR_APIFY_TOKEN")run = client.actor("fetch_cat/mlb-stats-scraper").call(run_input={"mode": "roster", "teamIds": [147], "season": 2025,"statGroups": ["hitting"], "maxItems": 25,})items = client.dataset(run["defaultDatasetId"]).list_items().itemsprint(items)
cURL
curl "https://api.apify.com/v2/acts/fetch_cat~mlb-stats-scraper/runs?token=$APIFY_TOKEN" \-H 'content-type: application/json' \-d '{"mode":"roster","teamIds":[147],"season":2025,"statGroups":["hitting"],"maxItems":25}'
MCP and AI agents
Add this Actor to an MCP client to let an agent request a bounded roster or player-stat export.
$claude mcp add apify -- npx -y @apify/mcp-server
{"mcpServers": {"apify": {"command": "npx","args": ["-y", "@apify/mcp-server"],"env": { "APIFY_TOKEN": "YOUR_APIFY_TOKEN" }}}}
Use the MCP endpoint https://mcp.apify.com?tools=fetch_cat/mlb-stats-scraper. Example prompts:
- “Export up to 25 2025 hitting-stat roster records for MLB team ID 147.”
- “Return 10 2025 pitching-stat records for player IDs 592450 and 543037.”
FAQ
What data can I export with MLB Stats Scraper? Each record includes official player identity, roster assignment, position, public biography fields, requested season/stat group, available statistics, and source provenance.
Can I run MLB Roster & Player Stats Exporter through an API, schedule, or MCP client? Yes. Use the API input shown above, schedule the same validated input in Apify, or add the listed MCP endpoint to a compatible client.
How much does it cost to use MLB Roster & Player Stats Exporter? Billing is per exported player-stat record plus the one-time run start event. Check the live Pricing tab for your current rate.
Do I need an MLB account? No. This Actor exports data available from official public MLB sources.
Why are there multiple rows for one player? A row is emitted per requested statistic group so values remain unambiguous.
What are alternatives for schedules or standings? This Actor intentionally focuses on rosters and player statistics. Use a workflow with a schedule- or standings-specific data source when those are your primary entity.
Input recipes
- Quick roster:
mode: "roster",teamIds: [147],statGroups: ["hitting"], andmaxItems: 25. - Player lookup:
mode: "playerStats",playerIds: [592450], the desiredseason, and the requiredstatGroups. - Bio-only roster:
mode: "roster",teamIds: [147],includeStats: false, andmaxItems: 25.
Related Actors
- Google Search Results
- Google Images Scraper
- Google News Scraper
- Google Trends Scraper
- Google Hotels Scraper
Support
Need help with an input or result? Open an issue on this Actor's Apify page and include a reproducible report:
- Run: the Apify run ID and URL, for example final validation run
7DkJbupSs53DcNUdQ. - Complete input JSON: paste the full submitted JSON, such as:
{"mode": "roster","teamIds": [147],"season": 2025,"statGroups": ["hitting"],"includeStats": true,"maxItems": 20}
- Expected vs. actual: state the expected record count/field values and paste one actual row or the exact error message. For the example above, expect up to 20
mlbPlayerRosterStatrows withseason: 2025,statGroup: "hitting", and a populatedsourceUrl; report the returned count and the first row if it differs. - Public source: include the reproducible official source URL, such as
https://statsapi.mlb.com/api/v1/teams/147/rosterfor this Yankees request.
Do not include API tokens or other secrets in a support report.