skillfed

nba_api

An API Client package to access the APIs for NBA.com

nba-api v1.11.4 265.1K downloads/30d#8,330 on PyPI3,741
Permissive license MIT Active released

What it is and what it does

nba_api is a Python client library that wraps NBA.com's official statistics and live game data endpoints, letting you fetch player career stats, team information, game scores, and play-by-play data without building HTTP requests from scratch. It requires Python 3.10+ and depends on requests for HTTP calls and numpy for data handling; pandas is optional but needed if you want results as DataFrames. The package maps NBA.com endpoints and provides extensive documentation, though NBA.com itself does not publish endpoint specifications, so the maintainers reverse-engineer and document them as they discover changes.

You use it by importing specific endpoints (like PlayerCareerStats or ScoreBoard), instantiating them with parameters, then calling methods like get_json(), get_dict(), or get_data_frame() to retrieve results. It handles proxy support, custom headers, and timeout settings, and includes static data sets for frequently accessed player and team information to reduce HTTP requests. The package is actively maintained, has no known security vulnerabilities, and is permissively licensed under MIT.

Use it for:

  • Fetch historical player career statistics and season totals for analysis or visualization projects.
  • Build a live scoreboard or game tracker that updates with current game scores and play-by-play data.
  • Collect team rosters and player metadata for a sports analytics or fantasy basketball application.
  • Export NBA stats to pandas DataFrames for statistical modeling or data science workflows.
  • Reduce API call overhead by using static player and team data sets instead of repeated endpoint queries.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

nba_api provides Python access to NBA.com's official stats and live game data APIs, returning results as JSON, dictionaries, or pandas DataFrames.

Yes. nba_api is actively maintained, has low install friction, no security vulnerabilities, permissive MIT licensing, and a stable API surface. Install it if you need programmatic access to NBA.com data; be aware that NBA.com's own Terms of Use may restrict how you use the data, and endpoint availability depends on NBA.com's infrastructure.

Install

nba-api on PyPI

pip

pip install nba-api

uv

uv add nba-api

poetry

poetry add nba-api

Installing nba_api

Before you install

Low friction install with three common dependencies (numpy, pandas, requests). Package is actively maintained with recent commits and 3741 GitHub stars, supporting current Python versions.

License in practice

MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely as long as you include the license notice.

Quickstart

pip install nba_api

from nba_api.stats.endpoints import playercareerstats
career = playercareerstats.PlayerCareerStats(player_id='203999')
career.get_data_frame()

Requires Python 3.10+; pandas must be installed separately to use get_data_frame().

Verify before relying

  • Whether NBA.com's Terms of Use impose restrictions on programmatic access or data usage beyond the package's own licensing.
  • Rate limiting or throttling policies that may affect production workloads.
  • Endpoint stability and how often NBA.com changes or removes endpoints without notice.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 3 — numpy, pandas, requests
Maintenance actively maintained — 175 days since the last release
Last repo commit
First released
Downloads 265,069/month — #8,330 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: nba_api-1.11.4-py3-none-any.whl

Keywords: api, basketball, data, nba, sports, stats

Intended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Software Development

Tags

nba stats api clientbasketball data pythonnba.com api wrappernba live scores apiplayer career stats apinba game data pythonsports data api
sports-datarest-api-client

More Software Development packages