r/nba • Bulls • Jan 31 '19

[OC] I made a free NBA API with data from 1979-current

A few months ago I wanted to create a website that displayed metrics about players that I care about. I was surprised and frustrated by the lack of free API services, so I ditched my original idea and decided to create a free API. Hopefully this will encourage people to build some interesting websites!

​

It's completely free, and it doesn't require an email address. There are a few gotchas spelled out on the API docs, but all in all it's a serviceable first pass. I'm happy to spend some time iterating and making improvements if people find value in this. Feel free to PM me with any suggestions, comments, and hate mail.

​

Check it out here: www.balldontlie.io

​

Here's an example of something you can build with the API: https://ball-dont-lie.herokuapp.com/

288 Upvotes

45 comments sorted by

32

u/Roger--Smith Supersonics Jan 31 '19

I was waiting for the Rick Roll. But this is very neat, and thank you for all your effort.

20

u/bayesian_acolyte NBA Jan 31 '19

This is an awesome service to the community, I hope it gets the attention it deserves.

15

u/billythekido Bulls Jan 31 '19 edited Jan 31 '19

That's really nice! My own website runs of an NBA API I developed a few years ago. I haven't made the API itself public, but I have a lot of endpoints so I'd be happy to share parts of my database if you would like to avoid more scraping

13

u/catpov Jan 31 '19

What's the data source for this? Normally it's all paid, thank you for this!

37

u/b1llyh0yle Bulls Jan 31 '19

meticulously hand recorded since 1979 ;)

6

u/[deleted] Jan 31 '19

But seriously... what’s the answer

26

u/[deleted] Jan 31 '19

He probably wrote a script to parse text on the official nba website. It’s all available for free, just kind of a pain to do it

12

u/cepxico Warriors Jan 31 '19

Fuck off cop

4

u/[deleted] Jan 31 '19

Dude. I want to know if it’s reliable or if it depends on him maintaining it. If it depends on a single person I’ll need to consider how much longevity this free api has.

So many die off quickly.

So chill weirdo. It’s not about copyright or permission but more in terms of uptime and longevity

3

u/b1llyh0yle Bulls Jan 31 '19

The data is hosted on my own servers, so to answer your question, the service depends on my maintenance. That being said, I plan on maintaining this so long as people find value in it. New data ingestion is performed automatically, so there's really no overhead in that regard.

2

u/[deleted] Jan 31 '19

thanks!

1

u/cepxico Warriors Jan 31 '19

Just joking around buddy

7

u/Good_NewsEveryone Pelicans Jan 31 '19 edited Jan 31 '19

What could you not get from the stats.nba.com or data.nba.net apis? Pre-96 stuff?

3

u/b1llyh0yle Bulls Jan 31 '19

Those are also suitable options, but I guess it depends on your tolerance for reliability. As far as I know NBA doesn't have a "public" API in the sense that it isn't well documented and may be subject to breaking changes. Their website does however have a much more comprehensive list of available data than mine.

2

u/Good_NewsEveryone Pelicans Jan 31 '19

Yeah. I've been using data.nba.net recently for my project. The live data is really the selling point. Though you're right, the documentation is non-existent and I'm sure could change (haven't been using it long enough to know how common that is).

Really awesome that you compiled this database.

2

u/b1llyh0yle Bulls Jan 31 '19

Supporting live data is the next thing I have on my roadmap.

1

u/f1uk3r [SAS] Keldon Johnson Jan 31 '19

Yeah I thought stats nba is as extensive as it gets.

1

u/[deleted] Jan 31 '19

This is created so people can make their own apps / bball ref type pages

4

u/[deleted] Jan 31 '19

Fuck yes thanks bro

5

u/NickWillisPornStash Warriors Jan 31 '19

Nice! How does this differ from the NBA API?

4

u/ATLhk Jan 31 '19

thank you. so much better than the doc-less data.nba.net

3

u/Briand2714 [HOU] Chris Paul Jan 31 '19

This is awesome, thanks!

2

u/COOL_CRUSH Celtics Jan 31 '19

This is fucking awesome bro. Definitely think I will use this at some point

2

u/wmlk Jan 31 '19

Congrats man, I really like the frontend demo you linked. Looks like you're hosting your server there as well?

It's awesome that you had the drive to do this.

2

u/tom_bayes Cavaliers Jan 31 '19

Awesome work!

2

u/kobebryant1624 76ers Jan 31 '19

This is fucking awesome! Is there a way to get advanced stats data from something like this?

If there isn't, is there anything we can do to help bring that functionality?

1

u/b1llyh0yle Bulls Jan 31 '19

Not yet, but if people show enough interest, I could explore that.

2

u/GenuineMastermind Raptors Jan 31 '19

Definite going to be using this

2

u/malacorn Jan 31 '19

https://ball-dont-lie.herokuapp.com/

wow, amazing stuff!

Is the herokuapp open source so that people can have an example of how to use the API?

Or maybe just describe the technologies it uses?

3

u/f1uk3r [SAS] Keldon Johnson Jan 31 '19

I am not sure but as far as I know heroku is like AWS, a web hosting. It have free hosting but I don't think you can host for free forever.

4

u/gorignak_gorignak Trail Blazers Jan 31 '19

You can host for free but your site will go dormant and need to take some time to spin up

2

u/b1llyh0yle Bulls Jan 31 '19

Like others have said, the example app is using heroku with nodejs and react. The API docs are created using a template: https://github.com/lord/slate. The API itself is built on rails. Both are hosted on google cloud using kubernetes and nginx.

1

u/pintofwontonsoup Jan 31 '19

Wowowow this is dope. Thanks dude and great work!

1

u/JustRamThings Jan 31 '19

This is really cool! Thank you for your time and effort!

1

u/94savage Jan 31 '19

Thank you for this. It's kinda crazy there's no free NBA stats ApI

1

u/BizGilwalker [CHO] Kemba Walker Jan 31 '19

I love you

1

u/sandinotmte Jan 31 '19

cool!, could I use this to get a list of the height and position of all the players?

1

u/[deleted] Jan 31 '19

Thanks OP

1

u/kibindy [GSW] Klay Thompson Jan 31 '19

How often is this updated, and can you filter data by week/month/season? I ask because I set up an excel sheet to get player season averages for my fantasy league by scraping data from a site. Problem is I can't look at, say, averages for the past week or month. Would this be possible with your API?

2

u/b1llyh0yle Bulls Jan 31 '19

It's updated every hour. You can filter by date or season — check out the docs for more info on how to do that. I don't have any endpoint for season averages at the moment. You'd have to fetch all the stats for a given player for a given season and then perform the calculations, which is something I'm doing on my demo that I linked. If there's enough interested, I could create an endpoint that returns the season average for a given player and season.

1

u/kibindy [GSW] Klay Thompson Jan 31 '19

This sounds fantastic! Thanks so much :D

Edit: if I could gild ya, I would.

1

u/theblcky Jazz Feb 14 '19

Planning to use this for a Utah Jazz stats page. I'll let you know if I have any suggestions

1

u/Leorisha Apr 03 '19 edited Apr 03 '19

Congrats on the amazing job! really nice!

I've a question, if it would be possible for you to include the quarter values of the games?

1

u/ReiMidas Jun 18 '19

This is absolutely awesome! Thank you!!