Skip to main content

MLB — ESPN core API (v2) — Player

espn_mlb_players_index​

ESPN endpoint.

Endpoint URL: GET https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes

Valid URL: https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes?active=true&limit=100&page=1

API ParameterPythonPatternRequiredNullableDescription
activeactiveYactive query parameter.
limitlimitYMaximum number of items to return.
pagepageYpage 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
$refString
countInt64Total items in the ESPN collection across every page (the page envelope's count), the same on every row; more than the row count means this is one page of several (pass the wrapper's limit= or page=).
page_countInt64Pages the collection spans at the requested limit (the page envelope's pageCount), the same on every row; above 1 means rows are missing from this frame.

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​

espn_mlb_players_index()

espn_mlb_player_core​

ESPN endpoint.

Endpoint URL: GET https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/{athlete_id}

Valid URL: https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/4239

API ParameterPythonPatternRequiredNullableDescription
athlete_idathlete_idYathlete_id path 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
$refString
activeBooleanWhether the player is currently active.
ageInt64Player age (in years).
date_of_birthStringDate of birth.
debut_yearInt64Debut year.
display_heightStringDisplay height.
display_nameStringDisplay name.
display_weightStringDisplay weight.
first_nameStringPlayer first name.
full_nameStringPlayer's full name.
guidStringStable cross-league team GUID.
heightFloat64Height (feet and inches).
idInt64Id.
jerseyStringJersey number worn by the player.
last_nameStringPlayer last name.
linkedBooleanLinked.
linksString
short_nameStringShort display name.
slugStringURL-safe identifier.
typeStringRecord type / category.
uidStringESPN UID string.
weightFloat64Weight in pounds.
alternate_ids_sdrString
birth_place_cityStringBirth place city.
birth_place_stateStringBirth place state.
college_$refString
college_athlete_$refString
contracts_$refString
draft_display_textStringDraft display text.
draft_pick_$refString
draft_roundInt64Draft round.
draft_selectionInt64Draft selection.
draft_team_$refString
draft_yearInt64Year the player was drafted.
experience_yearsInt64
hand_abbreviationString
hand_display_valueString
hand_typeString
headshot_altStringHeadshot alt.
headshot_hrefStringHeadshot image URL.
position_$refString
position_abbreviationStringPosition abbreviation.
position_display_nameStringPosition display name.
position_idInt64Unique position identifier.
position_leafBooleanPosition leaf.
position_nameStringPosition name.
seasons_$refString
statistics_$refString
statisticslog_$refString
status_abbreviationStringStatus abbreviation.
status_idInt64Status id.
status_nameStringGame status (e.g. 'STATUS_FINAL').
status_typeStringStatus type.
team_$refString

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​

espn_mlb_player_core(athlete_id='4239')

espn_mlb_player_career_stats​

ESPN endpoint.

Endpoint URL: GET https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/{athlete_id}/statistics[/{stat_type}]

Valid URL: https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/4239/statistics

API ParameterPythonPatternRequiredNullableDescription
athlete_idathlete_idYathlete_id path parameter.
stat_typestat_typeYstat_type path parameter.

Returns​

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

No returns table is published for this endpoint: parser: parse_items returns no columns on the live payload (nba, mlb, mbb, 2026-10-07); its rows sit under keys it does not read (top level: $ref, athlete, splits).

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​

espn_mlb_player_career_stats(athlete_id='4239')

espn_mlb_player_statisticslog​

ESPN endpoint.

Endpoint URL: GET https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/{athlete_id}/statisticslog

Valid URL: https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/4239/statisticslog

API ParameterPythonPatternRequiredNullableDescription
athlete_idathlete_idYathlete_id path 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
statisticsString
season_$refString
countInt64Always null, since the statisticslog payload ships its rows under entries with no page envelope.
page_countInt64Always null, since the statisticslog payload ships its rows under entries with no page envelope.

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​

espn_mlb_player_statisticslog(athlete_id='4239')

espn_mlb_player_eventlog​

ESPN endpoint.

Endpoint URL: GET https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/{athlete_id}/eventlog

Valid URL: https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/4239/eventlog

API ParameterPythonPatternRequiredNullableDescription
athlete_idathlete_idYathlete_id path parameter.

Returns​

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

No returns table is published for this endpoint: no capture: 404 in nba, nfl, mlb, nhl, wnba, cfb, mbb, wbb 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​

espn_mlb_player_eventlog(athlete_id='4239')

espn_mlb_player_contracts​

ESPN endpoint.

Endpoint URL: GET https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/{athlete_id}/contracts

Valid URL: https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/4239/contracts

API ParameterPythonPatternRequiredNullableDescription
athlete_idathlete_idYathlete_id path 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
$refString
countInt64Total items in the ESPN collection across every page (the page envelope's count), the same on every row; more than the row count means this is one page of several (pass the wrapper's limit= or page=).
page_countInt64Pages the collection spans at the requested limit (the page envelope's pageCount), the same on every row; above 1 means rows are missing from this frame.

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​

espn_mlb_player_contracts(athlete_id='4239')

espn_mlb_player_awards​

ESPN endpoint.

Endpoint URL: GET https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/{athlete_id}/awards

Valid URL: https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/4239/awards

API ParameterPythonPatternRequiredNullableDescription
athlete_idathlete_idYathlete_id path parameter.

Returns​

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

No returns table is published for this endpoint: no capture: the page holds zero items (count 0) in nba, nfl, mlb, nhl, wnba, cfb, mbb, wbb 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​

espn_mlb_player_awards(athlete_id='4239')

espn_mlb_player_seasons​

ESPN endpoint.

Endpoint URL: GET https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/{athlete_id}/seasons

Valid URL: https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/4239/seasons

API ParameterPythonPatternRequiredNullableDescription
athlete_idathlete_idYathlete_id path 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
$refString
countInt64Total items in the ESPN collection across every page (the page envelope's count), the same on every row; more than the row count means this is one page of several (pass the wrapper's limit= or page=).
page_countInt64Pages the collection spans at the requested limit (the page envelope's pageCount), the same on every row; above 1 means rows are missing from this frame.

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​

espn_mlb_player_seasons(athlete_id='4239')

espn_mlb_player_records​

ESPN endpoint.

Endpoint URL: GET https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/{athlete_id}/records

Valid URL: https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/4239/records

API ParameterPythonPatternRequiredNullableDescription
athlete_idathlete_idYathlete_id path parameter.

Returns​

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

No returns table is published for this endpoint: no capture: the page holds zero items (count 0) in nba, nfl, mlb, nhl, wnba, cfb, mbb, wbb 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​

espn_mlb_player_records(athlete_id='4239')

espn_mlb_player_injuries​

ESPN endpoint.

Endpoint URL: GET https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/{athlete_id}/injuries

Valid URL: https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/4239/injuries

API ParameterPythonPatternRequiredNullableDescription
athlete_idathlete_idYathlete_id path 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
idInt64ESPN numeric identifier for the athlete.
display_nameStringAthlete's full display name as shown on ESPN.
injuriesStringInjury entries for the athlete (list of dicts, stringified): status, type, details, dates.

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​

espn_mlb_player_injuries(athlete_id='4239')

espn_mlb_player_notes​

ESPN endpoint.

Endpoint URL: GET https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/{athlete_id}/notes

Valid URL: https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/4239/notes

API ParameterPythonPatternRequiredNullableDescription
athlete_idathlete_idYathlete_id path parameter.

Returns​

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

No returns table is published for this endpoint: no capture: 404 in nba, nfl, mlb, nhl, wnba, cfb, mbb, wbb 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​

espn_mlb_player_notes(athlete_id='4239')

espn_mlb_player_vs_player​

ESPN endpoint.

Endpoint URL: GET https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/{athlete_id}/vsathlete/{opp_id}

Valid URL: https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/4239/vsathlete/5

API ParameterPythonPatternRequiredNullableDescription
athlete_idathlete_idYathlete_id path parameter.
opp_idopp_idYopp_id path parameter.

Returns​

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

No returns table is published for this endpoint: no capture: 404 in nba, nfl, mlb, nhl, wnba, cfb, mbb, wbb 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​

espn_mlb_player_vs_player(athlete_id='4239', opp_id='5')

espn_mlb_player_hotzones​

ESPN endpoint.

Endpoint URL: GET https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/{athlete_id}/hotzones

Valid URL: https://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/athletes/4239/hotzones

API ParameterPythonPatternRequiredNullableDescription
athlete_idathlete_idYathlete_id path 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
countInt64Count of count.
itemsString
page_countInt64
page_indexInt64
page_sizeInt64

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​

espn_mlb_player_hotzones(athlete_id='4239')