Skip to main content

Overview

This endpoint retrieves comprehensive per-game statistics for a specific NBA player during the current season. It uses the nba_api.PlayerDashboardByGeneralSplits endpoint to fetch detailed player performance data.

Authentication

This endpoint requires authentication. The user must have a valid session token.

Path Parameters

player_id
integer
required
The unique NBA player ID (PERSON_ID). This can be obtained from the /api/nba_players endpoint.

Response

Returns an object containing per-game statistics:

Game Information

GP
integer
required
Games Played
MIN
float
required
Minutes Per Game

Scoring Statistics

PTS
float
required
Points Per Game
FGM
float
required
Field Goals Made Per Game
FGA
float
required
Field Goals Attempted Per Game
FG_PCT
float
required
Field Goal Percentage
FG3M
float
required
Three-Point Field Goals Made Per Game
FG3A
float
required
Three-Point Field Goals Attempted Per Game
FG3_PCT
float
required
Three-Point Field Goal Percentage
FTM
float
required
Free Throws Made Per Game
FTA
float
required
Free Throws Attempted Per Game
FT_PCT
float
required
Free Throw Percentage

Other Statistics

REB
float
required
Rebounds Per Game
AST
float
required
Assists Per Game
STL
float
required
Steals Per Game
BLK
float
required
Blocks Per Game
TOV
float
required
Turnovers Per Game
DD2
float
required
Double-Doubles
TD3
float
required
Triple-Doubles

Implementation Details

The endpoint uses PlayerDashboardByGeneralSplits from nba_api.stats.endpoints:
from nba_api.stats.endpoints import PlayerDashboardByGeneralSplits

season = current_nba_season()  # e.g., "2023-24"

dashboard = PlayerDashboardByGeneralSplits(
    player_id=player_id,
    season=season,
    per_mode_detailed="PerGame"
)

data_frames = dashboard.get_data_frames()
player_stats_df = data_frames[0]
stats_series = player_stats_df.iloc[0]

Data Processing

The endpoint processes the raw NBA API data as follows:
  1. Games Played (GP): Converted to integer
  2. All other statistics: Converted to float
  3. Null/missing values: Default to 0 or 0.0 depending on type

Example Response

{
  "GP": 58,
  "MIN": 35.2,
  "PTS": 29.8,
  "REB": 8.2,
  "AST": 6.9,
  "STL": 1.3,
  "BLK": 0.5,
  "TOV": 3.1,
  "FG3M": 2.4,
  "FGM": 11.2,
  "FGA": 22.1,
  "FTM": 5.0,
  "FTA": 6.2,
  "FG3A": 6.8,
  "FG_PCT": 0.507,
  "FT_PCT": 0.806,
  "FG3_PCT": 0.353,
  "DD2": 32.0,
  "TD3": 5.0
}

Error Handling

The endpoint implements comprehensive error handling:

Authentication Error (401)

Returned when the user is not authenticated.

Not Found Errors (404)

  • Empty DataFrame: Player exists but has no stats for the current season (possibly inactive)
  • No DataFrames: NBA API returned no data for the player

Network Errors (504)

  • Timeout: NBA API request timed out
  • Connection Error: Unable to connect to NBA API

Server Errors (500)

Generic errors that occur during data fetching or processing. The error message includes the exception type and details.

Usage Notes

  • Statistics are calculated as per-game averages (not totals)
  • The endpoint automatically uses the current NBA season
  • Player must have played at least one game in the current season to return data
  • All percentage statistics are returned as decimals (0.507 = 50.7%)
  • The per_mode_detailed parameter is set to “PerGame” for per-game statistics

Build docs developers (and LLMs) love