Skip to main content
Version: 0.2.0

NBA G League — G League Stats API (stats.nba.com, LeagueID=20) — Other: playbyplayv3–scoreboardv3

nbagl_stats_playbyplayv3​

Play by play v3.

Endpoint URL: GET https://stats.nba.com/stats/playbyplayv3

Valid URL: https://stats.nba.com/stats/playbyplayv3?EndPeriod=0&GameID=2022500137&StartPeriod=0

API ParameterPythonPatternRequiredNullableDescription
EndPeriodend_periodY
GameIDgame_idY
StartPeriodstart_periodY

Returns​

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

col_nametypedescription
game_idStringTen-character stats API game id (e.g. "0022500100"), shared by every action in the game.
video_availableInt641 when the stats site has video of the action, else 0.
action_numberInt64Stats API action number of the event within the game; gaps mark actions the feed removed.
clockStringGame clock remaining in the period as an ISO-8601 duration (e.g. PT11M42.00S).
periodInt64Period of the action (1-4 regulation, 5+ overtime).
team_idInt64Stats API team id of the action's team; 0 for neutral actions.
team_tricodeStringThree-letter code of the action's team (e.g. GSW); empty for neutral actions.
person_idInt64Stats API person id of the action's primary player; 0 for team and neutral actions.
player_nameStringLast name of the action's primary player; empty for team and neutral actions.
player_name_iStringInitial-and-last-name form of the primary player (e.g. "S. Curry").
x_legacyInt64Shot x coordinate on the legacy stats court grid (tenths of a foot from the basket); 0 off shots.
y_legacyInt64Shot y coordinate on the legacy stats court grid (tenths of a foot from the basket); 0 off shots.
shot_distanceInt64Shot distance in feet; 0 on non-shot actions.
shot_resultStringMade or Missed on a shot; empty otherwise.
is_field_goalInt641 when the action is a field-goal attempt, else 0.
score_homeStringHome score after the action, as text; empty on non-scoring actions.
score_awayStringVisitor score after the action, as text; empty on non-scoring actions.
points_totalInt64Combined home + visitor score after the action (running game total).
locationStringSide of the action, h (home) or v (visitor); empty for neutral actions.
descriptionStringText description of the action (e.g. "Curry 26' 3PT Jump Shot (3 PTS)").
action_typeStringAction family (e.g. Made Shot, Missed Shot, Free Throw, Rebound, Turnover, Foul, Substitution, period).
sub_typeStringAction subtype (e.g. Jump Shot, Driving Layup, Personal, Bad Pass, start, end).
shot_valueInt64Points a field-goal attempt was worth (2 or 3); 0 on free throws and non-shot actions.
action_idInt64Sequential id of the action in the feed's order (1-based); unlike action_number it has no gaps.

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.
ImportErrorcurl_cffi is not installed -- stats.nba.com / stats.wnba.com block plain requests, so the transport needs it (pip install curl_cffi or sportsdataverse[all]).

Example​

nbagl_stats_playbyplayv3()

nbagl_stats_scoreboardv3​

Scoreboard v3.

Endpoint URL: GET https://stats.nba.com/stats/scoreboardv3

Valid URL: https://stats.nba.com/stats/scoreboardv3?GameDate=2025-01-15&LeagueID=20

API ParameterPythonPatternRequiredNullableDescription
GameDategame_dateY
LeagueIDleague_idY

Returns​

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

col_nametypedescription
awayteam_inbonusStringWhether the away team is currently in the bonus (penalty) foul situation.
awayteam_lossesInt64Away team's loss total entering the game.
awayteam_scoreInt64Current or final points scored by the away team.
awayteam_seedInt64Playoff seed of the away team, populated for postseason games.
awayteam_teamcityStringCity name of the away team.
awayteam_teamidInt64Team identifier of the away team from the league's stats API.
awayteam_teamnameStringNickname of the away team.
awayteam_teamslugStringURL-friendly slug for the away team's name.
awayteam_teamtricodeStringThree-letter abbreviation of the away team.
awayteam_timeoutsremainingInt64Timeouts the away team has remaining.
awayteam_winsInt64Away team's win total entering the game.
gameclockStringCurrent game clock display for a live game.
gamecodeString
gamedateStringGame date the scoreboard was requested for (YYYY-MM-DD).
gameetStringScheduled game start time in US Eastern time.
gameidStringUnique 10-character game identifier from the league's stats API.
gamelabelStringDisplay label for the game (e.g. a playoff series or event name).
gameleaders_awayleaders_assistsInt64Assist total of the away team's in-game statistical leader.
gameleaders_awayleaders_jerseynumStringJersey number of the away team's in-game statistical leader.
gameleaders_awayleaders_nameStringName of the away team's in-game statistical leader.
gameleaders_awayleaders_personidInt64Stats API player id of the away team's in-game statistical leader.
gameleaders_awayleaders_playerslugStringURL name slug of the away team's in-game statistical leader.
gameleaders_awayleaders_pointsInt64Point total of the away team's in-game statistical leader.
gameleaders_awayleaders_positionStringPosition of the away team's in-game statistical leader.
gameleaders_awayleaders_reboundsInt64Rebound total of the away team's in-game statistical leader.
gameleaders_awayleaders_teamtricodeStringTeam tricode of the away team's in-game statistical leader.
gameleaders_homeleaders_assistsInt64Assist total of the home team's in-game statistical leader.
gameleaders_homeleaders_jerseynumStringJersey number of the home team's in-game statistical leader.
gameleaders_homeleaders_nameStringName of the home team's in-game statistical leader.
gameleaders_homeleaders_personidInt64Stats API player id of the home team's in-game statistical leader.
gameleaders_homeleaders_playerslugStringURL name slug of the home team's in-game statistical leader.
gameleaders_homeleaders_pointsInt64Point total of the home team's in-game statistical leader.
gameleaders_homeleaders_positionStringPosition of the home team's in-game statistical leader.
gameleaders_homeleaders_reboundsInt64Rebound total of the home team's in-game statistical leader.
gameleaders_homeleaders_teamtricodeStringTeam tricode of the home team's in-game statistical leader.
gamestatusInt64Numeric game status code (1 = scheduled, 2 = in progress, 3 = final).
gamestatustextStringHuman-readable game status (e.g. "Final", "7:00 pm ET").
gamesublabelStringSecondary display label for the game (e.g. game number within a series).
gamesubtypeStringSubtype code for the game as reported by the stats API (e.g. in-season tournament flags).
gametimeutcStringScheduled game start time in UTC.
hometeam_inbonusStringWhether the home team is currently in the bonus (penalty) foul situation.
hometeam_lossesInt64Home team's loss total entering the game.
hometeam_scoreInt64Current or final points scored by the home team.
hometeam_seedInt64Playoff seed of the home team, populated for postseason games.
hometeam_teamcityStringCity name of the home team.
hometeam_teamidInt64Team identifier of the home team from the league's stats API.
hometeam_teamnameStringNickname of the home team.
hometeam_teamslugStringURL-friendly slug for the home team's name.
hometeam_teamtricodeStringThree-letter abbreviation of the home team.
hometeam_timeoutsremainingInt64Timeouts the home team has remaining.
hometeam_winsInt64Home team's win total entering the game.
ifnecessaryBooleanWhether the game is an if-necessary playoff series game.
isneutralBooleanWhether the game is played at a neutral site.
leagueidStringLeague identifier from the stats API ("00" = NBA, "10" = WNBA).
leaguenameStringDisplay name of the league.
periodInt64
porounddescStringPlayoff round description (e.g. Conference Finals).
regulationperiodsInt64Number of regulation periods for the game (4).
seriesconferenceStringConference of the playoff series the game belongs to.
seriesgamenumberStringGame number within the playoff series.
seriestextStringDisplay text summarizing the series state (e.g. "BOS leads 2-1").
teamleaders_awayleaders_assistsFloat64Assist total of the away team's season statistical leader.
teamleaders_awayleaders_jerseynumStringJersey number of the away team's season statistical leader.
teamleaders_awayleaders_nameStringName of the away team's season statistical leader.
teamleaders_awayleaders_personidInt64Stats API player id of the away team's season statistical leader.
teamleaders_awayleaders_playerslugStringURL name slug of the away team's season statistical leader.
teamleaders_awayleaders_pointsFloat64Point total of the away team's season statistical leader.
teamleaders_awayleaders_positionStringPosition of the away team's season statistical leader.
teamleaders_awayleaders_reboundsFloat64Rebound total of the away team's season statistical leader.
teamleaders_awayleaders_teamtricodeStringTeam tricode of the away team's season statistical leader.
teamleaders_homeleaders_assistsFloat64Assist total of the home team's season statistical leader.
teamleaders_homeleaders_jerseynumStringJersey number of the home team's season statistical leader.
teamleaders_homeleaders_nameStringName of the home team's season statistical leader.
teamleaders_homeleaders_personidInt64Stats API player id of the home team's season statistical leader.
teamleaders_homeleaders_playerslugStringURL name slug of the home team's season statistical leader.
teamleaders_homeleaders_pointsFloat64Point total of the home team's season statistical leader.
teamleaders_homeleaders_positionStringPosition of the home team's season statistical leader.
teamleaders_homeleaders_reboundsFloat64Rebound total of the home team's season statistical leader.
teamleaders_homeleaders_teamtricodeStringTeam tricode of the home team's season statistical leader.
teamleaders_seasonleadersflagInt64Flag indicating the team-leaders block carries season-long leaders rather than in-game leaders.

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.
ImportErrorcurl_cffi is not installed -- stats.nba.com / stats.wnba.com block plain requests, so the transport needs it (pip install curl_cffi or sportsdataverse[all]).

Example​

nbagl_stats_scoreboardv3(league_id='20')