What this thread does
The problem
You build an NBA stats or fantasy-basketball tool with an agent and the data layer is nba_api. Requests hang until Read timed out, or fail with JSONDecodeError: Expecting value, often right after working fine. Agents then guess: longer timeouts, retries, new versions.
What users reported in the issue tracker
Project: swar/nba_api (MIT). It wraps NBA.com's unofficial stats endpoints, which are undocumented and can change; one commenter notes they were not meant for public developer use.
- March 2026, issue "NBA Api timeout" (open, checked 2026-11-14): all
statsrequests started timing out on 12 March. One user said adding browser-like headers fixed it (Host,Connection,Accept,User-Agent,Referer: https://www.nba.com/,Origin: https://www.nba.com,x-nba-stats-origin: stats, the x-nba-stats-token header set to true,Accept-Language) and passed them via the endpoint'sheaders=argument; another confirmed it worked, others said it did not. Reports from 19 March and 7 April say the headers did not help them, and a 13 May commenter says the header workaround had stopped working; a 4 June commenter said the headers did work for them. - May 2026, same issue: one commenter wrote that NBA's bot protection now also checks the TLS fingerprint, so plain Python
requeststimes out even with the right headers. Their fix:curl_cffiwithimpersonate="chrome120", a warm-up request tohttps://www.nba.com/stats/for cookies, and replacing the sessionnba_apiuses. A later user said that did not work for them but the header approach did. So: neither fix is reliable. - Older pattern (issue from 2022 to 2023, still open, checked 2026-11-14):
/statsendpoints time out in production on AWS while working locally, and/liveendpoints oncdn.nba.comwork. A project contributor wrote that AWS, GCP and Heroku IP addresses are blocked by NBA, that headers cannot fix that, and that routing requests through a paid proxy (a VPN provider's proxy endpoint) let them use/statsfrom AWS Lambda; free proxies did not work for another user. One user said their home IP got blocked after a while and a VPN restored access. - 8 October 2026 (closed): a user reported every
stats.nba.com/stats/*request returning HTTP 200 withContent-Type: text/htmland an "unable to process your request" page from the CDN, surfacing asJSONDecodeError. Other IPs did the same. They notedcdn.nba.comliveData and staticData JSON still worked, and two days later wrote it seemed fixed. - Why the confusing error: another issue notes
nba_api.liveswallows a 403 and raisesJSONDecodeError, so the real status is hidden; a pull request adding aRefererheader to live requests (said to be enough for the CDN at the time) was closed in October without merging, as far as I can tell. - Rate limits: a commenter says cut-offs came after roughly 100 to 600 calls, with waits of an hour or more.
- A contributor in the older issue 176 (2020) asks people to log timeouts in a shared sheet for documentation.
What to put in your agent's rules
NBA data comes from unofficial endpoints that block, throttle and change. Rules: (1) check HTTP status and content type before parsing JSON and log both; (2) set an explicit timeout and a small retry with backoff; (3) cache every response in our database and never call the API per page view; (4) run the data refresh as a scheduled job, not in the request path; (5) prefer the cdn.nba.com live and static JSON for schedules and box scores when they are enough; test from the machine where it will run, since cloud IPs may be blocked; (6) if stats.nba.com fails, serve the cached data and show its age.
Mistakes to check
- Raising the timeout to minutes: it hides a block.
- Hammering the API in a notebook loop; add pauses.
- Assuming a header recipe from one month still works.
- Deploying to a cloud host without testing a real call from that host.
Limits
This is a summary of public issue threads, not a test. I did not run any of the fixes. If you need dependable data, a licensed or documented sports-data API may be safer than these unofficial endpoints.
Sources
- swar/nba_api issue 652, NBA Api timeout, read through the GitHub API on 19 Oct 2026. Checked: opened 12 Mar 2026 and still open on 2026-11-14; the header list and the March and April reports that it worked or did not; the 13 May comment about TLS fingerprinting, curl_cffi with chrome120, the nba.com warm-up and the session replacement (one commenter's unconfirmed explanation, which a 4 June commenter says did not work for them); the 100 to 600 call cut-off comment.
- Issue 696, stats endpoints return an Akamai HTML error page. Checked: opened 8 Oct 2026, closed 10 Oct; HTTP 200 with text/html, JSONDecodeError, other IPs behaving the same, cdn.nba.com liveData and staticData still working, reporter later says it seems fixed.
- Issue 320, NBA API: timeout for /stats endpoints (opened 28 Dec 2022, still open, checked 2026-11-14), issue 176, issue 678 and pull request 671. Checked: AWS timeouts with working /live endpoints, a contributor saying AWS, GCP and Heroku IPs are blocked and that a paid VPN proxy worked from Lambda, free proxies failing; live client raising JSONDecodeError on a 403 (678, open, checked 2026-11-14); the Referer-header pull request closed unmerged on 15 Oct 2026; the contributor's timeout-log request (176); a commenter saying the endpoint is undocumented and not meant for public developer use (in 678). Repo metadata: MIT.
- Not checked: that the headers, curl_cffi or proxy fixes work today, the "Referer was enough at the time" statement in the pull request, whether NBA.com blocks the IP ranges named (contributors' statements, not NBA's), and the agent-rules prompt (the author's own). I ran nothing against NBA endpoints and did not read the other timeout issues in the tracker.
Started from a post by @swar/nba_api issue thread, packaged by the editor. Original post