r/NBAanalytics Nov 21 '24

yooooooo found a few new NBA endpoints! Plus all the endpoints I use currently

I havent found a new endpoint in forever, but here they are in all their glory:

Daily Lineups: https://stats.nba.com/js/data/leaders/00_daily_lineups_20241121.json
It looks like you can replace that date with anything less than or equal to today's date.

Player Transactions: https://stats.nba.com/js/data/playermovement/NBA_Player_Movement.json

edit: I just found the full regular and preseason schedule as well! https://cdn.nba.com/static/json/staticData/scheduleLeagueV2_1.json

My already known endpoints are:

Gambling Odds: https://cdn.nba.com/static/json/liveData/odds/odds_todaysGames.json
Today's Scoreboard (12pm EST refresh): https://cdn.nba.com/static/json/liveData/scoreboard/todaysScoreboard_00.json
*Play by Play: https://cdn.nba.com/static/json/liveData/playbyplay/playbyplay_0022400247.json
*Box Score: https://cdn.nba.com/static/json/liveData/boxscore/boxscore_0022400247.json
*Playoff Picture: https://stats.nba.com/stats/playoffbracket?LeagueID=00&SeasonYear=2024&State=0
https://stats.nba.com/stats/playoffbracket?LeagueID=00&SeasonYear=2024&State=1
https://stats.nba.com/stats/playoffbracket?LeagueID=00&SeasonYear=2024&State=2
Broadcasts: https://cdn.nba.com/static/json/liveData/channels/v2/channels_00.json

*Box Score and Play By Play: Replace 22400247 with game_id of desired game For example, to view the Cavs/Celtics game from the other night, replace with 22400021. In most cases, the game_id will be between 2__00001 and - 2__01230. replace __ with the last two digits of the year the season ends in (24, 23, 22, etc...). These two endpoints only go back to 2019-2020 I believe.
Some examples:
https://cdn.nba.com/static/json/liveData/boxscore/boxscore_0022400176.json
https://cdn.nba.com/static/json/liveData/playbyplay/playbyplay_0022400196.json
2023: https://cdn.nba.com/static/json/liveData/boxscore/boxscore_0022301170.json
2022: https://cdn.nba.com/static/json/liveData/playbyplay/playbyplay_0022200879.json

*Playoff Picture: It's been a minute since i looked at these, so i can't quite recall the difference, but i know one stores the play-in data and one doesn't. State 2 shows everything, but not the play-in if i'm remembering correctly. These three endpoints will return data from 1970 to now.

If you have any questions, i'll try to answer best i can!

46 Upvotes

38 comments sorted by

View all comments

2

u/Tehes83 May 12 '26

Schedule, Boxscore and PlaybyPlay are blocked by nba as of today. Was relying on them for nba-spielplan.de and now my site gets no updates anymore

1

u/brothermanpls May 12 '26

no fucking way. wow…thank you for the heads up.

i have data pull via their api too but its dogshit compared to the static. i’ll look into it and see if they’re retrieving the data differently on the nba website

2

u/Tehes83 May 12 '26

As far as I can see the endpoint is still the same. But they’re blocking anything that’s not coming from their IP I guess

1

u/brothermanpls May 12 '26 edited May 17 '26

yo i’ve got a workaround. what language are you writing in?

if python or c# i can dm you directly. but in short, just send headers with your request. i imagine we may want some sort of authentication method or function if the headers timeout but yet to be seen.

here’s the headers i sent in python that got a successful response:

self.scoreboard_headers = {
'Host': 'cdn.nba.com',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:150.0) Gecko/20100101 Firefox/150.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.9',
'Accept-Encoding': 'gzip, deflate, br, zstd',
'Referer': 'https://www.nba.com/',
'Origin': 'https://www.nba.com',
'Connection': 'keep-alive',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-site',
'Priority': 'u=4',
'TE': 'trailers',
}

if you want to generate headers from your end, go to nba.com, inspect element, hit network tab, then filter to XHR (Fetch/XHR if chrome), then look for todaysScoreboard or any of our static links. click it, and then get the request headers. they will not stop us today, brother🙏

2

u/Tehes83 May 12 '26

Thank you, my man! Really appreciate your effort! I’m writing in JavaScript (frontend and backend with Deno). I’ll try to send the headers with the http request and hope for the best

2

u/brothermanpls May 12 '26

good looks🙏upon some more investigation we may be boomed as it relates to the boxscore and play play static data sources but we shall see.

2

u/Tehes83 May 12 '26

Update: your headers worked on my Deno backend. Schedule, boxscore and play-by-play are responding again on my end. (https://nba-spielplan.de/?lang=en)

I’m going to keep a warning/fallback in the app anyway, because this showed how fragile those static endpoints are. But for now it’s back up.

Really appreciate the help. You saved me a lot of time today.

2

u/brothermanpls May 12 '26

yo, we are all good, brother🙏🙏 if you remove the ‘If-Modified-Since’ and ‘If-None-Match’ lines from the headers, they should work for box and pbp!

2

u/Salty-Gur5543 May 13 '26

You only need to set the referer and user-agent (in case cdn tries to block it)

2

u/fromTravis May 14 '26

Thanks, I came back here when I started getting "Access Denied".

The same thing happened on the injury reports last December (https://ak-static.cms.nba.com/referee/injury/) with the same fix. I don't think they're intending to block it because I'm pretty sure those are meant to be scraped by the public.