Spotify Client ID, Secret & API Token
In order to make API calls with the Spotify Web API with our Spotify Data Scraper (or similar Spotify client), you’ll need to obtain & provide a Spotify API Access Token from the Spotify developer dashboard.
And in order to get a Spotify API Token, you’ll need your Client ID and Client Secret, which you can find in the Developer Dashboard. In this article, we’ll show you how to obtain these values and then exchange them for an API Token.
1. Log in to Spotify’s Developer Dashboard
Head to the Spotify Developer Dashboard and access your Spotify developer account by clicking the “Login” button on the bottom of the screen (just use your normal Spotify login). You can also create a free Spotify account using the link on the screen if needed:
2. Create an App
Select the “Create an App” button and provide a brief name and app description. If you’re just looking to scrape data from Spotify, these won’t matter too much as no one else will see them. You will also need to carefully read and accept the Developer Terms of Service.
You may be prompted to provide Redirect URIs, but you should be able to ignore these and leave these blank since you’re only using the developer app for data scraping. If required, you should be able to enter in something like http://localhost
to use for internal developer testing.
3. Copy Client ID & Client Secret
Once your app is created, you should see your Client ID and the secret Spotify key. For a better developer experience, copy these values into a secure location like a password manager, so you don’t need to keep logging in to the Developer Portal’s Dashboard to retrieve these.
The Spotify ID field, or Client ID is not sensitive and you can share it with others on your team, but keep the secret in a secure location.
4. Generate a Spotify API Token
You’ll now need to follow the steps to exchange your Client ID & Secret for an Access Token (or “API Token” as we call it).
You can follow the official Spotify Authorization Guide, but you essentially need to make a POST
request to https://accounts.spotify.com/api/token
and pass in grant_type=client_credentials&client_id={{client_id}}&client_secret={{client_secret}}
as the request body.
If this is too complicated, you can use the Spotify Authentication Endpoint on the Spotify Scraper and simply paste in your Client ID and Client Secret:
You’ll then see the API Token under the access_token
field in the response:
Simply copy this value and you’re done! This token will last for 1 hour, and after that you’ll need to re-generate the token again (just follow this Step, no need to repeat Steps 1 - 3).
Scraping Spotify Data
Once you have your API token, you can use it to scrape data from the Spotify API. To get started, we can use the Spotify Search Results Scraper and paste in your Spotify API Token from Step 4 when prompted. You can then enter a search term like hip hop
and execute the endpoint, where you’ll be able to download the results as CSV files: