MLB Player Stats Scraper (MLB Stats API)
Pricing
Pay per event
MLB Player Stats Scraper (MLB Stats API)
MLB player stats scraper on the official MLB stats API: season hitting, pitching and fielding stats per player (AVG, HR, RBI, OPS, ERA, WHIP, strikeouts) with team, league and position, ranked, as clean data.
Pricing
Pay per event
Rating
0.0
(0)
Developer
DevilScrapes
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
3 days ago
Last modified
Categories
Share
MLB Player Stats Scraper
💰 $1.70 / 1 000 results · pay only for results · no credit card to try
The devil's in the data. 😈
MLB player stats scraper for the official MLB stats API. Pick the seasons and stat groups you want and get one clean row per player: hitting, pitching or fielding season stats, ranked, with team, league and position attached. Export to JSON, CSV or Excel, or pull it straight from the Apify API.
🎯 What this scrapes
The MLB stats API serves season leaderboards fifty players at a time, one stat group at a time. This Actor walks every page of every season and group you ask for and returns one row per player season line, with the stat block flattened into typed columns instead of nested JSON.
- Hitting: games, plate appearances, at bats, runs, hits, doubles, triples, home runs, RBI, walks, strikeouts, stolen bases, AVG, OBP, SLG, OPS, BABIP, total bases and more.
- Pitching: wins, losses, saves, holds, ERA, WHIP, innings pitched, strikeouts, walks, K/9, BB/9, HR/9, batters faced, pitch counts and more.
- Fielding: games, assists, put outs, errors, chances, double plays, fielding percentage, range factor, innings.
- Identity on every row: season, group, leaderboard rank, player id and name, team, league (AL / NL), position and the player pool applied.
🔥 Features
- 🛡️ We rotate browser fingerprints (curl-cffi Chrome, Firefox and Safari impersonation) so the source sees a real browser's TLS handshake, not a Python script.
- 🔁 We retry with exponential backoff on rate limits and server
errors, honouring
Retry-After. Up to 5 attempts per page. - 🌐 We rotate proxy sessions through Apify Proxy on every retry, with a fresh session and exit IP each time.
- 🧊 Typed, deduplicated rows. Counts are integers, rates such as AVG and ERA are numbers, and the same player line never appears twice in your dataset.
- 🧱 Fault isolation. One season or group that fails does not end the others; we log it and keep going.
- 💰 You pay only for results that land. No data, no charge (only the
small
actor-startwarm-up fee).
💡 Use cases
- Fantasy and DFS tools: refresh season hitting and pitching lines for projections and waiver-wire dashboards.
- Sports betting and analytics teams: build player-level models from ranked MLB season stats across several years.
- Journalists and bloggers: pull leaderboards for a season in one run instead of copying tables by hand.
- Data science and teaching: a clean, typed baseball dataset for notebooks, courses and BI dashboards.
⚙️ How to use it
- Set
seasons(for example2025) and thegroupsyou want:hitting,pitching,fielding. - Leave
playerPoolonQUALIFIEDfor the qualified leaderboard, or switch toALLto widen it. - Set
maxItemsto bound the run, then start it and export the dataset.
📥 Input
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
seasons | array<string> | no | current year | Four-digit seasons, e.g. 2025. |
groups | array<string> | no | hitting | hitting, pitching, fielding, paged in the order given. |
playerPool | string | no | QUALIFIED | QUALIFIED leaderboard, or ALL players. |
sportId | integer | no | 1 | MLB sport id (1 = Major League Baseball). |
maxItems | integer | no | 100 | Hard cap on total rows across the run (1-50000). |
proxyConfiguration | object | no | Apify Proxy | Apify Proxy configuration. |
Example input
{"seasons": ["2025"],"groups": ["pitching", "hitting"],"playerPool": "QUALIFIED","sportId": 1,"maxItems": 100,"proxyConfiguration": { "useApifyProxy": true }}
📤 Output
One row per player season line in a group. Fields that do not apply to a
group are null. In the pitching group, shared fields such as hits,
homeRuns and strikeOuts are the pitcher's totals allowed or recorded;
use the group column to tell the groups apart.
| Field | Type | Notes |
|---|---|---|
season | integer | Season year. |
group | string | hitting, pitching or fielding. |
rank | integer | null | Leaderboard rank in the group and pool. |
playerId / playerName | integer / string | MLB person id and full name. |
teamId / teamName | integer | null / string | null | Team. |
leagueId / league | integer | null / string | null | League (AL / NL). |
positionCode / positionAbbr / positionName | string | null | Position. |
numTeams | integer | null | Teams the player appeared for that season. |
gamesPlayed, atBats, hits, homeRuns, rbi, ... | integer | null | Count stats. |
avg, obp, slg, ops, era, whip, ... | number | null | Rate stats as numbers. |
inningsPitched, innings | string | null | Baseball notation: 187.2 is 187 and 2/3 innings. |
playerPool / sportId | string / integer | What the feed applied. |
scrapedAt | string | UTC ISO-8601 run timestamp. |
The full column list is in the dataset schema (about 95 fields).
Example output record
{"season": 2025,"group": "hitting","rank": 1,"playerId": 592450,"playerName": "Aaron Judge","teamId": 147,"teamName": "New York Yankees","leagueId": 103,"league": "AL","positionAbbr": "RF","gamesPlayed": 152,"atBats": 541,"hits": 179,"homeRuns": 53,"rbi": 114,"avg": 0.331,"obp": 0.457,"slg": 0.688,"ops": 1.145,"playerPool": "QUALIFIED","scrapedAt": "2026-10-12T08:00:00Z"}
💰 Pricing
Pay-Per-Event: you pay only when these events fire.
| Event | USD | What it is |
|---|---|---|
actor-start | $0.20 | One-off warm-up charge per run |
result-emitted | $0.0015 | Per player season line written to the dataset |
Example: 1 000 rows = $1.70 per run ($0.20 start + 1000 x $0.0015). No subscription, no minimum, no card required to try it.
🚧 Limitations
- Season stats only. This returns season leaderboards by group. Game logs, schedules, rosters and play-by-play are out of scope.
- Qualified by default.
QUALIFIEDreturns the qualified leaderboard (for 2025: 145 hitters, 52 pitchers); switchplayerPooltoALLfor everyone with a stat line. - Traded players. A player who appeared for several teams can show up
on more than one row; check
numTeamsandteamName. - Stat names follow the feed. Fields keep the MLB stats API's own
names, and a field that does not apply to a group is
null. - A season with no data is a success. It finishes with zero rows and a status message naming what was requested.
❓ FAQ
Do I need an MLB API key? No. This reads the official MLB stats API; there is nothing to sign up for.
How do I get both hitting and pitching?
Put both in groups. Each group is paged separately and every row carries
its group.
Why did my run return fewer rows than maxItems?
Either the leaderboard has fewer players than your cap, or you asked for a
single season and group. The status message tells you why each group
stopped.
Can I pull several seasons at once?
Yes. Pass several years to seasons; each season and group is paged in
turn and every row carries its season.
What happens if a page is blocked or fails? We retry up to 5 times with a fresh browser fingerprint and proxy session each time. If a season and group still cannot be read, the others carry on and the status message says so. The run ends as failed only when a page was unreadable and nothing at all could be collected.
Can I run this on a schedule? Yes. Use Apify Schedules to refresh the leaderboard daily during the season.
💬 Your feedback
Found a bug, or need a field we don't return yet? Open an issue on the Actor's Issues tab. We read every one.