baseball-reference.com APIbaseball-reference.com ↗
Access MLB player stats, team rosters, box scores, league leaders, and NCAA D1 college baseball data from Baseball-Reference via a single REST API.
curl -X GET 'https://api.parse.bot/scraper/21934c77-6ae3-4dcd-b3f8-d736f3a15615/get_player_stats?player_id=ohtansh01' \ -H 'X-API-Key: $PARSE_API_KEY'
Get comprehensive player statistics including batting, pitching, and fielding for careers and individual seasons. Returns season-by-season rows for each stat category the player has data for.
| Param | Type | Description |
|---|---|---|
| player_idrequired | string | Baseball-Reference player ID (e.g., 'ohtansh01', 'troutmi01', 'jeterde01') |
{
"type": "object",
"fields": {
"name": "string — player's display name",
"position": "string — primary position (when available)",
"player_id": "string — the requested player ID",
"birth_date": "string — birth date in YYYY-MM-DD format (when available)",
"bats_throws": "string — batting/throwing hand info (when available)",
"batting_stats": "array of season batting stat rows",
"fielding_stats": "array of season fielding stat rows",
"pitching_stats": "array of season pitching stat rows"
},
"sample": {
"data": {
"name": "Shohei Ohtani",
"position": "Designated Hitter and Pitcher",
"player_id": "ohtansh01",
"birth_date": "1994-07-05",
"bats_throws": "Left • Throws: Right",
"batting_stats": [
{
"age": "23",
"b_ab": "367",
"b_hr": "22",
"b_game": "114",
"year_id": "2018",
"team_name_abbr": "LAA"
}
],
"fielding_stats": [
{
"age": "23",
"f_pos": "1",
"year_id": "2018",
"team_name_abbr": "LAA"
}
],
"pitching_stats": [
{
"age": "23",
"p_g": "10",
"p_l": "2",
"p_w": "4",
"year_id": "2018",
"team_name_abbr": "LAA"
}
]
},
"status": "success"
}
}About the baseball-reference.com API
This API exposes 7 endpoints covering MLB and NCAA Division I baseball data from Baseball-Reference, including career and season-level player stats, team rosters, full game box scores with play-by-play, season schedules, league leaders, and college conference rosters. The get_player_stats endpoint returns batting, pitching, and fielding rows broken out by season, while get_box_score delivers per-player lines and play-by-play for any game identified by its game ID.
Player and Team Data
The get_player_stats endpoint accepts a Baseball-Reference player_id (e.g., ohtansh01, troutmi01) and returns the player's display name, position, birth date, bats/throws info, and three separate stat arrays: batting_stats, pitching_stats, and fielding_stats, each containing season-by-season rows. The get_team_stats endpoint takes a four-digit year and a three-letter team_id (e.g., LAD, NYY) and returns the full-season roster with appearance data, plus team_batting and team_pitching arrays covering every player who appeared for that club.
Schedules and Box Scores
get_team_schedule returns a full regular-season game list for a given team and year, with each row including date, opponent, score, and a boxscore link. For individual games, get_box_score accepts a structured game_id — formatted as the three-letter home team code followed by a date string and game number (e.g., LAN202403210) — and returns per-player batting and pitching lines keyed by team table ID, plus a play_by_play array covering every play in the game.
League Leaders and College Coverage
get_league_leaders accepts a year and an optional category of batting or pitching, returning up to 10 leaders per statistical category (e.g., Home Runs, Batting Average) with rank, player name, and team. For college data, get_college_conference_teams lists all Division I teams in a conference given a league_id hash (e.g., 82d1384a for the 2025 SEC), and get_college_team_stats returns roster entries, batting rows, and pitching rows for any team whose team_id hash was discovered from that conference listing.
- Build a fantasy baseball dashboard that pulls season batting and pitching splits for any player using
get_player_stats. - Track a team's win/loss record and run differential across an entire season with
get_team_schedule. - Reconstruct full game narratives by combining
get_box_scorebatting lines and play-by-play entries. - Display MLB home run and strikeout leaders for a given year using
get_league_leaderswith the pitching or batting category. - Compare team ERA and batting average across a season roster via
get_team_statspitching and batting arrays. - Scout NCAA Division I prospects by pulling college team rosters and stats for any SEC or other conference team.
- Populate a historical stats database by iterating known player IDs through
get_player_statsfor multi-decade career records.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 250 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does Baseball-Reference have an official developer API?+
What does `get_box_score` return beyond the basic score, and how do I identify a game?+
batting object and a pitching object, each keyed by team table ID with arrays of individual player lines, plus a full play_by_play array. Game IDs follow the pattern of the three-letter home team code plus date plus game number — for example, LAN202403210 for a Dodgers home game. Team schedules from get_team_schedule include boxscore links that contain the game ID.How do I find the correct college team ID to use with `get_college_team_stats`?+
0294f3dc for LSU). The intended workflow is to call get_college_conference_teams first with a known league_id — the 2025 SEC uses 82d1384a — and extract the id field from the returned teams array. League IDs for conferences outside the confirmed SEC example may require discovery.