Skip to main content

MLB — MLB Stats API — Other: meta–stats_metrics

mlb_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 ParameterPythonPatternRequiredNullableDescription
meta_typemeta_typeYmeta_type path parameter.

Returns​

return_parsed=True (default) — a tidy polars.DataFrame (parser: parse_mlb_api_list); pass return_as_pandas=True for a pandas.DataFrame. return_parsed=False — the raw JSON Dict payload, unparsed.

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help.
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty.

Example​

mlb_meta(meta_type='leagueLeaderTypes')

mlb_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 ParameterPythonPatternRequiredNullableDescription
sportIdsport_idYsportId 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
idStringId.
nameStringDisplay name.
descriptionStringLong-form description text.
sort_orderFloat64Display sort order for the sport.
activeBooleanWhether the player is currently active.
sport_idFloat64Sport MLBAM ID.
sport_linkStringAPI link to the sport.
league_idFloat64League MLBAM ID.
league_linkStringAPI link to the league.
notesStringNotes.

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

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help.
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty.

Example​

mlb_awards()

mlb_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?sportId=1

API ParameterPythonPatternRequiredNullableDescription
award_idaward_idYaward_id path parameter.
seasonseasonYSeason year (e.g. 2024).
sportIdsport_idYsportId query parameter.
hydratehydrateYhydrate 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
idStringId.
nameStringDisplay name.
dateStringDate in YYYY-MM-DD format.
seasonStringSeason year.
team_idInt64Unique ESPN team identifier.
team_linkStringAPI link to the team.
player_idInt64stats.ncaa.org player identifier.
player_linkStringAPI relative link to the player.
player_primary_position_codeStringRecipient primary fielding position code.
player_primary_position_nameStringRecipient primary fielding position name.
player_primary_position_typeStringParticipant primary position type (e.g. 'Hitter').
player_primary_position_abbreviationStringParticipant primary position abbreviation (e.g. 'DH').
player_name_first_lastStringParticipant name in first-last order.
votesFloat64Number of votes received.

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

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help.
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty.

Example​

mlb_award_recipients(award_id='MLBHOF')

mlb_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 ParameterPythonPatternRequiredNullableDescription

Returns​

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

col_nametypedescription
jersey_numberStringJersey number worn (often blank for non-uniformed roles).
jobStringJob title (e.g. 'Umpire').
job_idStringJob code identifier.
titleStringSpecific role title for the assignment.
person_idInt64MLB player ID.
person_full_nameStringPlayer full name.
person_linkStringAPI relative link to the person.

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

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help.
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty.

Example​

mlb_umpires()

mlb_conferences​

View all PCL conferences.

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

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

API ParameterPythonPatternRequiredNullableDescription
conferenceIdconference_idYconferenceId query 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
idInt64Id.
nameStringDisplay name.
linkStringAPI link to the game feed.
abbreviationStringShort abbreviation.
has_wildcardBooleanWhether the season has a wild card round.
name_shortString
league_idInt64League MLBAM ID.
league_linkStringAPI link to the league.
sport_idInt64Sport MLBAM ID.
sport_linkStringAPI link to the sport.

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

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help.
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty.

Example​

mlb_conferences()

mlb_conference​

View PCL conferences by conferenceId.

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

Valid URL: https://statsapi.mlb.com/api/v1/conferences/301

API ParameterPythonPatternRequiredNullableDescription
conference_idconference_idYconference_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
idInt64Id.
nameStringDisplay name.
linkStringAPI link to the game feed.
abbreviationStringShort abbreviation.
has_wildcardBooleanWhether the season has a wild card round.
name_shortString
league_idInt64League MLBAM ID.
league_linkStringAPI link to the league.
sport_idInt64Sport MLBAM ID.
sport_linkStringAPI link to the sport.

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

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help.
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty.

Example​

mlb_conference(conference_id=301)

mlb_analytics_games​

View timestamps of most recent data corrections made to games.

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

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

API ParameterPythonPatternRequiredNullableDescription
gameModeIdgame_mode_idYgameModeId query parameter.
timecodetimecodeYtimecode query parameter.
limitlimitYMaximum number of items to return.
sortBysort_byYsortBy query parameter.
isNonStatcastis_non_statcastYisNonStatcast query parameter.
offsetoffsetYoffset query parameter.
fieldsfieldsYfields query parameter.

Returns​

return_parsed=True (default) — the output of parse_mlb_api_list; pass return_as_pandas=True for a pandas.DataFrame.

No returns table is published for this endpoint: no capture: statsapi.mlb.com answers 406 to the datacenter IP and 404 through the residential proxy with the documented example arguments (2026-10-07).

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

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help.
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty.

Example​

mlb_analytics_games()

mlb_analytics_guids​

View timestamps of most recent data corrections made to GUIDs.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/game/analytics/guids

Valid URL: https://statsapi.mlb.com/api/v1/game/analytics/guids

API ParameterPythonPatternRequiredNullableDescription
gameModeIdgame_mode_idYgameModeId query parameter.
timecodetimecodeYtimecode query parameter.
limitlimitYMaximum number of items to return.
sortBysort_byYsortBy query parameter.
isNonStatcastis_non_statcastYisNonStatcast query parameter.
offsetoffsetYoffset query parameter.
fieldsfieldsYfields query parameter.

Returns​

return_parsed=True (default) — the output of parse_mlb_api_list; pass return_as_pandas=True for a pandas.DataFrame.

No returns table is published for this endpoint: no capture: statsapi.mlb.com answers 406 to the datacenter IP and 401 'Please Login' through the residential proxy; the route needs an MLB login session the package does not hold.

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

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help.
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty.

Example​

mlb_analytics_guids()

mlb_high_low​

View high/low stats by player or team.

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

Valid URL: https://statsapi.mlb.com/api/v1/highLow/player?statGroup=hitting&sortStat=homeRuns&season=2023

API ParameterPythonPatternRequiredNullableDescription
org_typeorg_typeYorg_type path parameter.
statGroupstat_groupYstatGroup query parameter.
sortStatsort_statYsortStat query parameter.
seasonseasonYSeason year (e.g. 2024).
gameTypegame_typeYgameType query parameter.
teamIdteam_idYteamId query parameter.
leagueIdleague_idYleagueId query parameter.
sportIdssport_idsYsportIds query parameter.
limitlimitYMaximum number of items to return.
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
total_splitsInt64Total number of splits in the leaderboard.
exemptionsStringSerialized list of exemption codes or player IDs excluded from the high/low statistical split calculation.
splitsStringSplits.
splits_tied_with_offsetStringPlayers tied at the offset boundary.
splits_tied_with_limitStringPlayers tied at the limit boundary.
seasonStringSeason year.
combined_statsBooleanWhether the stat combines multiple split sources.
group_display_nameStringStat group display name.
game_type_idStringGame type code (e.g., R for regular season).
game_type_descriptionStringGame type description.
sort_stat_nameStringSnake-case name of the sorted statistic (e.g. 'at_bats').
sort_stat_lookup_paramStringAPI lookup parameter for the sorted statistic (e.g. 'atBats').
sort_stat_is_countingBooleanWhether the sorted statistic is a counting stat.
sort_stat_labelStringHuman-readable label of the sorted statistic (e.g. 'At bats').
sort_stat_stat_groupsStringSerialized list of statistical group identifiers (e.g., hitting, pitching) used to filter this high/low query.
sort_stat_org_typesStringSerialized list of organization types (e.g., MLB, MiLB) in scope for this high/low stat sort.
sort_stat_high_low_typesStringSerialized list of high/low result type codes (e.g., high, low) applicable to this stat leader query.
sort_stat_streak_levelsStringSerialized list of streak level codes defining the streak lengths tracked in this high/low query.

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

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help.
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty.

Example​

mlb_high_low(org_type='player', stat_group='hitting', sort_stat='homeRuns', season='2023')

mlb_free_agents​

View biographical information and stats for Free Agents.

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

Valid URL: https://statsapi.mlb.com/api/v1/people/freeAgents?season=2023

API ParameterPythonPatternRequiredNullableDescription
seasonseasonYSeason year (e.g. 2024).
orderorderYorder query parameter.
hydratehydrateYhydrate query parameter.
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
notesStringNotes.
date_declaredStringDate the player declared free agency (YYYY-MM-DD).
player_idInt64stats.ncaa.org player identifier.
player_full_nameStringPlayer full name.
player_linkStringAPI relative link to the player.
original_team_idFloat64Team id the player left.
original_team_nameStringName of the team the player left.
original_team_linkStringAPI relative link to the original team.
new_team_linkStringAPI relative link to the new team.
position_codeStringNumeric scorekeeping position code.
position_nameStringPosition name.
position_typeStringPosition category (e.g. 'Pitcher', 'Infielder').
position_abbreviationStringPosition abbreviation.
date_signedStringDate the player signed a new contract (YYYY-MM-DD).
new_team_idFloat64Team id the player signed with.
new_team_nameStringName of the team the player signed with.
sort_orderFloat64Display sort order for the sport.

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

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help.
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty.

Example​

mlb_free_agents(season='2023')

mlb_jobs​

View directory by jobType.

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

Valid URL: https://statsapi.mlb.com/api/v1/jobs?jobType=UMPR

API ParameterPythonPatternRequiredNullableDescription
jobTypejob_typeYjobType query parameter.
sportIdsport_idYsportId query parameter.
datedateYdate query parameter.
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
jersey_numberStringJersey number worn (often blank for non-uniformed roles).
jobStringJob title (e.g. 'Umpire').
job_idStringJob code identifier.
titleStringSpecific role title for the assignment.
person_idInt64MLB player ID.
person_full_nameStringPlayer full name.
person_linkStringAPI relative link to the person.

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

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help.
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty.

Example​

mlb_jobs(job_type='UMPR')

mlb_datacasters​

View datacasters directory.

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

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

API ParameterPythonPatternRequiredNullableDescription
sportIdsport_idYsportId query parameter.
datedateYdate query parameter.
hydratehydrateYhydrate query parameter.
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
jersey_numberStringJersey number worn (often blank for non-uniformed roles).
jobStringJob title (e.g. 'Umpire').
job_idStringJob code identifier.
titleStringSpecific role title for the assignment.
person_idInt64MLB player ID.
person_full_nameStringPlayer full name.
person_linkStringAPI relative link to the person.

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

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help.
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty.

Example​

mlb_datacasters()

mlb_official_scorers​

View official scorer directory.

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

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

API ParameterPythonPatternRequiredNullableDescription
sportIdsport_idYsportId query parameter.
datedateYdate query parameter.
hydratehydrateYhydrate query parameter.
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
jersey_numberStringJersey number worn (often blank for non-uniformed roles).
jobStringJob title (e.g. 'Umpire').
job_idStringJob code identifier.
titleStringSpecific role title for the assignment.
person_idInt64MLB player ID.
person_full_nameStringPlayer full name.
person_linkStringAPI relative link to the person.

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

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help.
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty.

Example​

mlb_official_scorers()

mlb_umpire_games​

Get umpires and associated game for umpireId.

Endpoint URL: GET https://statsapi.mlb.com/api/v1/jobs/umpires/games/{umpire_id}

Valid URL: https://statsapi.mlb.com/api/v1/jobs/umpires/games/596809?season=2023

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

Returns​

return_parsed=True (default) — the output of parse_mlb_api_list; pass return_as_pandas=True for a pandas.DataFrame.

No returns table is published for this endpoint: no capture: statsapi.mlb.com answers 406 to the datacenter IP and 401 'Please Login' through the residential proxy; the route needs an MLB login session the package does not hold.

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

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help.
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty.

Example​

mlb_umpire_games(umpire_id=596809, season='2023')

mlb_seasons_all​

View information for all seasons based on id.

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

Valid URL: https://statsapi.mlb.com/api/v1/seasons/all?sportId=1

API ParameterPythonPatternRequiredNullableDescription
divisionIddivision_idYdivisionId query parameter.
leagueIdleague_idYleagueId query parameter.
withGameTypeDateswith_game_type_datesYwithGameTypeDates query parameter.
sportIdsport_idYsportId query parameter.
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
season_idStringstats.ncaa.org season identifier.
has_wildcardBooleanWhether the season has a wild card round.
pre_season_start_dateStringPre-season start date.
season_start_dateStringSeason start date.
regular_season_start_dateStringRegular season start date.
regular_season_end_dateStringRegular season end date.
season_end_dateStringSeason end date.
offseason_start_dateStringOff-season start date.
off_season_end_dateStringOff-season end date.
season_level_gameday_typeStringSeason-level Gameday data feed type.
game_level_gameday_typeStringGame-level Gameday data feed type.
qualifier_plate_appearancesFloat64Plate appearances per team game to qualify.
qualifier_outs_pitchedFloat64Outs pitched per team game to qualify.
post_season_start_dateStringPost-season start date.
post_season_end_dateStringPost-season end date.
last_date1st_halfStringLast date of the first half.
all_star_dateStringAll-Star Game date.
first_date2nd_halfStringFirst date of the second half.
pre_season_end_dateStringPre-season end date.
spring_start_dateStringSpring training start date.
spring_end_dateStringSpring training end date.

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

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help.
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty.

Example​

mlb_seasons_all(sport_id=1)

mlb_sport​

View information for any given sportId.

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

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

API ParameterPythonPatternRequiredNullableDescription
sport_idsport_idYsport_id path parameter.
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
idInt64Id.
codeStringFielder detail type code.
linkStringAPI link to the game feed.
nameStringDisplay name.
abbreviationStringShort abbreviation.
sort_orderInt64Display sort order for the sport.
active_statusBooleanWhether the sport/level is active.

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

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help.
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty.

Example​

mlb_sport(sport_id=1)

mlb_stats_metrics​

View Statcast stats.

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

Valid URL: https://statsapi.mlb.com/api/v1/stats/metrics

API ParameterPythonPatternRequiredNullableDescription
statsstatsYstats query parameter.
groupgroupYConference or group id filter (e.g. an ESPN conference id).
gameTypegame_typeYgameType query parameter.
seasonseasonYSeason year (e.g. 2024).
startDatestart_dateYstartDate query parameter.
endDateend_dateYendDate query parameter.
venueIdvenue_idYvenueId query parameter.
minOccurrencesmin_occurrencesYminOccurrences query parameter.
percentilepercentileYpercentile query parameter.
personIdperson_idYpersonId query parameter.
teamIdteam_idYteamId query parameter.
limitlimitYMaximum number of items to return.
offsetoffsetYoffset query parameter.
hydratehydrateYhydrate query parameter.
fieldsfieldsYfields query parameter.

Returns​

return_parsed=True (default) — the output of parse_mlb_api_list; pass return_as_pandas=True for a pandas.DataFrame.

No returns table is published for this endpoint: no capture: statsapi.mlb.com answers 406 to the datacenter IP and 401 'Please Login' through the residential proxy; the route needs an MLB login session the package does not hold.

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

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help.
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty.

Example​

mlb_stats_metrics()