ParseForge Scrapers

MLB StatsAPI Baseball Data Scraper

parseforge/mlb-statsapi-scraper

SportsAutomationIntegrations

Scrapes MLB StatsAPI endpoints for teams, people, schedule, venues, leagues, divisions, and seasons. Returns flat rows for easy export.

Run this scraper See the API call
Total users
72
Monthly active
21
Total runs
231
Bookmarked
1
Rating
Not rated yet
Last modified
9 days ago

Overview

ParseForge

MLB StatsAPI Baseball Data Scraper

Scrape MLB StatsAPI baseball data from teams, players, schedules, venues, and more, up to a million records per run. Every record comes in a flat, consistent schema with no login or API key. Export to CSV, JSON, Excel, or XML.

MLB StatsAPI is the official public data source for Major League Baseball, but pulling from it means writing your own HTTP client, handling pagination, and mapping nested JSON. This Actor calls the public endpoints directly and returns each record as a flat row, so you can analyze baseball data without building a pipeline.

Who uses it What they scrape MLB StatsAPI for
Sports analysts Pull team and player data to build performance models
Fantasy baseball developers Get schedules and rosters to power lineup tools
Researchers Collect historical season data for statistical studies
Data journalists Gather venue and league information for stories

What it does

This Actor collects records from MLB StatsAPI endpoints such as teams, people, schedule, venues, leagues, divisions, and seasons, and returns each one as a flat row.

  • ๐Ÿ“‹ Multiple endpoints: teams, people, schedule, venues, leagues, divisions, and seasons.
  • ๐Ÿ”ข Flexible volume: set a maximum from 1 to 1,000,000 records per run.
  • ๐Ÿท๏ธ Optional filters: narrow by sport ID and season year.
  • ๐Ÿ“ค Flat output: every record is a simple row, ready for CSV, JSON, Excel, or XML.

Results export to CSV, JSON, Excel, or XML, or straight from the API.

What you can do with MLB StatsAPI data

๐Ÿ“ˆ Build a baseball analytics dashboard.

A data analyst runs the Actor on the teams endpoint to get current team data, then joins it with player stats for a performance dashboard.

๐Ÿ† Power a fantasy baseball app.

A developer scrapes the schedule endpoint to get game dates and matchups, feeding a lineup optimizer for fantasy players.

๐Ÿ“š Research historical seasons.

A researcher sets the season filter to collect data from past years, comparing team performance across eras.

๐Ÿ—ž๏ธ Investigate venue data.

A journalist pulls venue records to analyze stadium capacities and locations for a story on ballpark economics.

Why choose this scraper

What you get
No API key Uses the public MLB StatsAPI, no registration or authentication
Flat schema Nested JSON is normalized into one row per record
Scalable Collect up to a million records in a single run
Multiple endpoints Teams, players, schedules, venues, leagues, divisions, seasons

How it compares

No other Store actor targets MLB StatsAPI the same way, so the honest comparison is with the alternatives teams actually weigh.

MLB StatsAPI Baseball Data Scraper Build it in-house By hand
Setup Run it now, zero config Days of engineering None, but hours per pull
When MLB StatsAPI 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 selecting an endpoint and setting a maximum record count, then optionally filter by sport ID and season year. The Input tab lists every parameter.

A first run with the defaults:

{
  "maxItems": 10
}

A larger pull:

{
  "maxItems": 200
}

Pricing

Pay-per-result: $0.0085 per result collected. You pay only for the results written to your dataset.

Results collected Approximate cost
100 results $0.85
1,000 results $8.50
10,000 results $85.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

  1. Create a free Apify account with $5 in credit.
  2. Open the MLB StatsAPI Baseball Data Scraper.
  3. Set your inputs and any filters, then click Start.
  4. 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 StatsAPI 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-statsapi-scraper"

Then prompt it in plain language to run the scraper and read back the results.

Troubleshooting

Why am I getting no results?

Check that the endpoint is valid and that your filters, such as season, are correct. Also ensure the maximum records is set to at least 1.

Why is the run taking so long?

Large maximum record counts can take time. Reduce the maximum records or add filters to narrow the data.

Why are some fields missing in the output?

The API may not return all fields for every record. The Actor returns what is available from the endpoint.

Can I get data for minor leagues?

The Actor defaults to sport ID 1 for MLB. You can change the sport ID to another value if the API supports it.

FAQ

Question Answer
Do I need an API key to use this Actor? No. The Actor uses the public MLB StatsAPI endpoints, which do not require authentication.
What endpoints can I scrape? You can select from teams, people, schedule, venues, leagues, divisions, and seasons.
How many records can I get in one run? You can set the maximum records from 1 to 1,000,000 per run.
Can I filter by season? Yes, you can optionally set a season year to get data for that specific season.
What output formats are supported? The Actor can export data to CSV, JSON, Excel, or XML.
Is the data returned in a nested JSON structure? No, the Actor flattens the nested JSON from the API into a single row per record.
Can I scrape player data? Yes, select the people endpoint to get player information.
Does this Actor handle pagination automatically? Yes, it handles pagination internally to collect up to the maximum records you set.
What is the default sport ID? The default sport ID is 1, which corresponds to MLB.
Can I get schedule data for a specific team? The schedule endpoint returns all schedules, but you can filter by season to narrow results.

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.

Input

FieldTypeWhat it doesDefault
endpoint string (7 options) MLB StatsAPI endpoint to call. teams
maxItems integer How many stats records to collect per run. 10
sportId integer MLB sport id. 1 = MLB. 1
season integer Optional season year. not set

Pricing

from $7.50 per 1,000 results

Charged forWhat it isPrice each
result Single result in the default dataset. $0.0075 to $0.0085

Tiered: the lower figure is the price on a higher Apify plan. Billing and the free credit live on Apify.

API

One POST returns the dataset directly. Same shape for every scraper in the library, so swapping the slug is the only change.

POST ยท run and get results
curl -X POST "https://api.apify.com/v2/acts/parseforge~mlb-statsapi-scraper/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "helloWorld": 123
  }'

Examples

Input that runs as-is.

input.json
{
  "helloWorld": 123
}

Reviews

No reviews yet. Be the first.

Issues

We build and maintain this scraper, so a problem with it comes to us. Report it on the Apify listing and the thread stays attached to the scraper where the next person can find it: open an issue.

Broken and urgent, or you would rather not post in public? Write to parseforge@protonmail.com and it reaches the people who wrote it.

Related scrapers

Run MLB StatsAPI Baseball Data Scraper on Apify All scrapers