Skip to contents

Play-by-play (the site's text cast) of a final game, one row per event, from 1997-98 on.

Endpoint: GET https://api.kbl.or.kr/match/{gmkey}/text-cast

Usage

kbl_pbp(gmkey)

Arguments

gmkey

Game key S{seasonCode}G{gameCode}N{gameNo}, e.g. 'S47G01N49' (the 2025-26 regular season's game 49): season_code, game_code and game_no of kbl_schedule. Only final games are served; a malformed key is a hoopR_bad_request.

Value

A hoopR_data tibble: Play-by-play (the site's text cast) of a final game, one row per event, from 1997-98 on. The columns are always these, in this order (sportsdataverse-py kbl_pbp); an empty valid answer raises hoopR_no_data, a valid body with no rows for this frame is a zero-row tibble:

col_nametypedescription
gmkeycharacterGame key S{seasonCode}G{gameCode}N{gameNo} (e.g. S47G01N49): the id of every game route and game frame.
season_codeintegerKBL season code: one sequential number over every season and D-League edition (47 = 2025-26, 48 = the 2025 D-League).
seasonintegerSeason END year (2026 = 2025-26), derived from season_code through the crosswalk (kbl_codes.SEASONS).
game_codecharacterCompetition inside the season, two digits: 01 regular season, 03 playoffs, 04 final, 07 EASL, 08 D-League stage 2, 10 All-Star, 11/13 cups, 14 Open Match Day.
game_nointegerGame number inside the competition (glkey): the N part of the gmkey.
action_numberinteger1-based position of the event in the feed, which is in game order (the wire's n is 0 on every row of some games).
event_numberintegerSequence number of the event in the game (1-based); 0 on every row of some games (e.g. S45G01N95), so order by array position.
periodintegerPeriod number: 1-4 for the quarters, 5, 6, ... for the overtimes (the wire says X1 in the play-by-play, EQ1 in the match chart).
period_labelcharacterPeriod label: Q1-Q4, then OT1, OT2, ... (normalised from the wire's X1 / EQ1 / eq1).
minutes_leftintegerMinutes remaining in the period (10-minute quarters, 5-minute overtimes).
seconds_leftintegerSeconds part of the time remaining (0-59).
clock_seconds_leftintegerSeconds left in the period (minutes_left * 60 + seconds_left); quarters are 10 minutes, overtimes 5.
team_codecharacterTeam code of the acting team (the KBL team code, as tcodeH/tcodeA); ” (or ' ' in 1997-98) on game events such as period start/end.
player_namecharacterPlayer name in Korean; absent on team and game events.
player_name_encharacterPlayer name in English / romanized; absent on team and game events.
action_codecharacterAction code (string, e.g. '201'); table in the returns md.
actioncharacterEnglish meaning of action_code (kbl_codes.ACTIONS), translated from the site's Korean label; null for an unknown code.
action_kocharacterThe site's own Korean label of action_code (Hangul, e.g. the label for two-point field goal made).
pointsintegerPoints the event scored: 2 for a made two-point shot or dunk (201, 207), 3 for a made three (205), 1 for a made free throw (203); null otherwise.
substitution_codecharacterSubstitution sub-type code on substitution-out (102) rows (e.g. '101_0'); table in the returns md.
substitutioncharacterEnglish meaning of substitution_code on substitution-out rows (e.g. 106_1 = fouled out, five fouls); null otherwise.
foul_codecharacterFoul type code (the site reads an f field; no sampled row carries it): PNF personal, TCF technical, FRF unsportsmanlike, FTF fighting, PCF punching, EBF elbow.
foulcharacterEnglish meaning of foul_code (e.g. TCF = technical foul). No sampled row carries a foul code, so this is unverified.

Details

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

Examples

# \donttest{
  try(kbl_pbp(gmkey = "S47G01N49"))
#> ── KBL Play-by-Play from api.kbl.or.kr ────────────────────────── hoopR 3.2.0 ──
#> ℹ Data updated: 2026-10-31 21:30:55 UTC
#> # A tibble: 603 × 23
#>    gmkey  season_code season game_code game_no action_number event_number period
#>    <chr>        <int>  <int> <chr>       <int>         <int>        <int>  <int>
#>  1 S47G0…          47   2026 01             49             1            1      1
#>  2 S47G0…          47   2026 01             49             2            2      1
#>  3 S47G0…          47   2026 01             49             3            3      1
#>  4 S47G0…          47   2026 01             49             4            4      1
#>  5 S47G0…          47   2026 01             49             5            5      1
#>  6 S47G0…          47   2026 01             49             6            6      1
#>  7 S47G0…          47   2026 01             49             7            7      1
#>  8 S47G0…          47   2026 01             49             8            8      1
#>  9 S47G0…          47   2026 01             49             9            9      1
#> 10 S47G0…          47   2026 01             49            10           10      1
#> # ℹ 593 more rows
#> # ℹ 15 more variables: period_label <chr>, minutes_left <int>,
#> #   seconds_left <int>, clock_seconds_left <int>, team_code <chr>,
#> #   player_name <chr>, player_name_en <chr>, action_code <chr>, action <chr>,
#> #   action_ko <chr>, points <int>, substitution_code <chr>, substitution <chr>,
#> #   foul_code <chr>, foul <chr>
# }