If you are not a subscriber of The Fanbase Builder, join the hundreds of artists, creators, and music industry executives who receive it for free.
Let’s dive into today’s topic:
How to access the Spotify Web API
Due to changes in Spotify’s official API, my manual on Spotify’s Developer Tools is no longer up to date, and the Spotify API is now only accessible to those with programming expertise.
Fortunately, accessing Spotify's Web API doesn't have to be daunting. Follow these straightforward steps to get started.
Why it matters
Spotify's algorithms play a crucial role in shaping music discovery and recommendation. Understanding how to access Spotify's API provides valuable insights into how these algorithms work.
This manual explains how to access Spotify’s API. Next week, we’ll explore how to retrieve catalogue data using the API.
How it works
Here's a simplified guide to accessing Spotify's Web API:
Step 1: Make sure cURL is installed
cURL is a command-line tool used to interact with web services. Make sure it’s installed on your system.
macOS comes with cURL pre-installed. It’s accessible through the Terminal app.
Windows 10 has cURL pre-installed since version 1803 (April 2018). Artists using older versions can install cURL manually. I’m not a Windows user but found a simple manual here.
Step 2: Create an app in Spotify for Developers
Log into the Spotify for Developers dashboard using an existing Spotify account and create an app.
Select ’Web API’ as the API type. Create a random ‘App Name’, ' App Description’, and a random redirect URL.
Copy the generated ‘Client ID’ and ‘Client secret’ for later use. Important: Do not reveal the ‘Client secret’ publicly.
Step 3: Obtain an access token
Please note: This manual is written from a macOS perspective. I found some suggestions for altering the cURL syntax for Windows.
macOS: Open the Terminal app (cmd+space > Search ‘Terminal’).
Windows: Open command prompt (Start > Search ‘cmd’).Run this code, replace
{{CLIENT_ID}}
and{{CLIENT_SECRET}}
with your app’s credentials (as generated in the previous step):
curl -X POST "https://accounts.spotify.com/api/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id={{CLIENT_ID}}&client_secret={{CLIENT_SECRET}}"
If everything goes well, an access token is generated:
{"access_token":"thisistheaccesstoken","token_type":"Bearer","expires_in":3600}
Copy and paste the access token for later use (here:
thisistheaccesstoken
). It is valid for 60 minutes.
Go deeper: Retrieving catalogue data using the Spotify Web API
Today, we’ve accessed Spotify’s API. Next week, we’ll retrieve Spotify catalogue data using the API.
For those who can’t wait, explore the Web API documentation on Spotify for Developers and get started.
For example, run this code and read its documentation. Replace {{ACCESS_TOKEN}}
with the one generated in the previous step.
curl "https://api.spotify.com/v1/artists/4oLeXFyACqeem2VImYeBFe" \
-H "Authorization: Bearer {{ACCESS_TOKEN}}"
Yes, but..
It's not common for artists to deal with technical aspects of DSPs such as Spotify, and it's perfectly fine for them to focus on creating great music instead. However, it's valuable to understand how machines interpret and listen to music as the industry now revolves around pleasing algorithms.
Take action now
Generate an access token using the provided steps, and stay tuned for next week's guide on retrieving catalogue data.
Your thoughts
Join the conversation and share your insights on accessing Spotify's Web API with hundreds of artists, creators, and industry professionals.
Further reading
How to install CURL in Windows (Naverisk)
Installing and using curl (Zendesk)
Web API Documentation (Spotify for Developers)
Documentation: Apps (Spotify for Developers)
How Spotify’s algorithms listen to music (The Fanbase Builder)
Learn how the Spotify AI categorises your music in 30 minutes (Artist Lockdown Challenge)