Skip to main content

NBA — additional Python functions — NBA Stats API

nba_live_boxscore​

nba_live_boxscore(game_id: 'str | int', *, raw: 'bool' = False, return_as_pandas: 'bool' = False, proxy: 'dict[str, str] | None' = None) -> 'Any'

Fetch and parse NBA cdn.nba.com liveData boxscore for a game.

Retrieves https://cdn.nba.com/static/json/liveData/boxscore/boxscore_{game_id}.json and parses it via parse_nba_live_boxscore into six tables (game, officials, home/away players, home/away team).

Parameters

ParameterTypeDefaultDescription
game_idstr | intNBA game ID (int or str). Zero-padded to 10 digits.
rawboolFalseIf True, return the raw JSON payload (dict) instead of parsed DataFrames.
return_as_pandasboolFalseIf True, return pandas DataFrames instead of polars.
proxydict[str, str] | NoneNoneOptional proxy dict passed through to the HTTP layer.

Returns

If raw=True, the raw JSON dict. Otherwise, a dict of six DataFrames (game, officials, home_players, away_players, home_team, away_team) parsed by parse_nba_live_boxscore. Their core columns are guaranteed on every frame, even a zero-row one, at their declared dtypes: game_id on all six, plus game_status, game_time_utc, home_team_id, away_team_id, and attendance on game; person_id, name, jersey_num, and assignment on officials; team_id, person_id, name, jersey_num, position, starter, and played on the player frames; and team_id, team_tricode, and score on the team frames. Every other liveData field is passed through, snake-cased, with each nested statistics object flattened into statistics_* columns; a field only some players carry, such as not_playing_reason, is present only when a player on that side has it.

game:

col_nametypedescription
game_idString10-digit NBA/WNBA game id (zero-padded), from the payload's game.gameId.
game_statusInt64Numeric game status code from the feed: 1 scheduled, 2 in progress, 3 final.
game_time_utcStringScheduled tip-off time in UTC (ISO-8601 timestamp).
home_team_idInt64NBA/WNBA team id of the home team, taken from the payload's homeTeam object.
away_team_idInt64NBA/WNBA team id of the away team, taken from the payload's awayTeam object.
attendanceInt64Reported attendance figure for the game, when published by the feed.
game_time_localStringScheduled tip-off in the arena's local time, ISO-8601 with UTC offset, e.g. 2025-10-21T18:30:00-05:00.
game_time_homeStringScheduled tip-off in the home team's local time, ISO-8601 with UTC offset; the same as game_time_local on the capture, whose two teams share the arena's time zone.
game_time_awayStringScheduled tip-off in the away team's local time, ISO-8601 with UTC offset; the same as game_time_local on the capture, whose two teams share the arena's time zone.
game_etStringScheduled tip-off in US Eastern time, ISO-8601 with UTC offset, e.g. 2025-10-21T19:30:00-04:00.
durationInt64Wall-clock length of the game in whole minutes, opening tip to final buzzer, e.g. 196 on the double-overtime capture, whose first and last play-by-play actions are 3h16m apart.
game_codeStringGame code written as the game date (YYYYMMDD), a slash, then the away and home team tricodes, e.g. 20251021/HOUOKC.
game_status_textStringGame status as display text, e.g. Final.
regulation_periodsInt64Number of regulation periods in the game, 4.
periodInt64Current period, or the last period played on a final game; 5 and up are overtime periods (6 on the double-overtime capture).
game_clockStringTime left in the current period as an ISO-8601 duration, e.g. PT00M00.00S on a final game.
selloutStringSellout flag as a string, "1" when the game sold out; "1" on the capture.

officials:

col_nametypedescription
game_idString10-digit NBA/WNBA game id (zero-padded) this officiating crew worked.
person_idInt64NBA/WNBA person id of the on-court official.
nameStringOfficial's display name.
jersey_numStringOfficial's jersey number as a string.
assignmentStringCrew role label from the feed (OFFICIAL1, OFFICIAL2 or OFFICIAL3, listed in no fixed order), or ALTERNATE for the extra official listed in playoff games.
name_iStringOfficial's first initial and last name, e.g. Z. Zarba.
first_nameStringOfficial's first name as the feed writes it.
family_nameStringOfficial's last name as the feed writes it.

home_players:

col_nametypedescription
game_idString10-digit NBA/WNBA game id (zero-padded) for this side's player entry.
team_idInt64NBA/WNBA team id of the side (home or away) the player belongs to.
person_idInt64NBA/WNBA player id.
nameStringPlayer's display name.
jersey_numStringPlayer's jersey number as a string.
positionStringStarting-lineup slot, one each of SF, PF, C, SG, and PG across the five starters (order 1-5) rather than the player's roster position; null for non-starters.
starterStringFeed's starter flag as a string ("1"/"0") for whether the player started the game.
playedStringFeed's flag as a string for whether the player recorded any playing time in the game ("1"/"0").
statusStringRoster status, ACTIVE or INACTIVE (ruled out before the game); an ACTIVE player can still sit out, which played and not_playing_reason show.
orderInt64Player's place in the feed's roster listing for the team, from 1; the five starters are 1-5 (SF, PF, C, SG, PG), then the rest of the active roster, then inactive players.
oncourtStringFlag as a string ("1"/"0") for whether the player is on the floor as of the capture; on a final game, the five on the floor at the final buzzer.
name_iStringPlayer's first initial and last name, e.g. L. Dort or J. Smith Jr.
first_nameStringPlayer's first name as the feed writes it.
family_nameStringPlayer's last name including any suffix, e.g. Gilgeous-Alexander or Smith Jr.
statistics_assistsInt64Assists credited to the player.
statistics_blocksInt64Opponent shots the player blocked.
statistics_blocks_receivedInt64Player's shot attempts that an opponent blocked.
statistics_field_goals_attemptedInt64Field-goal attempts, statistics_two_pointers_attempted plus statistics_three_pointers_attempted.
statistics_field_goals_madeInt64Field goals made, statistics_two_pointers_made plus statistics_three_pointers_made.
statistics_field_goals_percentageFloat64Field-goal percentage as a 0-1 fraction, statistics_field_goals_made / statistics_field_goals_attempted; 0 when the player took no shot.
statistics_fouls_offensiveInt64Offensive fouls committed, also counted in statistics_fouls_personal.
statistics_fouls_drawnInt64Fouls opponents committed on the player.
statistics_fouls_personalInt64Personal fouls committed, offensive fouls included; technical fouls excluded.
statistics_fouls_technicalInt64Technical fouls charged to the player.
statistics_free_throws_attemptedInt64Free-throw attempts by the player.
statistics_free_throws_madeInt64Free throws the player made.
statistics_free_throws_percentageFloat64Free-throw percentage as a 0-1 fraction, statistics_free_throws_made / statistics_free_throws_attempted; 0 when the player attempted none.
statistics_minusFloat64Points the opponent scored while the player was on the floor, as a float (e.g. 92.0); 0.0 for a player who did not play.
statistics_minutesStringPlaying time as an ISO-8601 duration to the hundredth of a second, e.g. PT45M15.10S; PT00M00.00S for a player who did not play.
statistics_minutes_calculatedStringPlaying time in whole minutes as an ISO-8601 duration, e.g. PT45M; usually statistics_minutes rounded to the nearest minute, but adjusted so the team's players add up to the team's statistics_minutes_calculated (a 20:32 stint shows PT20M and a 0:05.6 one PT01M).
statistics_plusFloat64Points the player's team scored while the player was on the floor, as a float (e.g. 94.0); 0.0 for a player who did not play.
statistics_plus_minus_pointsFloat64Plus-minus, statistics_plus minus statistics_minus, as a float (e.g. 2.0).
statistics_pointsInt64Points the player scored.
statistics_points_fast_breakInt64Fast-break points, free throws included.
statistics_points_in_the_paintInt64Points on field goals made in the paint.
statistics_points_second_chanceInt64Second-chance points, free throws included.
statistics_rebounds_defensiveInt64Defensive rebounds the player grabbed.
statistics_rebounds_offensiveInt64Offensive rebounds the player grabbed.
statistics_rebounds_totalInt64Total rebounds, statistics_rebounds_offensive plus statistics_rebounds_defensive.
statistics_stealsInt64Steals credited to the player.
statistics_three_pointers_attemptedInt64Three-point field-goal attempts.
statistics_three_pointers_madeInt64Three-point field goals made.
statistics_three_pointers_percentageFloat64Three-point percentage as a 0-1 fraction, statistics_three_pointers_made / statistics_three_pointers_attempted; 0 when the player attempted none.
statistics_turnoversInt64Turnovers charged to the player.
statistics_two_pointers_attemptedInt64Two-point field-goal attempts.
statistics_two_pointers_madeInt64Two-point field goals made.
statistics_two_pointers_percentageFloat64Two-point percentage as a 0-1 fraction, statistics_two_pointers_made / statistics_two_pointers_attempted; 0 when the player attempted none.
not_playing_reasonStringCode for why the player did not play, e.g. INACTIVE_INJURY, INACTIVE_GLEAGUE_TWOWAY, or DND_INJURY; null for everyone else, including some players who sat out with no stated reason. The column is present only when a player on that side has one.
not_playing_descriptionStringFree-text detail for not_playing_reason, for an injury the body part and the injury, e.g. "Left Knee; Contusion" (sometimes with a trailing space); null when none is given, as on INACTIVE_GLEAGUE_TWOWAY. The column is present only when a player on that side has one.

away_players:

col_nametypedescription
game_idString10-digit NBA/WNBA game id (zero-padded) for this side's player entry.
team_idInt64NBA/WNBA team id of the side (home or away) the player belongs to.
person_idInt64NBA/WNBA player id.
nameStringPlayer's display name.
jersey_numStringPlayer's jersey number as a string.
positionStringStarting-lineup slot, one each of SF, PF, C, SG, and PG across the five starters (order 1-5) rather than the player's roster position; null for non-starters.
starterStringFeed's starter flag as a string ("1"/"0") for whether the player started the game.
playedStringFeed's flag as a string for whether the player recorded any playing time in the game ("1"/"0").
statusStringRoster status, ACTIVE or INACTIVE (ruled out before the game); an ACTIVE player can still sit out, which played and not_playing_reason show.
orderInt64Player's place in the feed's roster listing for the team, from 1; the five starters are 1-5 (SF, PF, C, SG, PG), then the rest of the active roster, then inactive players.
oncourtStringFlag as a string ("1"/"0") for whether the player is on the floor as of the capture; on a final game, the five on the floor at the final buzzer.
name_iStringPlayer's first initial and last name, e.g. L. Dort or J. Smith Jr.
first_nameStringPlayer's first name as the feed writes it.
family_nameStringPlayer's last name including any suffix, e.g. Gilgeous-Alexander or Smith Jr.
statistics_assistsInt64Assists credited to the player.
statistics_blocksInt64Opponent shots the player blocked.
statistics_blocks_receivedInt64Player's shot attempts that an opponent blocked.
statistics_field_goals_attemptedInt64Field-goal attempts, statistics_two_pointers_attempted plus statistics_three_pointers_attempted.
statistics_field_goals_madeInt64Field goals made, statistics_two_pointers_made plus statistics_three_pointers_made.
statistics_field_goals_percentageFloat64Field-goal percentage as a 0-1 fraction, statistics_field_goals_made / statistics_field_goals_attempted; 0 when the player took no shot.
statistics_fouls_offensiveInt64Offensive fouls committed, also counted in statistics_fouls_personal.
statistics_fouls_drawnInt64Fouls opponents committed on the player.
statistics_fouls_personalInt64Personal fouls committed, offensive fouls included; technical fouls excluded.
statistics_fouls_technicalInt64Technical fouls charged to the player.
statistics_free_throws_attemptedInt64Free-throw attempts by the player.
statistics_free_throws_madeInt64Free throws the player made.
statistics_free_throws_percentageFloat64Free-throw percentage as a 0-1 fraction, statistics_free_throws_made / statistics_free_throws_attempted; 0 when the player attempted none.
statistics_minusFloat64Points the opponent scored while the player was on the floor, as a float (e.g. 92.0); 0.0 for a player who did not play.
statistics_minutesStringPlaying time as an ISO-8601 duration to the hundredth of a second, e.g. PT45M15.10S; PT00M00.00S for a player who did not play.
statistics_minutes_calculatedStringPlaying time in whole minutes as an ISO-8601 duration, e.g. PT45M; usually statistics_minutes rounded to the nearest minute, but adjusted so the team's players add up to the team's statistics_minutes_calculated (a 20:32 stint shows PT20M and a 0:05.6 one PT01M).
statistics_plusFloat64Points the player's team scored while the player was on the floor, as a float (e.g. 94.0); 0.0 for a player who did not play.
statistics_plus_minus_pointsFloat64Plus-minus, statistics_plus minus statistics_minus, as a float (e.g. 2.0).
statistics_pointsInt64Points the player scored.
statistics_points_fast_breakInt64Fast-break points, free throws included.
statistics_points_in_the_paintInt64Points on field goals made in the paint.
statistics_points_second_chanceInt64Second-chance points, free throws included.
statistics_rebounds_defensiveInt64Defensive rebounds the player grabbed.
statistics_rebounds_offensiveInt64Offensive rebounds the player grabbed.
statistics_rebounds_totalInt64Total rebounds, statistics_rebounds_offensive plus statistics_rebounds_defensive.
statistics_stealsInt64Steals credited to the player.
statistics_three_pointers_attemptedInt64Three-point field-goal attempts.
statistics_three_pointers_madeInt64Three-point field goals made.
statistics_three_pointers_percentageFloat64Three-point percentage as a 0-1 fraction, statistics_three_pointers_made / statistics_three_pointers_attempted; 0 when the player attempted none.
statistics_turnoversInt64Turnovers charged to the player.
statistics_two_pointers_attemptedInt64Two-point field-goal attempts.
statistics_two_pointers_madeInt64Two-point field goals made.
statistics_two_pointers_percentageFloat64Two-point percentage as a 0-1 fraction, statistics_two_pointers_made / statistics_two_pointers_attempted; 0 when the player attempted none.
not_playing_reasonStringCode for why the player did not play, e.g. INACTIVE_INJURY, INACTIVE_GLEAGUE_TWOWAY, or DND_INJURY; null for everyone else, including some players who sat out with no stated reason. The column is present only when a player on that side has one.
not_playing_descriptionStringFree-text detail for not_playing_reason, for an injury the body part and the injury, e.g. "Left Knee; Contusion" (sometimes with a trailing space); null when none is given, as on INACTIVE_GLEAGUE_TWOWAY. The column is present only when a player on that side has one.

home_team:

col_nametypedescription
game_idString10-digit NBA/WNBA game id (zero-padded) for this side's team entry.
team_idInt64NBA/WNBA team id of the side (home or away).
team_tricodeStringThree-letter team code, e.g. OKC or HOU.
scoreInt64Team's current or final score.
team_nameStringTeam nickname, e.g. Thunder or Rockets.
team_cityStringTeam's location label, e.g. Oklahoma City or Houston.
in_bonusStringFlag as a string ("1"/"0") for whether the team is in the bonus as of the capture, i.e. the opponent has reached the team-foul penalty in the current period (the last period on a final game).
timeouts_remainingInt64Timeouts the team has left as of the capture (at the end of the game on a final).
statistics_assistsInt64Team assists, the players' assists summed.
statistics_assists_turnover_ratioFloat64Assists divided by statistics_turnovers_total (team turnovers included), e.g. 29 / 12 = 2.4167.
statistics_bench_pointsInt64Points scored by the players who did not start.
statistics_biggest_leadInt64Team's largest lead in points during the game.
statistics_biggest_lead_scoreStringScore when the team first reached its biggest lead, written away-home, e.g. "104-110" for the home team's 6-point lead.
statistics_biggest_scoring_runInt64Team's longest run of unanswered points in the game.
statistics_biggest_scoring_run_scoreStringScore when the team's longest run ended, written away-home, e.g. "104-110".
statistics_blocksInt64Opponent shots the team blocked.
statistics_blocks_receivedInt64Team's shot attempts that were blocked, equal to the opponent's blocks.
statistics_fast_break_points_attemptedInt64Fast-break field-goal attempts; free throws are not counted.
statistics_fast_break_points_madeInt64Fast-break field goals made; free throws are not counted.
statistics_fast_break_points_percentageFloat64statistics_fast_break_points_made / statistics_fast_break_points_attempted as a 0-1 fraction.
statistics_field_goals_attemptedInt64Field-goal attempts by the team's players, the sum of the player rows; a heave counted in statistics_team_field_goal_attempts is not included.
statistics_field_goals_effective_adjustedFloat64Effective field-goal percentage as a 0-1 fraction, (statistics_field_goals_made + 0.5 * statistics_three_pointers_made) / statistics_field_goals_attempted.
statistics_field_goals_madeInt64Field goals made by the team's players.
statistics_field_goals_percentageFloat64Field-goal percentage as a 0-1 fraction, statistics_field_goals_made / statistics_field_goals_attempted.
statistics_fouls_offensiveInt64Offensive fouls committed, also counted in statistics_fouls_personal.
statistics_fouls_drawnInt64Fouls drawn, equal to the opponent's statistics_fouls_personal on the capture.
statistics_fouls_personalInt64Personal fouls committed by the team's players, offensive fouls included and technical fouls excluded.
statistics_fouls_teamInt64Team fouls, statistics_fouls_personal minus statistics_fouls_offensive on the capture.
statistics_fouls_technicalInt64Technical fouls charged to the team's players (0 on the capture).
statistics_fouls_team_technicalInt64Technical fouls charged to the team rather than a player (0 on the capture).
statistics_free_throws_attemptedInt64Free-throw attempts by the team's players.
statistics_free_throws_madeInt64Free throws made by the team's players.
statistics_free_throws_percentageFloat64Free-throw percentage as a 0-1 fraction, statistics_free_throws_made / statistics_free_throws_attempted.
statistics_lead_changesInt64Number of lead changes in the game, the same on both teams' rows.
statistics_minutesStringTotal playing time of the team's players as an ISO-8601 duration, five times the game length, e.g. PT290M00.00S for a double-overtime game.
statistics_minutes_calculatedStringTotal playing time in whole minutes as an ISO-8601 duration, e.g. PT290M; the players' statistics_minutes_calculated add up to it.
statistics_pointsInt64Team points, equal to score on the capture.
statistics_points_againstInt64Points the opponent scored.
statistics_points_fast_breakInt64Fast-break points, free throws included.
statistics_points_from_turnoversInt64Points scored off the opponent's turnovers, free throws included.
statistics_points_in_the_paintInt64Points on field goals made in the paint.
statistics_points_in_the_paint_attemptedInt64Field-goal attempts in the paint.
statistics_points_in_the_paint_madeInt64Field goals made in the paint.
statistics_points_in_the_paint_percentageFloat64statistics_points_in_the_paint_made / statistics_points_in_the_paint_attempted as a 0-1 fraction.
statistics_points_second_chanceInt64Second-chance points, free throws included.
statistics_rebounds_defensiveInt64Defensive rebounds by the team's players; team rebounds are in statistics_rebounds_team_defensive.
statistics_rebounds_offensiveInt64Offensive rebounds by the team's players; team rebounds are in statistics_rebounds_team_offensive.
statistics_rebounds_personalInt64Rebounds by the team's players, statistics_rebounds_defensive plus statistics_rebounds_offensive.
statistics_rebounds_teamInt64Team rebounds credited to the team rather than a player, statistics_rebounds_team_defensive plus statistics_rebounds_team_offensive.
statistics_rebounds_team_defensiveInt64Defensive rebounds credited to the team rather than a player.
statistics_rebounds_team_offensiveInt64Offensive rebounds credited to the team rather than a player.
statistics_rebounds_totalInt64All rebounds, statistics_rebounds_personal plus statistics_rebounds_team.
statistics_second_chance_points_attemptedInt64Second-chance field-goal attempts; free throws are not counted.
statistics_second_chance_points_madeInt64Second-chance field goals made; free throws are not counted.
statistics_second_chance_points_percentageFloat64statistics_second_chance_points_made / statistics_second_chance_points_attempted as a 0-1 fraction.
statistics_stealsInt64Steals by the team's players.
statistics_team_field_goal_attemptsInt64Field-goal attempts credited to the team rather than a player and left out of statistics_field_goals_attempted, e.g. an end-of-quarter heave (1 for Houston on the capture, whose play-by-play logs one heave).
statistics_three_pointers_attemptedInt64Three-point field-goal attempts by the team's players.
statistics_three_pointers_madeInt64Three-point field goals made by the team's players.
statistics_three_pointers_percentageFloat64Three-point percentage as a 0-1 fraction, statistics_three_pointers_made / statistics_three_pointers_attempted.
statistics_time_leadingStringGame-clock time the team held the lead, as an ISO-8601 duration, e.g. PT10M18.70S.
statistics_times_tiedInt64Number of times the score was tied after 0-0, the same on both teams' rows.
statistics_true_shooting_attemptsFloat64True-shooting attempts, statistics_field_goals_attempted + 0.44 * statistics_free_throws_attempted.
statistics_true_shooting_percentageFloat64True-shooting percentage as a 0-1 fraction, statistics_points / (2 * statistics_true_shooting_attempts).
statistics_turnoversInt64Turnovers by the team's players; team turnovers are in statistics_turnovers_team.
statistics_turnovers_teamInt64Turnovers charged to the team rather than a player, e.g. a shot-clock violation.
statistics_turnovers_totalInt64All turnovers, statistics_turnovers plus statistics_turnovers_team.
statistics_two_pointers_attemptedInt64Two-point field-goal attempts by the team's players.
statistics_two_pointers_madeInt64Two-point field goals made by the team's players.
statistics_two_pointers_percentageFloat64Two-point percentage as a 0-1 fraction, statistics_two_pointers_made / statistics_two_pointers_attempted.

away_team:

col_nametypedescription
game_idString10-digit NBA/WNBA game id (zero-padded) for this side's team entry.
team_idInt64NBA/WNBA team id of the side (home or away).
team_tricodeStringThree-letter team code, e.g. OKC or HOU.
scoreInt64Team's current or final score.
team_nameStringTeam nickname, e.g. Thunder or Rockets.
team_cityStringTeam's location label, e.g. Oklahoma City or Houston.
in_bonusStringFlag as a string ("1"/"0") for whether the team is in the bonus as of the capture, i.e. the opponent has reached the team-foul penalty in the current period (the last period on a final game).
timeouts_remainingInt64Timeouts the team has left as of the capture (at the end of the game on a final).
statistics_assistsInt64Team assists, the players' assists summed.
statistics_assists_turnover_ratioFloat64Assists divided by statistics_turnovers_total (team turnovers included), e.g. 29 / 12 = 2.4167.
statistics_bench_pointsInt64Points scored by the players who did not start.
statistics_biggest_leadInt64Team's largest lead in points during the game.
statistics_biggest_lead_scoreStringScore when the team first reached its biggest lead, written away-home, e.g. "104-110" for the home team's 6-point lead.
statistics_biggest_scoring_runInt64Team's longest run of unanswered points in the game.
statistics_biggest_scoring_run_scoreStringScore when the team's longest run ended, written away-home, e.g. "104-110".
statistics_blocksInt64Opponent shots the team blocked.
statistics_blocks_receivedInt64Team's shot attempts that were blocked, equal to the opponent's blocks.
statistics_fast_break_points_attemptedInt64Fast-break field-goal attempts; free throws are not counted.
statistics_fast_break_points_madeInt64Fast-break field goals made; free throws are not counted.
statistics_fast_break_points_percentageFloat64statistics_fast_break_points_made / statistics_fast_break_points_attempted as a 0-1 fraction.
statistics_field_goals_attemptedInt64Field-goal attempts by the team's players, the sum of the player rows; a heave counted in statistics_team_field_goal_attempts is not included.
statistics_field_goals_effective_adjustedFloat64Effective field-goal percentage as a 0-1 fraction, (statistics_field_goals_made + 0.5 * statistics_three_pointers_made) / statistics_field_goals_attempted.
statistics_field_goals_madeInt64Field goals made by the team's players.
statistics_field_goals_percentageFloat64Field-goal percentage as a 0-1 fraction, statistics_field_goals_made / statistics_field_goals_attempted.
statistics_fouls_offensiveInt64Offensive fouls committed, also counted in statistics_fouls_personal.
statistics_fouls_drawnInt64Fouls drawn, equal to the opponent's statistics_fouls_personal on the capture.
statistics_fouls_personalInt64Personal fouls committed by the team's players, offensive fouls included and technical fouls excluded.
statistics_fouls_teamInt64Team fouls, statistics_fouls_personal minus statistics_fouls_offensive on the capture.
statistics_fouls_technicalInt64Technical fouls charged to the team's players (0 on the capture).
statistics_fouls_team_technicalInt64Technical fouls charged to the team rather than a player (0 on the capture).
statistics_free_throws_attemptedInt64Free-throw attempts by the team's players.
statistics_free_throws_madeInt64Free throws made by the team's players.
statistics_free_throws_percentageFloat64Free-throw percentage as a 0-1 fraction, statistics_free_throws_made / statistics_free_throws_attempted.
statistics_lead_changesInt64Number of lead changes in the game, the same on both teams' rows.
statistics_minutesStringTotal playing time of the team's players as an ISO-8601 duration, five times the game length, e.g. PT290M00.00S for a double-overtime game.
statistics_minutes_calculatedStringTotal playing time in whole minutes as an ISO-8601 duration, e.g. PT290M; the players' statistics_minutes_calculated add up to it.
statistics_pointsInt64Team points, equal to score on the capture.
statistics_points_againstInt64Points the opponent scored.
statistics_points_fast_breakInt64Fast-break points, free throws included.
statistics_points_from_turnoversInt64Points scored off the opponent's turnovers, free throws included.
statistics_points_in_the_paintInt64Points on field goals made in the paint.
statistics_points_in_the_paint_attemptedInt64Field-goal attempts in the paint.
statistics_points_in_the_paint_madeInt64Field goals made in the paint.
statistics_points_in_the_paint_percentageFloat64statistics_points_in_the_paint_made / statistics_points_in_the_paint_attempted as a 0-1 fraction.
statistics_points_second_chanceInt64Second-chance points, free throws included.
statistics_rebounds_defensiveInt64Defensive rebounds by the team's players; team rebounds are in statistics_rebounds_team_defensive.
statistics_rebounds_offensiveInt64Offensive rebounds by the team's players; team rebounds are in statistics_rebounds_team_offensive.
statistics_rebounds_personalInt64Rebounds by the team's players, statistics_rebounds_defensive plus statistics_rebounds_offensive.
statistics_rebounds_teamInt64Team rebounds credited to the team rather than a player, statistics_rebounds_team_defensive plus statistics_rebounds_team_offensive.
statistics_rebounds_team_defensiveInt64Defensive rebounds credited to the team rather than a player.
statistics_rebounds_team_offensiveInt64Offensive rebounds credited to the team rather than a player.
statistics_rebounds_totalInt64All rebounds, statistics_rebounds_personal plus statistics_rebounds_team.
statistics_second_chance_points_attemptedInt64Second-chance field-goal attempts; free throws are not counted.
statistics_second_chance_points_madeInt64Second-chance field goals made; free throws are not counted.
statistics_second_chance_points_percentageFloat64statistics_second_chance_points_made / statistics_second_chance_points_attempted as a 0-1 fraction.
statistics_stealsInt64Steals by the team's players.
statistics_team_field_goal_attemptsInt64Field-goal attempts credited to the team rather than a player and left out of statistics_field_goals_attempted, e.g. an end-of-quarter heave (1 for Houston on the capture, whose play-by-play logs one heave).
statistics_three_pointers_attemptedInt64Three-point field-goal attempts by the team's players.
statistics_three_pointers_madeInt64Three-point field goals made by the team's players.
statistics_three_pointers_percentageFloat64Three-point percentage as a 0-1 fraction, statistics_three_pointers_made / statistics_three_pointers_attempted.
statistics_time_leadingStringGame-clock time the team held the lead, as an ISO-8601 duration, e.g. PT10M18.70S.
statistics_times_tiedInt64Number of times the score was tied after 0-0, the same on both teams' rows.
statistics_true_shooting_attemptsFloat64True-shooting attempts, statistics_field_goals_attempted + 0.44 * statistics_free_throws_attempted.
statistics_true_shooting_percentageFloat64True-shooting percentage as a 0-1 fraction, statistics_points / (2 * statistics_true_shooting_attempts).
statistics_turnoversInt64Turnovers by the team's players; team turnovers are in statistics_turnovers_team.
statistics_turnovers_teamInt64Turnovers charged to the team rather than a player, e.g. a shot-clock violation.
statistics_turnovers_totalInt64All turnovers, statistics_turnovers plus statistics_turnovers_team.
statistics_two_pointers_attemptedInt64Two-point field-goal attempts by the team's players.
statistics_two_pointers_madeInt64Two-point field goals made by the team's players.
statistics_two_pointers_percentageFloat64Two-point percentage as a 0-1 fraction, statistics_two_pointers_made / statistics_two_pointers_attempted.

Raises

ExceptionDescription
ValueErrorgame_id is not one non-negative integer id -- a bool, a negative or fractional number, a string that is not all digits, or more than 10 digits (checked before any request).
NoDataErrorThe game has no liveData boxscore object (too old, or not yet started).
AssetFetchErrorThe fetch failed (network error, rate limit, or a bot-check block), or the 200 body is not a JSON object carrying the liveData game object -- checked with raw=True too.
ImportErrorCurl_cffi is not installed -- required for the live transport (pip install curl_cffi / sportsdataverse[all]).

Example

from sportsdataverse.nba.nba_live import nba_live_boxscore
result = nba_live_boxscore("0022500001")
officials = result["officials"]
print(officials.select("person_id", "name", "assignment"))

nba_live_pbp​

nba_live_pbp(game_id: 'str | int', *, raw: 'bool' = False, return_as_pandas: 'bool' = False, proxy: 'dict[str, str] | None' = None) -> 'Any'

Fetch and parse NBA cdn.nba.com liveData play-by-play for a game.

Retrieves https://cdn.nba.com/static/json/liveData/playbyplay/playbyplay_{game_id}.json and parses it via parse_nba_live_pbp. Unlike stats.nba.com's play-by-play, this feed carries per-whistle referee ids (official_id, populated on every foul since the 2019-20 season) and wall-clock timestamps (time_actual).

Parameters

ParameterTypeDefaultDescription
game_idstr | intNBA game ID (int or str). Zero-padded to 10 digits.
rawboolFalseIf True, return the raw JSON payload (dict) instead of a DataFrame.
return_as_pandasboolFalseIf True, return a pandas DataFrame instead of polars.
proxydict[str, str] | NoneNoneOptional proxy dict passed through to the HTTP layer.

Returns

If raw=True, the raw JSON dict. Otherwise, a DataFrame with one row per action, parsed by parse_nba_live_pbp. Its 13 core columns (game_id, action_number, period, clock, time_actual, action_type, sub_type, team_id, person_id, official_id, x_legacy, y_legacy, description) are guaranteed on every frame, even a zero-row one, at their declared dtypes. Every other liveData action field is passed through, snake-cased, when the payload carries it, so an event-specific column such as block_person_id or foul_drawn_person_id is present only when the game had that event.

col_nametypedescription
game_idString10-digit NBA/WNBA game id (zero-padded), stamped onto every action from the payload's game.gameId.
action_numberInt64Action id from the liveData feed's actionNumber field, assigned in the order actions are logged rather than strictly in game order (an action logged late gets a higher number than plays that followed it); sort by order_number for game order.
periodInt64Period of the game: 1-4 for quarters, 5+ for overtime periods.
clockStringISO-8601 duration game clock at the action, e.g. "PT11M25.00S", not yet converted to MM:SS.
time_actualStringWall-clock UTC timestamp when the action occurred, letting plays be matched to real elapsed time.
action_typeStringAction category from the feed, lower-cased, e.g. 2pt, 3pt, foul, substitution, or turnover.
sub_typeStringAction sub-type as the feed writes it, e.g. personal or offensive for a foul, Jump Shot or Layup for a 2pt/3pt shot, 1 of 2 for a free throw.
team_idInt64NBA/WNBA team id of the team associated with the action, when applicable.
person_idInt64NBA/WNBA player id of the primary person involved in the action, when applicable.
official_idInt64Referee's person id for the whistle on this action; populated on every foul since the 2019-20 season, and also on whistled turnovers and violations such as traveling, out-of-bounds, or kicked ball (null on live-ball turnovers like a bad pass).
x_legacyFloat64Shot x-coordinate in the legacy stats.nba.com coordinate system; populated only on 2pt/3pt shots (fouls and blocks carry a court zone in area/area_detail instead).
y_legacyFloat64Shot y-coordinate in the legacy stats.nba.com coordinate system; populated only on 2pt/3pt shots (fouls and blocks carry a court zone in area/area_detail instead).
descriptionStringLong-form human-readable description of the action, as shown on NBA.com's live scoreboard.
period_typeStringPeriod kind from the feed, REGULAR for the four quarters and OVERTIME for an overtime period.
possessionInt64Team id of the team with the ball as of the action (on a rebound or steal, the team that gained it); 0 on game and period start/end rows.
score_homeStringHome team's running score after the action, stored as a string.
score_awayStringAway team's running score after the action, stored as a string.
order_numberInt64The feed's sort key for the action (actions ship in this order); sorting by it gives game order even where action_number does not, since an action logged late is slotted in at its place in the game.
editedStringUTC timestamp (ISO-8601, whole seconds) of the feed's last edit to the action, never earlier than time_actual.
qualifiersListList of context tags on the action, e.g. pointsinthepaint, fastbreak, 2ndchance, or fromturnover on a shot, 2freethrow or inpenalty on a foul, and team on a team rebound or turnover; empty when none apply.
descriptorStringExtra detail on sub_type, e.g. driving or step back on a shot, shooting or loose ball on a foul, bad pass on a turnover, heldball or startperiod on a jump ball; null when absent.
is_target_score_last_periodBooleanFeed flag for a last period played to a target score instead of the game clock (the Elam-ending format); False on every action of a regular game.
team_tricodeStringThree-letter code of the team in team_id, e.g. OKC or HOU.
player_nameStringLast name of the action's primary player (person_id) as the feed writes it, e.g. Gilgeous-Alexander; null on team and administrative actions.
player_name_iStringFirst initial and last name of the action's primary player (person_id), e.g. S. Gilgeous-Alexander; null on team and administrative actions.
person_ids_filterListList of every player id on the action, i.e. person_id plus any assist, block, steal, foul-drawn, or jump-ball participant; empty when no player is involved.
is_field_goalInt64Field-goal attempt flag, 1 on a 2pt/3pt shot and 0 on every other action (including a heave).
shot_resultStringMade or Missed; set on 2pt/3pt shots and free throws.
shot_distanceFloat64Shot distance from the basket in feet; set on 2pt/3pt shots and heaves.
xFloat64Shot location along the court's length on a 0-100 scale from the left baseline; populated only on 2pt/3pt shots, like x_legacy.
yFloat64Shot location across the court's width on a 0-100 scale, 50 at the baskets' centerline; populated only on 2pt/3pt shots, like y_legacy.
sideStringCourt half of the shot, left or right (left where x is below 50); populated only on 2pt/3pt shots.
areaStringCourt zone of the action, e.g. Restricted Area, In The Paint (Non-RA), Mid-Range, Left Corner 3, Right Corner 3, or Above the Break 3; set on 2pt/3pt shots and also on heaves, fouls, blocks, steals, turnovers, and most rebounds, which carry no x/y coordinates.
area_detailStringFiner zone for the same actions as area, written as a distance band in feet plus a direction, e.g. "0-8 Center", "16-24 Left Center", or "24+ Right".
points_totalInt64Scorer's running point total in the game, including this basket; set on made shots and made free throws.
assist_person_idInt64Player id credited with the assist on a made 2pt/3pt shot; null on unassisted and missed shots.
assist_player_name_initialStringFirst initial and last name of the player credited with the assist on a made 2pt/3pt shot, e.g. L. Dort.
assist_totalInt64Assisting player's running assist total in the game, including this assist.
shot_action_numberInt64On a rebound, the action_number of the missed shot or free throw being rebounded.
rebound_totalInt64Rebounder's running rebound total in the game, including this rebound (rebound_offensive_total plus rebound_defensive_total); null on a team rebound.
rebound_offensive_totalInt64Rebounder's running offensive-rebound total in the game as of this rebound; null on a team rebound.
rebound_defensive_totalInt64Rebounder's running defensive-rebound total in the game as of this rebound; null on a team rebound.
foul_drawn_person_idInt64Player id of the opponent who drew the foul; null when no player drew it (e.g. a technical foul).
foul_drawn_player_nameStringLast name of the opponent who drew the foul; null when no player drew it (e.g. a technical foul).
foul_personal_totalInt64Fouling player's running personal-foul count in the game as of this foul (a technical foul leaves it unchanged); null on a team foul.
foul_technical_totalInt64Fouling player's running technical-foul count in the game as of this foul; null on a team foul.
turnover_totalInt64Player's running turnover count in the game, including this turnover; null on a team turnover.
steal_person_idInt64Player id credited with the steal, on the turnover row it forced; the steal is also logged as its own steal action.
steal_player_nameStringLast name of the player credited with the steal, on the turnover row it forced.
block_person_idInt64Player id credited with the block, on the blocked (missed) shot's row; the block is also logged as its own block action.
block_player_nameStringLast name of the player credited with the block, on the blocked (missed) shot's row.
jump_ball_won_person_idInt64Player id of the jumper who won the tip on a jump ball.
jump_ball_won_player_nameStringLast name of the jumper who won the tip on a jump ball.
jump_ball_lost_person_idInt64Player id of the jumper who lost the tip on a jump ball.
jump_ball_lost_player_nameStringLast name of the jumper who lost the tip on a jump ball.
jump_ball_recoverd_person_idInt64Player id of the player who recovered the tip on a jump ball, null when a team recovered it; the column keeps the feed's own spelling (jumpBallRecoverdPersonId).
jump_ball_recovered_nameStringFirst initial and last name of the player who recovered the tip on a jump ball, or a team label such as "Team (OKC)" when a team recovered it.

Raises

ExceptionDescription
ValueErrorgame_id is not one non-negative integer id -- a bool, a negative or fractional number, a string that is not all digits, or more than 10 digits (checked before any request).
NoDataErrorThe game has no liveData play-by-play object (too old, or not yet started).
AssetFetchErrorThe fetch failed (network error, rate limit, or a bot-check block), or the 200 body is not a JSON object carrying the liveData game object -- checked with raw=True too.
ImportErrorCurl_cffi is not installed -- required for the live transport (pip install curl_cffi / sportsdataverse[all]).

Example

from sportsdataverse.nba.nba_live import nba_live_pbp
pbp = nba_live_pbp("0022500001")
print(pbp.filter(pbp["action_type"] == "foul").height)

# Pipeline next step (fouls with a referee id)

fouls = pbp.filter(pbp["action_type"] == "foul").select("official_id", "time_actual")