Skip to main content

MLB — MLB Stats API — All

mlb_all_star_ballot​

View All-Star Ballots per league.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/league/{league_id}/allStarBallot

Valid URL: https://statsapi.mlb.com/api/v1/league/103/allStarBallot?season=2023

API ParameterPythonPatternRequiredNullableDescription
league_idleague_idYleague_id path parameter.
seasonseasonYSeason year (e.g. 2024).
fieldsfieldsYfields query parameter.

Returns​

return_parsed=True (default) — a tidy polars.DataFrame with the columns below; pass return_as_pandas=True for a pandas.DataFrame.

col_nametypedescription
idintegerId.
full_namecharacterPlayer's full name.
linkcharacterAPI link to the game feed.
first_namecharacterPlayer first name.
last_namecharacterPlayer last name.
primary_numbercharacterPlayer uniform number.
birth_datecharacterDate of birth (YYYY-MM-DD).
current_ageintegerCurrent age in years.
birth_citycharacterCity of birth.
birth_countrycharacterCountry of birth.
heightcharacterHeight (feet and inches).
weightintegerWeight in pounds.
activelogicalWhether the player is currently active.
use_namecharacterPreferred first name.
use_last_namecharacterPreferred last name.
middle_namecharacterPlayer middle name.
boxscore_namecharacterName as shown in box scores.
nick_namecharacterPlayer nickname.
gendercharacterPlayer gender.
name_matrilinealcharacterMaternal family name.
is_playerlogicalWhether the person is a player.
is_verifiedlogicalWhether the player profile is verified.
pronunciationcharacterPhonetic name pronunciation.
last_played_datecharacterDate of last MLB game played.
mlb_debut_datecharacterMLB debut date (YYYY-MM-DD).
name_first_lastcharacterName in first-last order.
name_slugcharacterURL-friendly name slug.
first_last_namecharacterFirst and last name.
last_first_namecharacterName in last, first order.
last_init_namecharacterLast name with first initial.
init_last_namecharacterFirst initial with last name.
full_fml_namecharacterFull name (first-middle-last).
full_lfm_namecharacterFull name (last-first-middle).
strike_zone_topdoubleTop of the player's strike zone (feet).
strike_zone_bottomdoubleBottom of the player's strike zone (feet).
primary_position_codecharacterPrimary position code.
primary_position_namecharacterPrimary fielding position name.
primary_position_typecharacterPrimary position type (e.g. Infielder).
primary_position_abbreviationcharacterPrimary position abbreviation.
bat_side_codecharacterBatting side code (L/R/S).
bat_side_descriptioncharacterBatting side description.
pitch_hand_codecharacterThrowing hand code (L/R).
pitch_hand_descriptioncharacterThrowing hand description.
birth_state_provincecharacterState or province of birth.
draft_yeardoubleYear the player was drafted.
name_titlecharacterName title.
name_suffixcharacterName suffix (e.g. Jr., Sr., III).

return_parsed=False — the raw JSON Dict payload, unparsed.

Example​

mlb_all_star_ballot(league_id='103', season='2023')

Last validated n/a.

mlb_all_star_write_ins​

View All-Star Write-ins per league.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/league/{league_id}/allStarWriteIns

Valid URL: https://statsapi.mlb.com/api/v1/league/103/allStarWriteIns?season=2023

API ParameterPythonPatternRequiredNullableDescription
league_idleague_idYleague_id path parameter.
seasonseasonYSeason year (e.g. 2024).
fieldsfieldsYfields query parameter.

Returns​

return_parsed=True (default) — a tidy polars.DataFrame with the columns below; pass return_as_pandas=True for a pandas.DataFrame.

col_nametypedescription
idintegerId.
full_namecharacterPlayer's full name.
linkcharacterAPI link to the game feed.
first_namecharacterPlayer first name.
last_namecharacterPlayer last name.
birth_datecharacterDate of birth (YYYY-MM-DD).
current_ageintegerCurrent age in years.
birth_citycharacterCity of birth.
birth_state_provincecharacterState or province of birth.
birth_countrycharacterCountry of birth.
heightcharacterHeight (feet and inches).
weightintegerWeight in pounds.
activelogicalWhether the player is currently active.
use_namecharacterPreferred first name.
use_last_namecharacterPreferred last name.
boxscore_namecharacterName as shown in box scores.
gendercharacterPlayer gender.
is_playerlogicalWhether the person is a player.
is_verifiedlogicalWhether the player profile is verified.
pronunciationcharacterPhonetic name pronunciation.
mlb_debut_datecharacterMLB debut date (YYYY-MM-DD).
name_first_lastcharacterName in first-last order.
name_slugcharacterURL-friendly name slug.
first_last_namecharacterFirst and last name.
last_first_namecharacterName in last, first order.
last_init_namecharacterLast name with first initial.
init_last_namecharacterFirst initial with last name.
full_fml_namecharacterFull name (first-middle-last).
full_lfm_namecharacterFull name (last-first-middle).
strike_zone_topdoubleTop of the player's strike zone (feet).
strike_zone_bottomdoubleBottom of the player's strike zone (feet).
bat_side_codecharacterBatting side code (L/R/S).
bat_side_descriptioncharacterBatting side description.
pitch_hand_codecharacterThrowing hand code (L/R).
pitch_hand_descriptioncharacterThrowing hand description.
primary_numbercharacterPlayer uniform number.
draft_yeardoubleYear the player was drafted.
middle_namecharacterPlayer middle name.
name_matrilinealcharacterMaternal family name.
last_played_datecharacterDate of last MLB game played.
nick_namecharacterPlayer nickname.
name_titlecharacterName title.
name_suffixcharacterName suffix (e.g. Jr., Sr., III).

return_parsed=False — the raw JSON Dict payload, unparsed.

Example​

mlb_all_star_write_ins(league_id='103', season='2023')

Last validated n/a.

mlb_all_star_final_vote​

View All-Star Final Vote per league.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/league/{league_id}/allStarFinalVote

Valid URL: https://statsapi.mlb.com/api/v1/league/103/allStarFinalVote?season=2023

API ParameterPythonPatternRequiredNullableDescription
league_idleague_idYleague_id path parameter.
seasonseasonYSeason year (e.g. 2024).
fieldsfieldsYfields query parameter.

Returns​

return_parsed=True (default) — a tidy polars.DataFrame with the columns below; pass return_as_pandas=True for a pandas.DataFrame.

col_nametypedescription
idintegerId.
full_namecharacterPlayer's full name.
linkcharacterAPI link to the game feed.
first_namecharacterPlayer first name.
last_namecharacterPlayer last name.
primary_numbercharacterPlayer uniform number.
birth_datecharacterDate of birth (YYYY-MM-DD).
current_ageintegerCurrent age in years.
birth_citycharacterCity of birth.
birth_countrycharacterCountry of birth.
heightcharacterHeight (feet and inches).
weightintegerWeight in pounds.
activelogicalWhether the player is currently active.
use_namecharacterPreferred first name.
use_last_namecharacterPreferred last name.
boxscore_namecharacterName as shown in box scores.
nick_namecharacterPlayer nickname.
gendercharacterPlayer gender.
is_playerlogicalWhether the person is a player.
is_verifiedlogicalWhether the player profile is verified.
pronunciationcharacterPhonetic name pronunciation.
mlb_debut_datecharacterMLB debut date (YYYY-MM-DD).
name_first_lastcharacterName in first-last order.
name_slugcharacterURL-friendly name slug.
first_last_namecharacterFirst and last name.
last_first_namecharacterName in last, first order.
last_init_namecharacterLast name with first initial.
init_last_namecharacterFirst initial with last name.
full_fml_namecharacterFull name (first-middle-last).
full_lfm_namecharacterFull name (last-first-middle).
strike_zone_topdoubleTop of the player's strike zone (feet).
strike_zone_bottomdoubleBottom of the player's strike zone (feet).
primary_position_codecharacterPrimary position code.
primary_position_namecharacterPrimary fielding position name.
primary_position_typecharacterPrimary position type (e.g. Infielder).
primary_position_abbreviationcharacterPrimary position abbreviation.
bat_side_codecharacterBatting side code (L/R/S).
bat_side_descriptioncharacterBatting side description.
pitch_hand_codecharacterThrowing hand code (L/R).
pitch_hand_descriptioncharacterThrowing hand description.
name_matrilinealcharacterMaternal family name.
birth_state_provincecharacterState or province of birth.
name_titlecharacterName title.
name_suffixcharacterName suffix (e.g. Jr., Sr., III).
middle_namecharacterPlayer middle name.
draft_yeardoubleYear the player was drafted.
last_played_datecharacterDate of last MLB game played.

return_parsed=False — the raw JSON Dict payload, unparsed.

Example​

mlb_all_star_final_vote(league_id='103', season='2023')

Last validated n/a.