nba_api is an API client package that provides Python access to the endpoints and data served by NBA.com.
The package solves the problem of programmatically accessing NBA statistics and live game data without having to reverse-engineer or manually construct requests to NBA.com's undocumented APIs. It wraps these endpoints in a Python interface and maintains extensive documentation about endpoint parameters and behavior, filling a gap left by NBA.com's lack of official API documentation. The tool handles HTTP requests through the requests library and supports options like proxy configuration, custom headers, and timeout settings.
The tool suits developers building basketball analytics projects, statistical analysis tools, or applications that need current NBA player stats, team data, or live game information. It works well in Jupyter Notebook environments for exploratory analysis and includes static data sets for frequently accessed player and team information to reduce unnecessary HTTP requests. The package requires Python 3.10 or later and depends on the requests and numpy libraries, with optional pandas support for DataFrame operations.
The project maintains active community engagement through a dedicated Slack workspace and Stack Overflow presence where users can ask questions and report issues. The maintainers actively track changes to NBA.com's endpoints and accept community reports of new, changed, or deprecated endpoints through GitHub issues. Documentation is extensive, covering endpoint analysis, usage examples, and practical Jupyter Notebook demonstrations of common tasks like retrieving game data and working with play-by-play information.