Build an NBA box score
A box score is one game plus the per-player stat lines for both teams. Here we find a game, then fetch its player stats and join them to the players and teams.
1. Find the game
List games filtered to a date to get the game id you want a box score for.
curl -sS \ -H 'Authorization: Bearer YOUR_API_KEY' \ 'https://api.stat-api.com/api/v1/nba/games?date=2026-01-15&limit=20'2. Pull per-player stats for that game
game_player_stats is keyed by game_id — one row per player who appeared. The rows carry team_id and player_id foreign keys.
curl -sS \ -H 'Authorization: Bearer YOUR_API_KEY' \ 'https://api.stat-api.com/api/v1/nba/game_player_stats?game_id=122'3. Join players and teams
Resolve the player_id and team_id references to names. Fetch the two teams from the game and the players you need; the Data Dictionary shows every FK.
const headers = { Authorization: 'Bearer YOUR_API_KEY' } const base = 'https://api.stat-api.com/api/v1/nba' const stats = await fetch(`${base}/game_player_stats?game_id=122`, { headers }) .then(r => r.json()) // Group the stat lines by team to render two halves of the box score. const byTeam = Map.groupBy(stats.game_player_stats, (s: { team_id: number }) => s.team_id)4. Render both halves
With stat lines grouped by team_id you have everything a box score needs — points, rebounds, assists, minutes — for home and away.