Skip to contents

Play-by-play events with shot coordinates and the Genius ids (2023/24 on).

Endpoint: GET https://www.basketligaen.dk/api/gameday/play-by-play/{game_uuid}

Usage

sportality_pbp(game_uuid)

Arguments

game_uuid

(required) Game uuid: gameInfo[].uuid of the schedule (10 lowercase letters and digits). Key space: platform game uuids; the Genius match id is extId / gameSourceId in the body.

Value

A hoopR_data tibble: Play-by-play events with shot coordinates and the Genius ids (2023/24 on). An empty valid answer raises hoopR_no_data; the documented columns come first, in this order (sportsdataverse-py sportality_pbp), then any column the API added later:

col_nametypedescription
game_source_idintegerGenius match id (Int64), the same number as game_id and sports-v2 game_info_ext_id.
game_idintegerGenius match id (Int64), the join to the genius family; on play-by-play lines, an integer elsewhere.
event_idintegerGenius event number within the game (Int64), increasing through the game.
typecharacterEvent type: one line per action; shots are the shooter's line, assists, blocks, steals and fouls drawn are further lines. Values: 2pt = two-point attempt (made when isSuccessful = 1); 3pt = three-point attempt (made when isSuccessful = 1); assist = assist on the previous made shot; block = block; clock = clock start, stop or adjustment; foul = foul committed; foulon = foul drawn (fouled player); freethrow = free-throw attempt; game = game start / end line; headcoachchallenge = head coach challenge; jumpball = jump ball or held ball; period = period start / end line; rebound = rebound; steal = steal; substitution = substitution (in or out); timeout = timeout; turnover = turnover.
event_uuidcharacterEvent uuid (UUID v5 derived from the event; unique per event).
periodintegerPeriod: 0 = the whole game, 1-4 the quarters, 5 and up overtime.
period_typecharacterREGULAR or OVERTIME; absent on the period marker lines. Values: OVERTIME = overtime period; REGULAR = regulation period.
timecharacterClock REMAINING in the period as mm:ss:cc (cc looks like hundredths of a second, only ever 00, 10, 30, 50 ... seen; unverified). Absent on the per-period marker lines.
real_world_timecharacterWall-clock time of the event, ISO 8601 UTC.
updated_timecharacterWhen the feed last updated the event, ISO 8601 UTC.
home_team_idintegerGenius team id of the home team (Genius key space; Int64).
home_team_codecharacterHome team code as Genius spells it (mixed case, 'Hol').
home_team_namecharacterName of the home team.
home_abbreviationcharacterHome team abbreviation.
home_team_numberintegerTeam number in the game; home is 1.
home_placecharacterSide of the home block: always home.
home_scoreintegerPoints scored by the home team.
away_team_idintegerGenius team id of the away team (Genius key space; Int64).
away_team_codecharacterAway team code as Genius spells it.
away_team_namecharacterName of the away team.
away_abbreviationcharacterAway team abbreviation.
away_team_numberintegerTeam number in the game; away is 2.
away_placecharacterSide of the away block: always away.
away_scoreintegerPoints scored by the away team.
revisionintegerRevision counter of the event.
game_statecharacterGame state at the event: ongoing during play, GameEnded on the final line. Values: GameEnded = game over (the final line of a complete feed); ongoing = game in progress.
game_typecharacterGame type of the game (” on every line seen).
roundintegerRound number (0).
start_date_and_timecharacterStart of the game (” on every line seen).
sub_typecharacterRefinement of type (the shot type, rebound kind, foul kind, ...); null on types that have none. Values are listed under "Sub-type codes" below.
qualifierscharacterEvent qualifiers joined by ';' (a list in recent games, a ';'-joined string or null in older ones).
is_successfulinteger1 when the action succeeded (a made shot or free throw, a recorded rebound ...). ABSENT, not 0, for a missed shot, so count misses as rows without it.
instance_idcharacterSite instance id of the club or league (platform key space, <code><n>_<code> such as hol2_hol; the league itself is dbl1_dbl).
sourcecharacterFeed that produced the line (genius-basketball-stream-reader).
game_uuidcharacterPlatform game uuid (c4hh5nig6t); every gameday route takes it.
event_team_idintegerGenius team id (Genius key space; Int64).
event_team_codecharacterTeam code as Genius spells it.
event_team_namecharacterName of the team.
event_abbreviationcharacterTeam abbreviation.
event_team_numberintegerTeam number in the game (1 home, 2 away).
event_placecharacterSide of the team the event belongs to: home or away.
player_idintegerGenius person id (Int64). A string key in the players maps, an integer in play-by-play and box-score rows; cast here so the frames join, and join the genius family.
player_pnointegerGenius shirt-table number of the player.
player_team_numberintegerTeam number in the game (1 home, 2 away).
player_first_namecharacterGiven (first) name(s) of the player.
player_family_namecharacterFamily name (this route says familyName; the others lastName).
coordinates_xdoubleShot or event x coordinate in Genius court units (Float64); origin and scale unverified.
coordinates_ydoubleShot or event y coordinate in Genius court units (Float64); origin and orientation unverified.
period_timeintegerMarker lines only: 0 (an integer), the start of the period.

Details

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

Sub-type codes

The values of sub_type:

  • 1of1: free throw 1 of 1

  • 1of2: free throw 1 of 2

  • 1of3: free throw 1 of 3

  • 24sec: shot-clock violation

  • 2of2: free throw 2 of 2

  • 2of3: free throw 2 of 3

  • 3of3: free throw 3 of 3

  • 3sec: three-second violation

  • 5sec: five-second violation

  • 8sec: eight-second violation

  • adjustment: clock adjustment

  • alleyoop: alley-oop shot

  • alleyoopdunk: alley-oop dunk

  • backcourt: backcourt violation

  • badpass: bad pass

  • ballhandling: ball-handling error

  • benchTechnical: technical foul on the bench

  • coachTechnical: technical foul on the coach

  • defensive: defensive rebound

  • disqualifying: disqualifying foul

  • disruptive: disruptive foul (unverified)

  • doubledribble: double dribble

  • drivinglayup: driving layup

  • dunk: dunk

  • end: end of the period or game

  • eurostep: euro-step layup

  • fadeaway: fadeaway jump shot

  • flagrant: flagrant foul

  • floatingjumpshot: floating jump shot

  • full: full timeout

  • heldball: held ball

  • hookshot: hook shot

  • in: player enters

  • jumpshot: jump shot

  • layup: layup

  • lodgedball: lodged ball

  • lost: lost the jump ball

  • offensive: offensive rebound or offensive foul

  • offensivegoaltending: offensive goaltending

  • officials: official timeout

  • other: other

  • out: player leaves

  • outofbounds: out of bounds

  • outofboundsrebound: rebound off an out-of-bounds ball (unverified)

  • personal: personal foul

  • pullupjumpshot: pull-up jump shot

  • reverselayup: reverse layup

  • start: start of the period or game, or clock start

  • startperiod: start of a period (jump ball line)

  • stepbackjumpshot: step-back jump shot

  • stop: clock stop

  • technical: technical foul

  • throwIn: throw-in violation (unverified)

  • tipindunk: tip-in dunk

  • tipinlayup: tip-in layup

  • travel: traveling

  • turnaroundjumpshot: turnaround jump shot

  • unsportsmanlike: unsportsmanlike foul

  • won: won the jump ball

Examples

# \donttest{
  try(sportality_pbp(game_uuid = "c4hh5nig6t"))
#> ── Basketligaen Play-by-Play from basketligaen.dk ─────────────── hoopR 3.2.0 ──
#> ℹ Data updated: 2026-10-31 21:33:59 UTC
#> # A tibble: 804 × 49
#>    game_source_id game_id event_id type     event_uuid  period period_type time 
#>             <int>   <int>    <int> <chr>    <chr>        <int> <chr>       <chr>
#>  1        2868126 2868126      800 game     75a1c424-6…      4 REGULAR     00:0…
#>  2        2868126 2868126      799 period   c7995db4-5…      4 REGULAR     00:0…
#>  3        2868126 2868126      798 clock    e67997fb-e…      4 REGULAR     00:0…
#>  4        2868126 2868126      797 clock    0de6a3c7-0…      4 REGULAR     00:0…
#>  5        2868126 2868126      796 2pt      cc616d49-8…      4 REGULAR     00:0…
#>  6        2868126 2868126      795 clock    84f92014-b…      4 REGULAR     00:0…
#>  7        2868126 2868126      794 clock    cf232264-d…      4 REGULAR     00:0…
#>  8        2868126 2868126      793 clock    1b5da16a-4…      4 REGULAR     00:1…
#>  9        2868126 2868126      792 turnover 504e3200-3…      4 REGULAR     00:1…
#> 10        2868126 2868126      791 clock    8a7eacf6-f…      4 REGULAR     00:1…
#> # ℹ 794 more rows
#> # ℹ 41 more variables: real_world_time <chr>, updated_time <chr>,
#> #   home_team_id <int>, home_team_code <chr>, home_team_name <chr>,
#> #   home_abbreviation <chr>, home_team_number <int>, home_place <chr>,
#> #   home_score <int>, away_team_id <int>, away_team_code <chr>,
#> #   away_team_name <chr>, away_abbreviation <chr>, away_team_number <int>,
#> #   away_place <chr>, away_score <int>, revision <int>, game_state <chr>, …
# }