Need a side project for the new year? We’ve got #12DaysOfAPIs to give you project inspiration. Today, we’re highlight Spotify’s Public API and what you can build with it. Read on or go straight to the Spotify package page to get started.
What can I do with the Spotify Public API?
Spotify has over 30 million songs in their catalogue (organized by artist and genre), not to mention countless playlists. That makes for one robust musical database. Spotify’s Public API lets you call data based on artist, album, song, playlist or related artist. Not bad for a music lover!
We’ve built an API package that lets you call the Spotify Public API right from your browser, then export the code (in the language of your choice, obvs) into your script.
How to call the Spotify Public API
First step, head over to the Spotify Public API package page! Next, pick the endpoint you’d like to call. Finally, fill in the parameters and click “Test Function.” Bam! You’ve just called the Spotify API.
Some endpoints require a Spotify ID for a certain artist. You can get the Spotify ID for an artist by calling the
searchArtists endpoint and getting the Spotify ID from the results of the API call. Here’s how to do it:
Need more functionality?
Not all projects needs will be filled with our Spotify Public API package alone. If you want to build something using user information (ex. pull a Spotify user’s followed artists), we have a Spotify User API package that includes that functionality. While Spotify actually doesn’t separate the User and Public into two APIs, we built two packages to separate the methods that require an API key (User API) from those that don’t (Public API).
To use the Spotify User API package, you’ll need to get the
client_Key from Spotify directly. Here’s how to get them:
- Go to Spotify Developers section
- Login or sign up to create new applications and manage your Spotify credentials to authenticate your requests.
- Create new app
- When you register an application on your account, two credentials are created for you – Client ID and Client Secret. You can see the credentials on the application’s details page.
The Spotify Developer Showcase has some very cool projects built with the Spotify API for your inspiration. We had a few ideas of our own as well! One of the biggest reasons we built RapidAPI is so developers could call multiple APIs from one endpoint. Here are some cool project ideas connecting the Spotify Public API to others on the marketplace.
- Build a Slack channel where people can suggest music to play at the office
- Identify songs from a picture of the artist! Use the Clarifai
getTagsendpoint and the celebrities custom model to recognize a famous artist from a picture, then the Spotify Public API to retrieve songs from that artist.
- Create a Twitter script that tweets playlist links based on whatever phrase a user inputs.
Let us know about any cool stuff you build in the comments below! We’d love to see anything you come up with.