Discover/Baseball-Reference API
live

Baseball-Reference 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.

Endpoint health
verified 7d ago
get_college_conference_teams
get_player_stats
get_team_stats
get_team_schedule
get_box_score
7/7 passing latest checkself-healing
Endpoints
7
Updated
22d ago

What is the Baseball-Reference 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.

Try it
Baseball-Reference player ID (e.g., 'ohtansh01', 'troutmi01', 'jeterde01')
api.parse.bot/scraper/21934c77-6ae3-4dcd-b3f8-d736f3a15615/<endpoint>
Ready to send
Fill in the parameters and hit sign in to send to see live response data here.
Call it over HTTPgrab a free API key at signup
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'
Python SDK · recommended

Typed, relational, agent-ready

A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.

  • Fully typed · autocompletes
  • Objects link to objects
  • Typed errors & pagination

Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:

uv add parse-sdk
uv run parse init
uv run parse add --marketplace baseball-reference-com-api

uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.

"""Walkthrough: Baseball-Reference SDK — bounded, re-runnable; every call capped."""
from parse_apis.baseball_reference_api import (
    BaseballReference, LeaderCategory, TeamId, ResourceNotFound
)

client = BaseballReference()

# Get a player's career stats by their Baseball-Reference ID.
player = client.players.get(player_id="ohtansh01")
print(f"Player: {player.name}, Born: {player.birth_date}, Bats/Throws: {player.bats_throws}")

# Inspect batting seasons — each row is one year of stats.
for season in player.batting_stats[:3]:
    print(f"  {season.year_id} ({season.team_name_abbr}): {season.b_hr} HR, {season.b_batting_avg} AVG")

# Get 2024 batting leaders using the LeaderCategory enum.
board = client.leaderboards.get(year=2024)
print(f"\n2024 {board.category} leaders:")
for stat_name, entries in list(board.leaders.items())[:2]:
    top = entries[0]
    print(f"  {stat_name}: {top.player} ({top.team}) — {top.value}")

# Construct a team by abbreviation and fetch its schedule.
dodgers = client.team(team_id=TeamId.LAD)
sched = dodgers.schedule(year=2024)
first_game = sched.schedule[0]
print(f"\nFirst game: vs {first_game.opp_ID}, Result: {first_game.win_loss_result} ({first_game.R}-{first_game.RA})")

# Typed-error catch: look up a non-existent player.
try:
    client.players.get(player_id="nonexist99")
except ResourceNotFound as exc:
    print(f"\nExpected error caught: {exc}")

# College: list SEC conference teams, then get one team's pitching.
sec = client.conferences.get(league_id="82d1384a")
print(f"\n{sec.league_name} — {len(sec.teams)} teams")
first_team_entry = sec.teams[0]
college_team = client.collegeteams.get(team_id=first_team_entry.id)
for pitcher in college_team.pitching[:2]:
    print(f"  {pitcher.player}: {pitcher.W}W-{pitcher.L}L, {pitcher.earned_run_avg} ERA")

print("\nExercised: players.get / leaderboards.get / team.schedule / conferences.get / collegeteams.get")
All endpoints · 7 totalmissing one? ·

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. The player page includes biographical info (position, bats/throws, birth date) and standard stat tables. Players with only batting or only pitching will have the other array empty.

Input
ParamTypeDescription
player_idrequiredstringBaseball-Reference player ID (e.g., 'ohtansh01', 'troutmi01', 'jeterde01')
Response
{
  "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",
      "player_id": "ohtansh01",
      "birth_date": "1994-07-05",
      "bats_throws": "Left",
      "batting_stats": [
        {
          "age": "23",
          "b_hr": "22",
          "b_war": "2.7",
          "b_games": "104",
          "year_id": "2018",
          "b_batting_avg": ".285",
          "team_name_abbr": "LAA"
        }
      ],
      "fielding_stats": [
        {
          "age": "23",
          "f_games": "82",
          "year_id": "2018",
          "f_position": "DH"
        }
      ],
      "pitching_stats": [
        {
          "age": "23",
          "p_l": "2",
          "p_w": "4",
          "p_war": "1.3",
          "year_id": "2018",
          "team_name_abbr": "LAA",
          "p_earned_run_avg": "3.31"
        }
      ]
    },
    "status": "success"
  }
}

About the Baseball-Reference API

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.

Reliability & maintenanceVerified

The Baseball-Reference API is a managed, monitored endpoint for baseball-reference.com — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when baseball-reference.com changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.

This isn't an official baseball-reference.com API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.

Last verified
7d ago
Latest check
7/7 endpoints passing
Maintenance
Monitored & self-healing
Will this API break when the source site changes?+
It's built not to. Every endpoint is health-checked on a schedule with automated test probes. When the source site changes and a check fails, the API is automatically queued for repair and re-verified — that's the self-healing layer. Each API page shows when its endpoints were last verified. And because marketplace APIs are shared, any fix reaches everyone using it.
Is this an official API from the source site?+
No — Parse APIs are independent, managed REST wrappers over publicly available data. That is the point: where a site has no official API (or only a limited one), Parse gives you a maintained, monitored endpoint for that data and keeps it working as the site changes — so you get a stable contract over a source that never promised one.
Can I fix or extend this API myself if I need a new endpoint or field?+
Yes — and you don't have to wait on us. This API was generated by the Parse agent, which stays attached. Describe the change in plain English ("add an endpoint that returns reviews", "fix the price field") in the revise box on the API page or via the revise_api MCP tool, and the agent rebuilds it against the live site in minutes. Contributing the change back to the public API is free.
What happens if I call an endpoint that has an issue?+
Errors are machine-readable: a bad call returns a clean status with the list of available endpoints and a repair hint, so an agent (or you) can recover or trigger a fix instead of failing silently. Confirmed failures feed the automatic repair queue.
Common use cases
  • 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_score batting lines and play-by-play entries.
  • Display MLB home run and strikeout leaders for a given year using get_league_leaders with the pitching or batting category.
  • Compare team ERA and batting average across a season roster via get_team_stats pitching 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_stats for multi-decade career records.
Pricing & limitsSee full pricing →
TierPriceCredits/monthRate limit
Free$0/mo1005 req/min
Hobby$30/mo1,00020 req/min
Developer$100/mo5,000100 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.

Frequently asked questions
Does Baseball-Reference have an official developer API?+
Baseball-Reference does not currently offer a public developer API. Their data is accessible through the website at baseball-reference.com but there is no documented REST or GraphQL API for programmatic access.
What does `get_box_score` return beyond the basic score, and how do I identify a game?+
The endpoint returns a 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`?+
College team IDs are opaque hash strings (e.g., 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.
Does the API cover minor league, international, or historical pre-MLB data?+
Not currently. The API covers MLB seasons and NCAA Division I college baseball through the endpoints above. You can fork this API on Parse and revise it to add endpoints targeting Baseball-Reference's minor league or historical coverage pages.
Are live or in-progress game scores available through this API?+
The data reflects what Baseball-Reference publishes, which is updated after games complete rather than in real time. In-progress scores and live pitch-by-pitch data are not exposed. You can fork this API on Parse and revise it to point at a source that provides live game feeds.
Page content last updated . Spec covers 7 endpoints from baseball-reference.com.
Related APIs in SportsSee all →
pro-football-reference.com API
Access comprehensive NFL data including season schedules, team standings, player statistics, game boxscores, play-by-play details, and player profiles to research teams, players, and game information. Search for specific players and dive into detailed game analysis with boxscore information and minute-by-minute play data.
stats.ncaa.org API
Access comprehensive NCAA sports statistics to search for players, teams, and coaches, view game box scores and play-by-play data, and review team schedules, rosters, and rankings. Get detailed head coach records and scoreboard information to analyze performance across college sports.
mykbostats.com API
Access comprehensive KBO league data including team standings, schedules, rosters, player profiles, and game details to track Korean baseball statistics and performance metrics. Search for players, view depth charts, get foreign player information, and analyze win matrices to stay informed about the Korean Baseball Organization.
cpbl.com.tw API
Access comprehensive CPBL baseball data including live game schedules, detailed box scores, player statistics, and play-by-play game feeds to stay updated on the Chinese Professional Baseball League. Build applications that display team standings, player rosters, news updates, and advanced performance metrics for all CPBL games and athletes.
fbref.com API
Access comprehensive football statistics including player profiles, team performance data, league standings, and detailed match reports all in one place. Search for specific players and teams, compare their stats, and get up-to-date information on leagues and match outcomes.
statmuse.com API
Get instant access to comprehensive sports statistics, player performance data, and team information across NBA, NFL, MLB, NHL, and more using natural language queries. Search for specific athletes or teams and discover historical sports information with intuitive search suggestions.
bleacherreport.com API
Access sports news articles, live scores, and detailed game statistics from Bleacher Report across all major leagues including the NBA, NFL, MLB, and NHL. Retrieve full article content, expert analysis, and box-score data for any supported sport and date.
rotowire.com API
Access MLB player news, statistics, projected lineups, and betting props from RotoWire. Search for players by name, retrieve season stats and performance projections, browse weekly lineup predictions, and explore player prop odds across multiple sportsbooks.