MLB Stats Scraper
Pricing
from $25.50 / 1,000 results
MLB Stats Scraper
Scrapes official MLB stats by mode: schedule, teams, roster, player stats, or live game detail. Returns each record as a flat row ready for CSV, JSON, Excel, or XML export.
Pricing
from $25.50 / 1,000 results
Rating
0.0
(0)
Developer
ParseForge
Maintained by CommunityActor stats
1
Bookmarked
185
Total users
45
Monthly active users
12 days ago
Last modified
Categories
Share
MLB Stats Scraper
Scrape official MLB stats for any player, team, roster, schedule, or live game detail. Pull season stats, game feeds, and team data straight from the MLB Stats API. Export to CSV, JSON, Excel, or XML.
The MLB Stats API is the official data feed behind every box score, but pulling it into a flat dataset means handling nested endpoints, pagination, and date logic. This Actor wraps the feed so you request a mode (schedule, teams, roster, player stats, or live game detail), set a few filters, and get back clean rows. No API key, no hand-rolled client.
| Who uses it | What they scrape MLB Stats API for |
|---|---|
| Sports analysts | Pull season-long player stats to build performance models. |
| Fantasy baseball players | Grab daily schedules and rosters to set lineups. |
| Sportsbook operators | Fetch live game details to feed real-time betting markets. |
| Data journalists | Collect historical schedules and team data for season previews. |
What it does
This Actor collects MLB data by mode (schedule, teams, roster, player stats, or game detail) and returns each record as a flat row.
- š Schedule mode: pull games by date, season, and game type (regular, postseason, or All-Star).
- š§¢ Teams mode: get the full list of active MLB teams with their IDs and league info.
- š„ Roster mode: fetch a team's current roster, or batch up to 100 team IDs in one run.
- š Player Stats mode: request season stats for a single player, or batch up to 100 player IDs.
- ā¾ Game Detail mode: get the live feed for a specific game by its MLB game PK.
Results export to CSV, JSON, Excel, or XML, or straight from the API.
What you can do with MLB Stats API data
š Build a player performance dashboard.
A fantasy analyst runs playerStats mode with a batch of player IDs each morning and feeds the CSV into a Google Sheet that tracks rolling averages.
š Monitor today's matchups.
A sportsbook operator runs schedule mode with today's date and the regular season filter to populate a daily odds board.
š§¢ Audit team rosters weekly.
A data journalist runs roster mode for all 30 teams every Monday to track call-ups and injuries for a weekly column.
ā¾ Power a live score widget.
A developer runs gameDetail mode for an active game PK every 60 seconds and pushes the live feed to a website widget.
Why choose this scraper
| What you get | |
|---|---|
| Official data source | Reads directly from the MLB Stats API, the same feed that powers MLB.com. |
| Five modes, one actor | Schedule, teams, roster, player stats, and live game detail in a single tool. |
| Batch lookups | Send up to 100 team IDs or player IDs per run for roster and stats modes. |
| Flat output | Nested API responses are flattened into rows ready for CSV, JSON, Excel, or XML. |
How it compares
No other Store actor targets MLB Stats API the same way, so the honest comparison is with the alternatives teams actually weigh.
| MLB Stats Scraper | Build it in-house | By hand | |
|---|---|---|---|
| Setup | Run it now, zero config | Days of engineering | None, but hours per pull |
| When MLB Stats API changes | Maintained for you | You fix it | You re-learn the page |
| Proxies, retries, anti-bot | Built in | Your problem | Browser only |
| Output | Fixed JSON schema, CSV/Excel export | Whatever you build | Copy-paste |
| Cost | Pay per result | Engineering time | Analyst hours |
Configure the run
Drive the Actor by picking a mode, then supply a date, team ID, player ID, game PK, or season year. Filters run as each request is made so only matching records reach your dataset. The Input tab lists every parameter.
A first run with the defaults:
{"mode": "schedule","maxItems": 10}
A larger pull:
{"mode": "schedule","maxItems": 200}
Pricing
Pay-per-result: $0.034 per result collected. You pay only for the results written to your dataset.
| Results collected | Approximate cost |
|---|---|
| 100 results | $3.40 |
| 1,000 results | $34.00 |
| 10,000 results | $340.00 |
New Apify accounts start with $5 in free credit.
Free users
Free-plan runs return up to 10 results as a preview. Upgrade your Apify plan to collect up to 1,000,000 results per run.
Run it
- Create a free Apify account with $5 in credit.
- Open the MLB Stats Scraper.
- Set your inputs and any filters, then click Start.
- Export the results as CSV, Excel, JSON, or XML from the Dataset tab.
Run it programmatically through the Apify API (run-sync-get-dataset-items) or the ApifyClient for JavaScript and Python.
Use with AI agents (MCP)
Give an AI agent live access to MLB Stats API through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:
$claude mcp add --transport http apify "https://mcp.apify.com?tools=parseforge/mlb-stats-scraper"
Then prompt it in plain language to run the scraper and read back the results.
Troubleshooting
Why am I getting no results from schedule mode?
Check that the date you supplied has games. If you left the date blank, it defaults to today. During the offseason or on off-days, there may be no games scheduled. Try a date during the regular season.
Why does my player ID return an error?
Make sure the player ID is correct. Run roster mode for the player's team to verify the ID. Also confirm the player is on an active roster or has stats for the season you requested.
Why is my batch lookup slow?
Batch lookups for up to 100 team IDs or player IDs make one API call per ID. Set maxItems to a reasonable number and expect longer runs for large batches.
Why am I getting a 404 for a game PK?
The game PK may be for a future game that does not have a live feed yet, or a past game outside the accessible range. Verify the game PK by running schedule mode for the game's date.
Why does my CSV have nested fields?
Some MLB API responses contain deeply nested objects. The Actor flattens most fields, but very complex nested structures may appear as JSON strings in a cell. Use the JSON export format if you need to parse these programmatically.
FAQ
| Question | Answer |
|---|---|
| Do I need an MLB API key to use this scraper? | No. This Actor reads from the public MLB Stats API endpoints. No registration or API key is required. |
| What is a game PK and where do I find it? | A game PK is MLB's unique identifier for a single game. You can find it by running schedule mode first. Each game in the schedule output includes its gamePk. |
| How do I find a team ID? | Run the Actor in teams mode to get the full list of MLB teams with their IDs. Common IDs include 147 for the Yankees and 119 for the Dodgers. |
| How do I find a player ID? | Run roster mode for a team to see its current players and their IDs. You can also look up a player on the MLB website. The numeric ID in the URL is their player ID. |
| Can I get stats for multiple players at once? | Yes. Use the playerIds array in playerStats mode to send up to 100 player IDs in a single run. |
| Can I get rosters for multiple teams at once? | Yes. Use the teamIds array in roster mode to send up to 100 team IDs in a single run. |
| What seasons does this cover? | The MLB Stats API includes historical data going back many years. Set the season field to any year from 1900 onward. |
| Can I filter the schedule by postseason games only? | Yes. Set seasonType to 'post' for a shortcut that includes Wild Card, Division Series, League Championship, and World Series games. Or set gameType to a specific round. |
| What does the live game detail feed include? | Game detail mode returns the full live feed: current score, inning, outs, runners on base, count on the batter, and play-by-play events. |
| How many records can I collect in one run? | You can set maxItems up to 1,000,000 records per run. The actual number depends on the mode and the date range or batch size you supply. |
Related actors
Browse the full ParseForge collection for more scrapers.
š Need help? Email parseforge@protonmail.com with your run ID, your input, and what you expected.
ā ļø Disclaimer. This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by MLB Advanced Media, L.P. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.
