Skip to contents

Play-by-play of a final game (2015/16 on, with gaps), one row per action with shot x/y.

Endpoint: GET https://api.kzs.si/api/v1/public/matches/{match_id}/playByPlay

Usage

kzs_pbp(match_id)

Arguments

match_id

(required) Match id (match_id in kzs_matches), e.g. 101839. Global across seasons.

Value

A hoopR_data tibble: Play-by-play of a final game (2015/16 on, with gaps), one row per action with shot x/y. An empty valid answer raises hoopR_no_data; the columns are always these, in this order (sportsdataverse-py kzs_pbp):

col_nametypedescription
match_idintegerMatch id: the federation key of a game, global across seasons (joins kzs_matches and kzs_match).
action_numberinteger1-based position of the action in the feed, which is in game order.
team_sidecharacterWhich side of the match the row belongs to: home (the organiser, firstTeam on the wire) or away.
sourcecharacterFeed the action came from: GENIUS_SPORTS in every sample.
clockcharacterTime remaining in the period, 'MM:SS:CC' (minutes, seconds, hundredths): '09:56:00' = 9:56 left.
action_typecharacterAction type (code table).
sub_typecharacterAction subtype (” when none; code table).
qualifierscharacterSemicolon-separated qualifiers (” when none; code table).
xdoubleLocation along the court length, 0-100 percent (see the coordinate section): shots, and from 2020-21 fouls and turnovers; 0.0 when the row has no location.
ydoubleLocation across the court width, 0-100 percent (see the coordinate section); 0.0 when the row has no location.
areacharacterCourt zone of the action (code table): set on shots, and from 2020-21 on located fouls and turnovers; ” on rows without a location and on every shot of early 2015-16 games.
sidecharacterBasket end: LEFT (x~0) or RIGHT (x~100). Absent on non-shot rows before 2020-21 and on some 2020-21 rows (read absent on a shot as LEFT).
successlogicalTrue when the shot / free throw was made (true on non-shot rows).
score1integerFirst (home) team score after the action, a numeric STRING.
score2integerSecond (away) team score after the action, a numeric STRING.
periodintegerPeriod number; overtime restarts at 1 with periodType OVERTIME.
period_typecharacterREGULAR or OVERTIME.
partcharacterPeriod label: QUARTER1-QUARTER4, then OT1 (OT2 and on by the same pattern, unobserved).
match_team_player_idintegerMatch-player id: the player's entry in this one match; NOT the player id. No captured route is keyed by it: join on playerId on the same row.
player_idintegerPlayer id (KZS player registry). Joins to /players/{playerId}, box-score and play-by-play playerId.
match_team_player_first_namecharacterThe acting player's given name, as entered for this match.
match_team_player_last_namecharacterThe acting player's family name, as entered for this match.
team_application_idintegerTeam-application id: the team's registration (entry) for the season; play-by-play teamApplicationId is the same key space.
team_namecharacterTeam name for the season, sponsor included (e.g. 'Perspektiva Ilirija').
match_team_idintegerMatch-team id: this team's entry in this one match (unique per match and side). Joins to play-by-play matchTeamId; NOT a team id.
player_photo_uuidcharacterPlayer photo: image file id, served at https://api.kzs.si/public/images/{uuid}.
shirt_numbercharacterShirt number worn by the acting player, sent as a string.

Details

Source, terms of use, request pacing, seasons, ids, coverage and error classes of this family: see the notes in kzs_seasons().

Examples

# \donttest{
  try(kzs_pbp(match_id = 101839))
#> ── KZS Play-by-Play from api.kzs.si ───────────────────────────── hoopR 3.2.0 ──
#> ℹ Data updated: 2026-10-31 21:31:20 UTC
#> # A tibble: 816 × 27
#>    match_id action_number team_side source clock action_type sub_type qualifiers
#>       <int>         <int> <chr>     <chr>  <chr> <chr>       <chr>    <chr>     
#>  1   101839             1 NA        GENIU… 10:0… game        "start"  ""        
#>  2   101839             2 NA        GENIU… 10:0… period      "start"  ""        
#>  3   101839             3 NA        GENIU… 10:0… clock       "start"  ""        
#>  4   101839             4 NA        GENIU… 10:0… jumpball    "startp… ""        
#>  5   101839             5 away      GENIU… 09:5… jumpball    "won"    ""        
#>  6   101839             6 home      GENIU… 09:5… jumpball    "lost"   ""        
#>  7   101839             7 NA        GENIU… 09:5… clock       "stop"   ""        
#>  8   101839             8 away      GENIU… 09:5… 2pt         "drivin… "pointsin…
#>  9   101839             9 home      GENIU… 09:5… foul        "person… "shooting…
#> 10   101839            10 away      GENIU… 09:5… foulon      ""       ""        
#> # ℹ 806 more rows
#> # ℹ 19 more variables: x <dbl>, y <dbl>, area <chr>, side <chr>, success <lgl>,
#> #   score1 <int>, score2 <int>, period <int>, period_type <chr>, part <chr>,
#> #   match_team_player_id <int>, player_id <int>,
#> #   match_team_player_first_name <chr>, match_team_player_last_name <chr>,
#> #   team_application_id <int>, team_name <chr>, match_team_id <int>,
#> #   player_photo_uuid <chr>, shirt_number <chr>
# }