Is The Spotify Api Free

  1. Spotify Api Play Song
  2. Is The Spotify App Free On Desktop

Spotify is a digital music service that gives you access to millions of songs. Downloads songs from any Spotify playlist, album or track. I wanted an easy way to grab the songs present in my library so I can download it & use it offline. Spotifytomp3 worked well but it relied on grooveshark, which unfortunately is no more.

Using the Spotify API

Spotify Api Play Song

Login to your Spotify Account here to link it to Spotify for Developers -
Create an app

Is The Spotify App Free On Desktop

Click the button, or use this link -

Fill in the form

Application Name and Application Description fields are not that important - just choose something sensible.

Song
Go to an endpoint in the Interactive console on the developer website

Here's the Search endpoint

Get a token

There's a field called OAuth Token -

Click GET OAUTH TOKEN next to it.
Click REQUEST TOKEN.
Click OKAY.

Copy the key into a safe place

This token will expire in a hour, but some tokens you use may be indefinite. There are bots that scan GitHub for these keys to abuse them. Maybe there's not much damage someone can do with a Spotify key. But if someone had your AWS one...they could spin up a million servers and charge it to your credit card!

The solution is to stick it in another file that you then .gitignore.

Use the token in our request

Before we send our request (ie before request.send()) we need to include this token in our request so Spotify can authorize us -

Remember

The token only lasts an hour so you may need to go back to the developer site to get a new one for your spotifyToken.js-
(OAuth Token field -> CLEAR TOKEN -> REQUEST TOKEN)

You'll know you need to this if you get a 401 Unauthorized error in your console. (If you get this error earlier you may not have pasted the token in correctly).

Further

We should really automate this token generation...one for further reading -

Table of Contents

Need a side project for the new year? We’ve got #12DaysOfAPIs to give your project inspiration. Today, we’re highlighting 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 is the Spotify API and what can I do with it?

Spotify API Examples
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 Spotify API 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_ID and client_Key from Spotify directly. Here’s how to get them:

  1. Go to Spotify Developers section
  2. Login or sign up to create new applications and manage your Spotify credentials to authenticate your API requests.
  3. 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.

Project Ideas

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 getTags endpoint 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.

Want more ideas?

Follow along our #12DaysOfAPIs series on the blog, Facebook or Twitter! Happy coding ????

4.9/5(158 votes )