NBA play-by-play
Every action of a game: period, clock, team, player, action type and sub-type, description, score, shot result, distance and court location, assists, rebounds, fouls, substitutions. Filter by period and action_type.
Every response includes credits_used: the credits this call cost.
Part of the NBA API: 22 endpoints with prices, use cases and example responses.
Parameters
| name | type | description |
|---|---|---|
idrequired | string | Game id like 0022500123 from /nba/v1/scoreboard or /nba/v1/games, or an nba.com game link. Example: 0022500123 |
period | integer | Only this period (1-4, 5+ overtime). |
action_type | string | Comma-separated action types, e.g. 2pt, 3pt, freethrow, rebound, turnover, foul, substitution, timeout, jumpball. |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/nba/v1/play-by-play?id=0022500123" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/nba/v1/play-by-play",
params={"id": "0022500123"},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json() const url = new URL("https://api.api.sh/nba/v1/play-by-play");
url.searchParams.set("id", "0022500123");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json(); Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).
Example response (real call, trimmed: lists cut to 2 items, long text shortened, raw left out)
{"game_id": "0022500123","url": "https://www.nba.com/game/0022500123/play-by-play","applied_filters": {"period": null,"action_type": null},"total_actions": 636,"count": 636,"actions": [{"action_number": 2,"clock": "PT12M00.00S","time_actual": "2025-10-28T23:10:49.5Z","period": 1,"period_type": "REGULAR","action_type": "period","sub_type": "start","qualifiers": [],"person_id": 0,"x": null,"y": null,"possession": 0,"score_home": "0","score_away": "0","edited": "2025-10-28T23:10:49Z","order_number": 20000,"is_target_score_last_period": false,"x_legacy": null,"y_legacy": null,"is_field_goal": 0,"side": null,"description": "Period Start","person_ids_filter": []},{"action_number": 4,"clock": "PT11M57.00S","time_actual": "2025-10-28T23:10:51.5Z","period": 1,"period_type": "REGULAR","team_id": 1610612755,"team_tricode": "PHI","action_type": "jumpball","sub_type": "recovered","descriptor": "startperiod","qualifiers": [],"person_id": 1642845,"x": null,"y": null,"possession": 1610612755,"score_home": "0","score_away": "0","edited": "2025-10-28T23:10:51Z","order_number": 40000,"is_target_score_last_period": false,"x_legacy": null,"y_legacy": null,"is_field_goal": 0,"jump_ball_recovered_name": "V. Edgecombe","jump_ball_recoverd_person_id": 1642845,"side": null,"player_name": "Edgecombe","player_name_i": "V. Edgecombe","person_ids_filter": [1642845,1626162,"… 1 more"],"jump_ball_won_player_name": "Oubre Jr.","jump_ball_won_person_id": 1626162,"description": "Jump Ball K. Oubre Jr. vs. A. Sarr: Tip to V. Edgecombe","jump_ball_lost_player_name": "Sarr","jump_ball_lost_person_id": 1642259},"… 634 more"],"cached": false,"credits_used": 1}