Skip to main content

Overview

This page documents all MLB Stats API endpoints available in the application. Each endpoint includes a description, required parameters, and common use cases.
All endpoints are relative to the base URL: https://statsapi.mlb.com

Sport

List Sports

GET /api/v1/sports
List all sports with their IDs (MLB=1, AAA=11, etc.) and basic metadata. Example Response:
{
  "sports": [
    { "id": 1, "code": "mlb", "name": "Major League Baseball" },
    { "id": 11, "code": "aaa", "name": "Triple-A" }
  ]
}

Get Divisions

GET /api/v1/divisions
Get division info (AL East, NL West, etc.) with standings order; filter by league and season.
leagueId
string
Filter by league: 103 (AL), 104 (NL)
season
string
Year for division alignment

Get Leagues

GET /api/v1/leagues
Get league details (American/National) including season dates and structure.
leagueIds
string
Comma-separated league IDs

Schedule

Get Schedule

GET /api/v1/schedule
Get game schedules by date, date range, team, or venue; returns gamePk IDs needed for other endpoints.
sportId
string
required
Sport ID (1=MLB)
date
string
Specific date (YYYY-MM-DD)
startDate
string
Start of date range
endDate
string
End of date range
teamId
string
Filter by team ID
venueIds
string
Filter by venue ID(s)
fields
string
Field filtering (e.g., "dates,games,officialDate,teams,team,name")

Get Postseason Schedule

GET /api/v1/schedule/postseason
Get postseason bracket and series info (World Series, LCS, LDS); includes series status and game results.
gameTypes
string
Filter by game type: W (World Series), L (LCS), D (LDS)
season
string
required
Postseason year
teamId
string
Filter by team ID

Game

Get Live Game Feed

GET /api/v1.1/game/{gamePk}/feed/live
Complete live game feed with all plays, runners, count, matchups; use timecode to get state at specific moment.
gamePk
string
required
Game primary key (e.g., 813024)
timecode
string
Get game state at specific time (format: YYYYMMDD_HHMMSS)
fields
string
Field filtering

Get Boxscore

GET /api/v1/game/{gamePk}/boxscore
Traditional box score with batting/pitching lines, player stats, and game totals for a specific game.
gamePk
string
required
Game primary key

Get Linescore

GET /api/v1/game/{gamePk}/linescore
Inning-by-inning runs, hits, errors; current inning state for live games.
gamePk
string
required
Game primary key

Get Game Content

GET /api/v1/game/{gamePk}/content
Game media content including highlight videos, editorial recap, and photo galleries.
gamePk
string
required
Game primary key

Get Context Metrics

GET /api/v1/game/{gamePk}/contextMetrics
Advanced context stats like leverage index, win expectancy, and championship probability added.
gamePk
string
required
Game primary key

Get Win Probability

GET /api/v1/game/{gamePk}/winProbability
Win probability after each play; shows how each at-bat shifted the odds for home/away teams.
gamePk
string
required
Game primary key

Get Play by Play

GET /api/v1/game/{gamePk}/playByPlay
Chronological list of all plays with descriptions; lighter than live feed for historical games.
gamePk
string
required
Game primary key

Get Game Changes

GET /api/v1/game/changes
List of games updated since a given date/time; useful for syncing or tracking postponements.
sportId
string
required
Sport ID
updatedSince
string
required
ISO date to check for updates

Get Game Pace

GET /api/v1/gamePace
Pace of play statistics for a season: average game time, pitches per game, time between pitches.
sportId
string
required
Sport ID
season
string
required
Season year

Teams

List Teams

GET /api/v1/teams
List all teams with IDs, names, abbreviations, venue, and league/division info; filter by sport and season.
sportId
string
Filter by sport ID
season
string
Filter by season year

Get Team Details

GET /api/v1/teams/{teamId}
Detailed team info: full name, venue, league, division, first year, and social media links.
teamId
string
required
Team ID (e.g., 119 for Dodgers)

Get Team Roster

GET /api/v1/teams/{teamId}/roster
Current or historical roster with player IDs, positions, jersey numbers, and status.
teamId
string
required
Team ID
season
string
Season year for roster
hydrate
string
Set to "person" to include player details

Get Team Coaches

GET /api/v1/teams/{teamId}/coaches
Current coaching staff with coach IDs, names, positions, and status.
teamId
string
required
Team ID
season
string
Season year for coaching staff

Get Team History

GET /api/v1/teams/{teamId}/history
Franchise history including former names, cities, leagues, and championship seasons.
teamId
string
required
Team ID

Get Team Affiliates

GET /api/v1/teams/{teamId}/affiliates
Minor league affiliates (AAA, AA, A+, A, Rookie) with team names and league info.
teamId
string
required
Team ID

People

Get Person Details

GET /api/v1/people/{personId}
Player bio: birthDate, birthCity, height, weight, position, bats/throws, draft info, MLB debut date.
personId
string
required
Player ID (e.g., 660271 for Shohei Ohtani)
hydrate
string
Add related data (e.g., "currentTeam")

Get Person Stats

GET /api/v1/people/{personId}/stats
Player statistics: season or career totals for hitting/pitching/fielding; filter by gameType (regular/postseason).
personId
string
required
Player ID
stats
string
required
Stat type: season, career, hotColdZones
group
string
required
Stat group: hitting, pitching, fielding
seasons
string
Comma-separated years or single year
gameType
string
Filter by game type: R (regular), P (playoffs)

Get Person Game Stats

GET /api/v1/people/{personId}/stats/game/{gamePk}
Player’s stats from a specific game: at-bats, hits, RBIs, innings pitched, strikeouts, etc.
personId
string
required
Player ID
gamePk
string
required
Game primary key

Get Free Agents

GET /api/v1/people/freeAgents
List of free agents for a given offseason with their previous team and contract status.
season
string
required
Offseason year

Get People Changes

GET /api/v1/people/changes
Players whose records changed since a date; useful for tracking roster moves and data updates.
updatedSince
string
required
ISO date to check for updates

Search People

GET /api/v1/people/search
Search players by name (partial match); use this first to find personId for other queries.
names
string
required
Player name or partial name

Standings

Get Standings

GET /api/v1/standings
Current standings with W-L record, PCT, GB, streak, last 10, home/away splits by league/division.
leagueId
string
required
League ID: 103 (AL), 104 (NL), 103,104 (both)
season
string
required
Season year

Stats

Get Stats

GET /api/v1/stats
General stats query for aggregated league-wide statistics by season and stat group.
stats
string
required
Stat type: season, career
group
string
required
Stat group: hitting, pitching, fielding
season
string
required
Season year

Get Leaders

GET /api/v1/stats/leaders
League leaders in specific categories (HR, AVG, ERA, etc.); regular season or playoffs.
leaderCategories
string
required
Stat category: homeRuns, battingAverage, earnedRunAverage, etc.
leaderGameTypes
string
required
Game type: R (regular season), P (playoffs)
statGroup
string
required
Stat group: hitting, pitching
season
string
required
Season year

Other

Get Seasons

GET /api/v1/seasons
Season metadata: regular season start/end dates, All-Star date, postseason dates, spring training info.
sportId
string
required
Sport ID
season
string
required
Season year

Get Venues

GET /api/v1/venues
Ballpark info: location, capacity, dimensions, surface type, roof type, and timezone.
venueIds
string
required
Comma-separated venue IDs

Get Draft

GET /api/v1/draft/{year}
MLB Draft results by year: all rounds and picks with player info, school, and signing bonus.
year
string
required
Draft year

Get Transactions

GET /api/v1/transactions
Roster transactions: trades, signings, DFA, IL moves, call-ups; filter by team, player, or date range.
sportId
string
required
Sport ID
teamId
string
Filter by team ID
playerId
string
Filter by player ID
date
string
Specific date
startDate
string
Start of date range
endDate
string
End of date range

Get Jobs

GET /api/v1/jobs/{jobType}
Game officials by type: umpire crews, official scorers, and datacasters assigned to games.
jobType
string
required
Job type: umpires, officialScorers, datacasters
date
string
required
Date for assignments

Get Uniforms

GET /api/v1/uniforms/game
Uniform details for specific games: jersey style, cap, pants, and special event gear.
gamePks
string
required
Comma-separated game IDs

Get Attendance

GET /api/v1/attendance
Attendance figures by team and season: total, average, home/away, and capacity percentage.
teamId
string
required
Team ID
season
string
required
Season year

Meta

Get Baseball Stats

GET /api/v1/baseballStats
All available stat types and categories (homeRuns, battingAverage, era, wins, etc.) used in stats endpoints.

Get Game Status

GET /api/v1/gameStatus
All possible game status codes (Scheduled, In Progress, Final, Postponed, etc.) with descriptions.

Get Game Types

GET /api/v1/gameTypes
Game type codes: R=Regular Season, S=Spring Training, P=Playoffs, W=World Series, etc.

Build docs developers (and LLMs) love