MLB Baseball Stats Scraper avatar

MLB Baseball Stats Scraper

Pricing

from $3.00 / 1,000 results

Go to Apify Store
MLB Baseball Stats Scraper

MLB Baseball Stats Scraper

Scrape the official MLB Stats API - comprehensive baseball data including teams, player batting/pitching stats, schedules, and standings. Official MLB data source, no authentication required.

Pricing

from $3.00 / 1,000 results

Rating

0.0

(0)

Developer

Crawler Bros

Crawler Bros

Maintained by Community

Actor stats

0

Bookmarked

10

Total users

0

Monthly active users

3 days ago

Last modified

Share

Access comprehensive baseball data from the official MLB Stats API — player batting and pitching statistics, team standings, game schedules, and team info. No authentication required. Official MLB data updated in real-time during the season.

What You Can Scrape

ModeData
getPlayerStatsSeason batting or pitching statistics for all players
getStandingsDivision standings for AL and NL
getScheduleGame schedule and results for a date range
getTeamsList all 30 MLB teams with league and division info

Input Parameters

ParameterTypeDefaultDescription
modeselectgetPlayerStatsWhat data to retrieve
statGroupselecthittingType of stats: hitting, pitching, or fielding
seasoninteger2024MLB season year (2019–2024)
teamIdintegerFilter by MLB team ID (e.g. 147 = Yankees). Optional.
startDatetextStart date YYYY-MM-DD for getSchedule mode
endDatetextEnd date YYYY-MM-DD for getSchedule mode
maxItemsinteger50Maximum records to return (1–500)

Output Fields

Player Stats (getPlayerStats)

FieldDescription
playerIdMLB player identifier
playerNamePlayer full name
teamIdTeam identifier
teamNameTeam name
positionPrimary field position
seasonSeason year
gamesPlayedGames played
atBatsAt bats
hitsHits
doublesDoubles
triplesTriples
homeRunsHome runs
rbiRuns batted in
battingAverageBatting average (e.g. ".304")
onBasePercentageOn-base percentage
sluggingPctSlugging percentage
opsOn-base plus slugging
eraEarned run average (pitchers)
winsPitcher wins
lossesPitcher losses
strikeoutsStrikeouts
mlbUrlOfficial MLB player page URL
scrapedAtTimestamp of scraping

Standings (getStandings)

FieldDescription
teamNameTeam name
divisionNameDivision name (e.g. AL East)
leagueNameAmerican League or National League
winsTotal wins
lossesTotal losses
pctWinning percentage
gamesBackGames behind division leader
divisionRankRank within division
streakCodeCurrent streak (e.g. W5, L2)
runsScoredTotal runs scored
runsAllowedTotal runs allowed
runDifferentialRun differential

Schedule (getSchedule)

FieldDescription
gamePkGame primary key
gameDateGame date/time (ISO 8601)
officialDateOfficial game date (YYYY-MM-DD)
homeTeamHome team name
awayTeamAway team name
homeScoreHome team runs scored
awayScoreAway team runs scored
statusGame status (Final, In Progress, etc.)
venueStadium name
mlbUrlOfficial MLB gameday page URL

Teams (getTeams)

FieldDescription
teamIdMLB team identifier
nameFull team name
abbreviation2–3 letter abbreviation (e.g. NYY)
teamNameShort team name (e.g. Yankees)
locationNameCity/location
leagueNameAmerican League or National League
divisionNameDivision (e.g. AL East)
venueNameHome stadium name
activeWhether the team is active
mlbUrlOfficial MLB team page URL

Example Configurations

Get top 2024 batting stats (default, works for daily test):

{
"mode": "getPlayerStats",
"statGroup": "hitting",
"season": 2024,
"maxItems": 30
}

Get 2024 pitching leaders:

{
"mode": "getPlayerStats",
"statGroup": "pitching",
"season": 2024,
"maxItems": 50
}

Get Yankees 2024 batting stats:

{
"mode": "getPlayerStats",
"statGroup": "hitting",
"season": 2024,
"teamId": 147,
"maxItems": 50
}

Get 2024 final standings:

{
"mode": "getStandings",
"season": 2024,
"maxItems": 30
}

Get opening week 2024 schedule:

{
"mode": "getSchedule",
"season": 2024,
"startDate": "2024-03-20",
"endDate": "2024-03-27",
"maxItems": 50
}

Get all 30 MLB teams:

{
"mode": "getTeams",
"season": 2024,
"maxItems": 30
}

Common Team IDs

TeamIDTeamID
New York Yankees147New York Mets121
Boston Red Sox111Los Angeles Dodgers119
Chicago Cubs112San Francisco Giants137
Houston Astros117Atlanta Braves144
Los Angeles Angels108Philadelphia Phillies143
Chicago White Sox145Seattle Mariners136
Toronto Blue Jays141Washington Nationals120

Use Cases

  • Fantasy baseball — pull hitting and pitching stats for player evaluation
  • Sports analytics — aggregate season stats for modeling and predictions
  • Sports dashboards — build standings and stats leaderboards
  • Historical research — analyze player and team performance across seasons (2019–2024)
  • Data pipelines — feed official MLB data into BI tools or databases

Data Source

All data comes from the official MLB Stats API — the same API used by MLB.com and major sports analytics platforms. The API is completely free and requires no authentication.

FAQs

Q: How current is the data? A: Standings and schedules update in real-time during the season. Player stats may have slight delays (typically updated daily).

Q: What seasons are available? A: This scraper supports 2019–2024. The MLB Stats API has historical data going back to 1876, but stat coverage varies for older seasons.

Q: How do I filter by team? A: Set teamId to the MLB team ID. For example, teamId: 147 returns only New York Yankees stats. Leave blank for all teams.

Q: What does statGroup control? A: It switches between hitting (batting stats), pitching (ERA, WHIP, wins), and fielding (errors, putouts, assists).

Q: Is there a cost to use this scraper? A: No. The MLB Stats API is free and public. This scraper requires no proxy or API credentials and runs on the Apify free plan.

Q: Can I get playoff stats? A: The getPlayerStats mode uses regular season (R) data. For playoff-specific stats, adjust the game type via the API parameters if needed in a custom setup.