Skip to main content
Version: 0.0.53

MLB — MLB Stats API

sportsdataverse.mlb — 26 endpoints.

mlb_api_schedule_postseason

GET /api/v1/schedule/postseason — postseason-only schedule for a season.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/schedule/postseason

Valid URL: https://statsapi.mlb.com/api/v1/schedule/postseason

API ParameterPythonPatternRequiredNullable
seasonseasonY
sportIdsport_idY
hydratehydrateY

Returns

GET /api/v1/schedule/postseason — postseason-only schedule for a season.

Example

mlb_api_schedule_postseason()

Last validated n/a.

mlb_api_pbp

GET /api/v1.1/game/{gamePk}/feed/live — live firehose (v1.1).

Endpoint URL: GET https://statsapi.mlb.com/api/v1.1/game/{game_pk}/feed/live

Valid URL: https://statsapi.mlb.com/api/v1.1/game/716390/feed/live

API ParameterPythonPatternRequiredNullable
game_pkgame_pkY
languagelanguageY
languagetimecodeY
hydratehydrateY
fieldsfieldsY

Returns

GET /api/v1.1/game/{gamePk}/feed/live — live firehose (v1.1).

Example

mlb_api_pbp(game_pk=716390)

Last validated n/a.

mlb_api_boxscore

GET /api/v1/game/{gamePk}/boxscore — team + player boxscore for one game.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/game/{game_pk}/boxscore

Valid URL: https://statsapi.mlb.com/api/v1/game/716390/boxscore

API ParameterPythonPatternRequiredNullable
game_pkgame_pkY
timecodetimecodeY
fieldsfieldsY

Returns

GET /api/v1/game/{gamePk}/boxscore — team + player boxscore for one game.

Example

mlb_api_boxscore(game_pk=716390)

Last validated n/a.

mlb_api_linescore

GET /api/v1/game/{gamePk}/linescore — inning-by-inning + current game state.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/game/{game_pk}/linescore

Valid URL: https://statsapi.mlb.com/api/v1/game/716390/linescore

API ParameterPythonPatternRequiredNullable
game_pkgame_pkY
timecodetimecodeY
fieldsfieldsY

Returns

GET /api/v1/game/{gamePk}/linescore — inning-by-inning + current game state.

Example

mlb_api_linescore(game_pk=716390)

Last validated n/a.

mlb_api_play_by_play

GET /api/v1/game/{gamePk}/playByPlay — play-by-play with at-bat detail.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/game/{game_pk}/playByPlay

Valid URL: https://statsapi.mlb.com/api/v1/game/716390/playByPlay

API ParameterPythonPatternRequiredNullable
game_pkgame_pkY
timecodetimecodeY
fieldsfieldsY

Returns

GET /api/v1/game/{gamePk}/playByPlay — play-by-play with at-bat detail.

Example

mlb_api_play_by_play(game_pk=716390)

Last validated n/a.

mlb_api_game_context_metrics

GET /api/v1/game/{gamePk}/contextMetrics — WP, leverage index, in-game context.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/game/{game_pk}/contextMetrics

Valid URL: https://statsapi.mlb.com/api/v1/game/716390/contextMetrics

API ParameterPythonPatternRequiredNullable
game_pkgame_pkY
fieldsfieldsY

Returns

GET /api/v1/game/{gamePk}/contextMetrics — WP, leverage index, in-game context.

Example

mlb_api_game_context_metrics(game_pk=716390)

Last validated n/a.

mlb_api_win_probability

GET /api/v1/game/{gamePk}/winProbability — per-play WP timeline.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/game/{game_pk}/winProbability

Valid URL: https://statsapi.mlb.com/api/v1/game/716390/winProbability

API ParameterPythonPatternRequiredNullable
game_pkgame_pkY
fieldsfieldsY

Returns

GET /api/v1/game/{gamePk}/winProbability — per-play WP timeline.

Example

mlb_api_win_probability(game_pk=716390)

Last validated n/a.

mlb_api_game_content

GET /api/v1/game/{gamePk}/content — articles, highlights, editorial content.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/game/{game_pk}/content

Valid URL: https://statsapi.mlb.com/api/v1/game/716390/content

API ParameterPythonPatternRequiredNullable
game_pkgame_pkY

Returns

GET /api/v1/game/{gamePk}/content — articles, highlights, editorial content.

Example

mlb_api_game_content(game_pk=716390)

Last validated n/a.

mlb_api_team

GET /api/v1/teams/{teamId} — single team detail.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/teams/{team_id}

Valid URL: https://statsapi.mlb.com/api/v1/teams/10

API ParameterPythonPatternRequiredNullable
team_idteam_idY
seasonseasonY
sportIdsport_idY
hydratehydrateY
fieldsfieldsY

Returns

GET /api/v1/teams/{teamId} — single team detail.

Example

mlb_api_team(team_id=10)

Last validated n/a.

mlb_api_team_roster

GET /api/v1/teams/{teamId}/roster — team roster.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/teams/{team_id}/roster

Valid URL: https://statsapi.mlb.com/api/v1/teams/10/roster

API ParameterPythonPatternRequiredNullable
team_idteam_idY
seasonseasonY
rosterTyperoster_typeY
datedateY
hydratehydrateY
fieldsfieldsY

Returns

GET /api/v1/teams/{teamId}/roster — team roster.

Example

mlb_api_team_roster(team_id=10)

Last validated n/a.

mlb_api_team_alumni

GET /api/v1/teams/{teamId}/alumni — players who played for this team in a season.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/teams/{team_id}/alumni

Valid URL: https://statsapi.mlb.com/api/v1/teams/10/alumni

API ParameterPythonPatternRequiredNullable
team_idteam_idY
seasonseasonY
groupgroupY
hydratehydrateY

Returns

GET /api/v1/teams/{teamId}/alumni — players who played for this team in a season.

Example

mlb_api_team_alumni(team_id=10)

Last validated n/a.

mlb_api_team_affiliates

GET /api/v1/teams/affiliates — org affiliates (MLB parent → minor league chain).

Endpoint URL: GET https://statsapi.mlb.com/api/v1/teams/affiliates

Valid URL: https://statsapi.mlb.com/api/v1/teams/affiliates

API ParameterPythonPatternRequiredNullable
teamIdsteam_idsY
sportIdsport_idY
seasonseasonY
hydratehydrateY

Returns

GET /api/v1/teams/affiliates — org affiliates (MLB parent → minor league chain).

Example

mlb_api_team_affiliates()

Last validated n/a.

mlb_api_people

GET /api/v1/people?personIds=... — bulk person lookup by MLBAM id.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/people

Valid URL: https://statsapi.mlb.com/api/v1/people

API ParameterPythonPatternRequiredNullable
personIdsperson_idsY
hydratehydrateY
fieldsfieldsY

Returns

GET /api/v1/people?personIds=... — bulk person lookup by MLBAM id.

Example

mlb_api_people()

Last validated n/a.

mlb_api_person

GET /api/v1/people/{personId} — single person detail.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/people/{person_id}

Valid URL: https://statsapi.mlb.com/api/v1/people/660271

API ParameterPythonPatternRequiredNullable
person_idperson_idY
seasonseasonY
hydratehydrateY
fieldsfieldsY

Returns

GET /api/v1/people/{personId} — single person detail.

Example

mlb_api_person(person_id=660271)

Last validated n/a.

mlb_api_person_game_stats

GET /api/v1/people/{personId}/stats/game/{gamePk} — one player, one game.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/people/{person_id}/stats/game/{game_pk}

Valid URL: https://statsapi.mlb.com/api/v1/people/660271/stats/game/716390

API ParameterPythonPatternRequiredNullable
person_idperson_idY
game_pkgame_pkY
fieldsfieldsY

Returns

GET /api/v1/people/{personId}/stats/game/{gamePk} — one player, one game.

Example

mlb_api_person_game_stats(person_id=660271, game_pk=716390)

Last validated n/a.

mlb_api_sport_players

GET /api/v1/sports/{sportId}/players — every player in a sport for a season.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/sports/{sport_id}/players

Valid URL: https://statsapi.mlb.com/api/v1/sports

API ParameterPythonPatternRequiredNullable
sport_idsport_idY
seasonseasonY
hydratehydrateY
fieldsfieldsY

Returns

GET /api/v1/sports/{sportId}/players — every player in a sport for a season.

Example

mlb_api_sport_players()

Last validated n/a.

mlb_api_sports

GET /api/v1/sports — list known sports (MLB, MiLB, KBO, NPB, …).

Endpoint URL: GET https://statsapi.mlb.com/api/v1/sports

Valid URL: https://statsapi.mlb.com/api/v1/sports

API ParameterPythonPatternRequiredNullable
sportIdsport_idY

Returns

GET /api/v1/sports — list known sports (MLB, MiLB, KBO, NPB, …).

Example

mlb_api_sports()

Last validated n/a.

mlb_api_leagues

GET /api/v1/leagues — list leagues.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/leagues

Valid URL: https://statsapi.mlb.com/api/v1/leagues

API ParameterPythonPatternRequiredNullable
sportIdsport_idY
seasonseasonY
leagueIdsleague_idsY

Returns

GET /api/v1/leagues — list leagues.

Example

mlb_api_leagues()

Last validated n/a.

mlb_api_season

GET /api/v1/seasons/{seasonId} — single season detail.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/seasons/{season_id}

Valid URL: https://statsapi.mlb.com/api/v1/seasons/X

API ParameterPythonPatternRequiredNullable
season_idseason_idY
sportIdsport_idY

Returns

GET /api/v1/seasons/{seasonId} — single season detail.

Example

mlb_api_season(season_id='X')

Last validated n/a.

mlb_api_venues

GET /api/v1/venues — list venues.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/venues

Valid URL: https://statsapi.mlb.com/api/v1/venues

API ParameterPythonPatternRequiredNullable
seasonseasonY
sportIdssport_idsY
hydratehydrateY

Returns

GET /api/v1/venues — list venues.

Example

mlb_api_venues()

Last validated n/a.

mlb_api_venue

GET /api/v1/venues/{venueId} — single venue detail.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/venues/{venue_id}

Valid URL: https://statsapi.mlb.com/api/v1/venues/15

API ParameterPythonPatternRequiredNullable
venue_idvenue_idY
seasonseasonY
hydratehydrateY

Returns

GET /api/v1/venues/{venueId} — single venue detail.

Example

mlb_api_venue(venue_id=15)

Last validated n/a.

mlb_api_meta

GET /api/v1/{metaType} — enum lookup (the API's self-describing surface).

Endpoint URL: GET https://statsapi.mlb.com/api/v1/{meta_type}

Valid URL: https://statsapi.mlb.com/api/v1/leagueLeaderTypes

API ParameterPythonPatternRequiredNullable
meta_typemeta_typeY

Returns

GET /api/v1/{metaType} — enum lookup (the API's self-describing surface).

Example

mlb_api_meta(meta_type='leagueLeaderTypes')

Last validated n/a.

mlb_api_awards

GET /api/v1/awards — list award IDs (call with no params to enumerate).

Endpoint URL: GET https://statsapi.mlb.com/api/v1/awards

Valid URL: https://statsapi.mlb.com/api/v1/awards

API ParameterPythonPatternRequiredNullable
sportIdsport_idY

Returns

GET /api/v1/awards — list award IDs (call with no params to enumerate).

Example

mlb_api_awards()

Last validated n/a.

mlb_api_award_recipients

GET /api/v1/awards/{awardId}/recipients — historical winners of one award.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/awards/{award_id}/recipients

Valid URL: https://statsapi.mlb.com/api/v1/awards/MLBHOF/recipients

API ParameterPythonPatternRequiredNullable
award_idaward_idY
seasonseasonY
sportIdsport_idY
hydratehydrateY

Returns

GET /api/v1/awards/{awardId}/recipients — historical winners of one award.

Example

mlb_api_award_recipients(award_id='MLBHOF')

Last validated n/a.

mlb_api_draft

GET /api/v1/draft/{year} — draft results for a year (optionally one round).

Endpoint URL: GET https://statsapi.mlb.com/api/v1/draft/{year}

Valid URL: https://statsapi.mlb.com/api/v1/draft/2024

API ParameterPythonPatternRequiredNullable
yearyearY
roundround_Y
teamIdteam_idY
playerIdplayer_idY
limitlimitY

Returns

GET /api/v1/draft/{year} — draft results for a year (optionally one round).

Example

mlb_api_draft(year=2024)

Last validated n/a.

mlb_api_umpires

GET /api/v1/jobs/umpires — current umpire crew assignments.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/jobs/umpires

Valid URL: https://statsapi.mlb.com/api/v1/jobs/umpires

API ParameterPythonPatternRequiredNullable

Returns

GET /api/v1/jobs/umpires — current umpire crew assignments.

Example

mlb_api_umpires()

Last validated n/a.