MLB Stats Scraper — Games & Boxscores avatar

MLB Stats Scraper — Games & Boxscores

Pricing

$8.00 / 1,000 record scrapeds

Go to Apify Store
MLB Stats Scraper — Games & Boxscores

MLB Stats Scraper — Games & Boxscores

Extract MLB game schedules, final scores, inning-by-inning linescores, and player batting/pitching statistics for any team and season from the official MLB Stats API. Get team names, venues, and season stats as clean JSON. Failed runs are not billed.

Pricing

$8.00 / 1,000 record scrapeds

Rating

0.0

(0)

Developer

Antony Zaikin

Antony Zaikin

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

9 days ago

Last modified

Share

MLB Stats Apify Actor

Fetches MLB team statistics from the official MLB Advanced Media API (statsapi.mlb.com).

Features

  • Resolves team by name, abbreviation, or numeric ID
  • Retrieves schedule for a given season
  • Filters for finished games (Final status)
  • Optionally includes boxscore (player season statistics)
  • Optionally includes linescore (inning-by-inning scoring)
  • Handles API inconsistencies (406 errors) with retry logic
  • Pay-per-event charging (record-scraped)

Input

FieldTypeDescriptionDefault
teamstringTeam name, abbreviation, or numeric ID (case-insensitive)NYY
seasonintegerMLB season year (e.g., 2026)2026
maxGamesintegerNumber of most recent finished games to process (1-30)5
includeBoxscorebooleanFetch player statistics from boxscore endpointtrue
includeLinescorebooleanFetch inning-by-inning scoring from linescore endpointtrue

Output

Each record represents a game with the following structure:

{
"kind": "game",
"gamePk": 824235,
"date": "2026-08-24",
"status": "Final",
"homeTeam": "Detroit Tigers",
"awayTeam": "Tampa Bay Rays",
"homeScore": 0,
"awayScore": 2,
"venue": "Comerica Park",
"innings": [
{
"num": 1,
"home": { "runs": 0, "hits": 0, "errors": 1 },
"away": { "runs": 2, "hits": 3, "errors": 0 }
}
],
"homePlayers": [
{
"personId": 667452,
"fullName": "Corey Julks",
"position": "LF",
"batting": { "gamesPlayed": 3, "avg": ".333", ... },
"pitching": { "gamesPlayed": 0, "era": "-.--", ... }
}
],
"awayPlayers": [ ... ]
}

If no finished games are found, a single schedule_empty record is pushed.

Notes

  • Uses only the public MLB API (statsapi.mlb.com) - no HTML parsing or headless browser
  • Handles known API quirks (406 errors) by retrying with trailing slash in URL
  • Implements exponential backoff for network errors and 5xx/429 responses
  • Continues processing even if individual game data fails to fetch
  • Charges record-scraped event for each successfully pushed record

Example

Default input (New York Yankees, 2026 season, 5 most recent games):

{}