SOLFIND
Web Lens
Portal home

Getting started with Web API | Spotify for Developers

https://developer.spotify.com/documentation/web-api/tutorials/getting-started • 295 KB fetched
Open original page


Getting started with Web API | Spotify for Developers Skip to content

* Documentation Documentation Products
* Web API

* Web Playback SDK

* Ads API

* iOS

* Android

* Embeds

* Commercial Hardware

* Open Access

* Spotify Soloist
Guidelines
* Design

* Accessibility

* Legal

* Community

0

* Documentation Documentation Products
* Web API

* Web Playback SDK

* Ads API

* iOS

* Android

* Embeds

* Commercial Hardware

* Open Access

* Spotify Soloist
Guidelines
* Design

* Accessibility

* Legal

* Community

Web API

* Overview

* Getting started

* Building with AI

* Concepts Concepts Concepts
* Access Token

* API calls

* Apps

* Authorization

* Redirect URIs

* Playlists

* Quota modes

* Rate limits

* Scopes

* Spotify URIs and IDs

* Track Relinking

* Tutorials Tutorials Tutorials
* Authorization code

* Authorization code PKCE

* Client credentials

* Implicit grant [Deprecated]

* Refreshing tokens

* Migration: Implicit grant to Authorization code

* Migration: Insecure redirect URI

* Migration: February 2026 Dev Mode Changes

* How-Tos How-Tos How-Tos
* Display your Spotify profile data in a web app

* Changelog Changelog Changelog
* July 2026

* May 2026

* March 2026

* February 2026

Reference
* Albums Albums Albums
* Get Album

* Get Several Albums

* Get Album Tracks

* Get User's Saved Albums

* Save Albums for Current User

* Remove Users' Saved Albums

* Check User's Saved Albums

* Get New Releases

* Artists Artists Artists
* Get Artist

* Get Several Artists

* Get Artist's Albums

* Get Artist's Top Tracks

* Get Artist's Related Artists

* Audiobooks Audiobooks Audiobooks
* Get an Audiobook

* Get Several Audiobooks

* Get Audiobook Chapters

* Get User's Saved Audiobooks

* Save Audiobooks for Current User

* Remove User's Saved Audiobooks

* Check User's Saved Audiobooks

* Categories Categories Categories
* Get Several Browse Categories

* Get Single Browse Category

* Chapters Chapters Chapters
* Get a Chapter

* Get Several Chapters

* Episodes Episodes Episodes
* Get Episode

* Get Several Episodes

* Get User's Saved Episodes

* Save Episodes for Current User

* Remove User's Saved Episodes

* Check User's Saved Episodes

* Genres Genres Genres
* Get Available Genre Seeds

* Library Library Library
* Save Items to Library

* Remove Items from Library

* Check User's Saved Items

* Markets Markets Markets
* Get Available Markets

* Player Player Player
* Get Playback State

* Transfer Playback

* Get Available Devices

* Get Currently Playing Track

* Start/Resume Playback

* Pause Playback

* Skip To Next

* Skip To Previous

* Seek To Position

* Set Repeat Mode

* Set Playback Volume

* Toggle Playback Shuffle

* Get Recently Played Tracks

* Get the User's Queue

* Add Item to Playback Queue

* Playlists Playlists Playlists
* Get Playlist

* Change Playlist Details

* Get Playlist Items [DEPRECATED]

* Update Playlist Items [DEPRECATED]

* Add Items to Playlist [DEPRECATED]

* Remove Playlist Items [DEPRECATED]

* Get Playlist Items

* Update Playlist Items

* Add Items to Playlist

* Remove Playlist Items

* Get Current User's Playlists

* Create Playlist

* Get User's Playlists

* Create Playlist for user

* Get Featured Playlists

* Get Category's Playlists

* Get Playlist Cover Image

* Add Custom Playlist Cover Image

* Search Search Search
* Search for Item

* Shows Shows Shows
* Get Show

* Get Several Shows

* Get Show Episodes

* Get User's Saved Shows

* Save Shows for Current User

* Remove User's Saved Shows

* Check User's Saved Shows

* Tracks Tracks Tracks
* Get Track

* Get Several Tracks

* Get User's Saved Tracks

* Save Tracks for Current User

* Remove User's Saved Tracks

* Check User's Saved Tracks

* Get Several Tracks' Audio Features

* Get Track's Audio Features

* Get Track's Audio Analysis

* Get Recommendations

* Users Users Users
* Get Current User's Profile

* Get User's Top Items

* Get User's Profile

* Follow Playlist

* Unfollow Playlist

* Get Followed Artists

* Follow Artists or Users

* Unfollow Artists or Users

* Check If User Follows Artists or Users

* Check if Current User Follows Playlist

Web API
* Overview

* Getting started

* Building with AI

* Concepts Concepts Concepts
* Access Token

* API calls

* Apps

* Authorization

* Redirect URIs

* Playlists

* Quota modes

* Rate limits

* Scopes

* Spotify URIs and IDs

* Track Relinking

* Tutorials Tutorials Tutorials
* Authorization code

* Authorization code PKCE

* Client credentials

* Implicit grant [Deprecated]

* Refreshing tokens

* Migration: Implicit grant to Authorization code

* Migration: Insecure redirect URI

* Migration: February 2026 Dev Mode Changes

* How-Tos How-Tos How-Tos
* Display your Spotify profile data in a web app

* Changelog Changelog Changelog
* July 2026

* May 2026

* March 2026

* February 2026

Reference
* Albums Albums Albums
* Get Album

* Get Several Albums

* Get Album Tracks

* Get User's Saved Albums

* Save Albums for Current User

* Remove Users' Saved Albums

* Check User's Saved Albums

* Get New Releases

* Artists Artists Artists
* Get Artist

* Get Several Artists

* Get Artist's Albums

* Get Artist's Top Tracks

* Get Artist's Related Artists

* Audiobooks Audiobooks Audiobooks
* Get an Audiobook

* Get Several Audiobooks

* Get Audiobook Chapters

* Get User's Saved Audiobooks

* Save Audiobooks for Current User

* Remove User's Saved Audiobooks

* Check User's Saved Audiobooks

* Categories Categories Categories
* Get Several Browse Categories

* Get Single Browse Category

* Chapters Chapters Chapters
* Get a Chapter

* Get Several Chapters

* Episodes Episodes Episodes
* Get Episode

* Get Several Episodes

* Get User's Saved Episodes

* Save Episodes for Current User

* Remove User's Saved Episodes

* Check User's Saved Episodes

* Genres Genres Genres
* Get Available Genre Seeds

* Library Library Library
* Save Items to Library

* Remove Items from Library

* Check User's Saved Items

* Markets Markets Markets
* Get Available Markets

* Player Player Player
* Get Playback State

* Transfer Playback

* Get Available Devices

* Get Currently Playing Track

* Start/Resume Playback

* Pause Playback

* Skip To Next

* Skip To Previous

* Seek To Position

* Set Repeat Mode

* Set Playback Volume

* Toggle Playback Shuffle

* Get Recently Played Tracks

* Get the User's Queue

* Add Item to Playback Queue

* Playlists Playlists Playlists
* Get Playlist

* Change Playlist Details

* Get Playlist Items [DEPRECATED]

* Update Playlist Items [DEPRECATED]

* Add Items to Playlist [DEPRECATED]

* Remove Playlist Items [DEPRECATED]

* Get Playlist Items

* Update Playlist Items

* Add Items to Playlist

* Remove Playlist Items

* Get Current User's Playlists

* Create Playlist

* Get User's Playlists

* Create Playlist for user

* Get Featured Playlists

* Get Category's Playlists

* Get Playlist Cover Image

* Add Custom Playlist Cover Image

* Search Search Search
* Search for Item

* Shows Shows Shows
* Get Show

* Get Several Shows

* Get Show Episodes

* Get User's Saved Shows

* Save Shows for Current User

* Remove User's Saved Shows

* Check User's Saved Shows

* Tracks Tracks Tracks
* Get Track

* Get Several Tracks

* Get User's Saved Tracks

* Save Tracks for Current User

* Remove User's Saved Tracks

* Check User's Saved Tracks

* Get Several Tracks' Audio Features

* Get Track's Audio Features

* Get Track's Audio Analysis

* Get Recommendations

* Users Users Users
* Get Current User's Profile

* Get User's Top Items

* Get User's Profile

* Follow Playlist

* Unfollow Playlist

* Get Followed Artists

* Follow Artists or Users

* Unfollow Artists or Users

* Check If User Follows Artists or Users

* Check if Current User Follows Playlist

Getting started with Web API

This tutorial will help you to make your first Web API call by
retriving an artist's metadata. The steps to do so are the following:

* Create an app , if you haven't done so.

* Request an access token .

* Use the access token to request the artist data .

Here we go, let's rock & roll!

Prerequisites

* This tutorial assumes you have a Spotify Premium account.

* We will use cURL to make API calls. You can install it from
here our using the package manager of your
choice.

Set Up Your Account

Login to the Spotify Developer Dashboard . If necessary, read the
latest Developer Terms of Service to complete your account set up.

Create an app

An app provides the Client ID and Client Secret needed to request an
access token by implementing any of the
authorization flows.

To create an app, go to your Dashboard , click on the Create an
app button and enter the following information:

* App Name: My App

* App Description: This is my first Spotify app

* Redirect URI: You won't need this parameter in this example, so let's use http://127.0.0.1:3000 .

Finally, check the Developer Terms of Service checkbox and tap on the
Create button.

Request an access token

The access token is a string which contains the credentials and permissions
that can be used to access a given resource (e.g artists, albums or tracks) or
user's data (e.g your profile or your playlists).

In order to request the access token you need to get your Client_ID and
Client Secret :

* Go to the Dashboard

* Click on the name of the app you have just created ( My App )

* Click on the Settings button

The Client ID can be found here. The Client Secret can be found behind the View client secret link.

With our credentials in hand, we are ready to request an access token. This
tutorial uses the Client
Credentials , so we
must:

* Send a POST request to the token endpoint URI.

* Add the Content-Type header set to the application/x-www-form-urlencoded value.

* Add a HTTP body containing the Client ID and Client Secret , along with the grant_type parameter set to client_credentials .

_ 10 curl -X POST "https://accounts.spotify.com/api/token" \

_ 10 -H "Content-Type: application/x-www-form-urlencoded" \

_ 10 -d "grant_type=client_credentials&client_id=your-client-id&client_secret=your-client-secret"

The response will return an access token valid for 1 hour :

_ 10 {

_ 10 "access_token": "BQDBKJ5eo5jxbtpWjVOj7ryS84khybFpP_lTqzV7uV-T_m0cTfwvdn5BnBSKPxKgEb11",

_ 10 "token_type": "Bearer",

_ 10 "expires_in": 3600

_ 10 }

Request artist data

For this example, we will use the Get Artist endpoint to request
information about an artist. According to the API Reference, the endpoint
needs the Spotify ID of the artist.

An easy way to get the Spotify ID of an artist is using the Spotify Desktop App:

* Search the artist

* Click on the three dots icon from the artist profile

* Select Share > Copy link to artist . The Spotify ID is the value that comes right after the open.spotify.com/artist URI.

Our API call must include the access token we have just generated using the
Authorization header as follows:

_ 10 curl "https://api.spotify.com/v1/artists/4Z8W4fKeB5YxbusRsdQVPb" \

_ 10 -H "Authorization: Bearer BQDBKJ5eo5jxbtpWjVOj7ryS84khybFpP_lTqzV7uV-T_m0cTfwvdn5BnBSKPxKgEb11"

If everything goes well, the API will return the following JSON response:

_ 40 {

_ 40 "external_urls": {

_ 40 "spotify": "https://open.spotify.com/artist/4Z8W4fKeB5YxbusRsdQVPb"

_ 40 },

_ 40 "followers": {

_ 40 "href": null,

_ 40 "total": 7625607

_ 40 },

_ 40 "genres": [

_ 40 "alternative rock",

_ 40 "art rock",

_ 40 "melancholia",

_ 40 "oxford indie",

_ 40 "permanent wave",

_ 40 "rock"

_ 40 ],

_ 40 "href": "https://api.spotify.com/v1/artists/4Z8W4fKeB5YxbusRsdQVPb",

_ 40 "id": "4Z8W4fKeB5YxbusRsdQVPb",

_ 40 "images": [

_ 40 {

_ 40 "height": 640,

_ 40 "url": "https://i.scdn.co/image/ab6761610000e5eba03696716c9ee605006047fd",

_ 40 "width": 640

_ 40 },

_ 40 {

_ 40 "height": 320,

_ 40 "url": "https://i.scdn.co/image/ab67616100005174a03696716c9ee605006047fd",

_ 40 "width": 320

_ 40 },

_ 40 {

_ 40 "height": 160,

_ 40 "url": "https://i.scdn.co/image/ab6761610000f178a03696716c9ee605006047fd",

_ 40 "width": 160

_ 40 }

_ 40 ],

_ 40 "name": "Radiohead",

_ 40 "popularity": 79,

_ 40 "type": "artist",

_ 40 "uri": "spotify:artist:4Z8W4fKeB5YxbusRsdQVPb"

_ 40 }

Congratulations! You made your first API call to the Spotify Web API.

Summary

*
The Spotify Web API provides different endpoints depending on the data we want
to access. The API calls must include the Authorization header along with a
valid access token.

*
This tutorial makes use of the client credentials grant
type to retrieve the access token. That works fine in scenarios where you
control the API call to Spotify, for example where your backend is connecting
to the Web API. It will not work in cases where your app will connect on
behalf of a specific user, for example when getting private playlist or profile
data.

What's next?

*
The tutorial used the Spotify Desktop App to retrieve the Spotify ID of the
artist. The ID can also be retrieved using the Search
endpoint . An interesting exercise
would be to extend the example with a new API call to the /search endpoint.
Do you accept the challenge?

*
The authorization guide
provides detailed information about which authorization flow suits you best.
Make sure you read it first!

*
You can continue your journey by reading the API
calls guide which describes in
detail the Web API request and responses.

*
Finally, if you are looking for a more practical documentation, you can follow the
Display your Spotify Profile Data in a Web App how-to which implements a
step-by-step web application using authorization code flow to request the access
token .

Footer
Documentation

* Web API

* Web Playback SDK

* Ads API

* iOS

* Android

* Embeds

* Commercial Hardware

Guidelines

* Design

* Accessibility

Community

* News

* Forum

Legal

* Developer Terms

* Developer Policy

* Compliance Tips

* Third Party Licenses

Legal Cookies © 2026 Spotify AB

Links found on this page

  1. Skip to content [direct]
  2. Web API [direct]
  3. Web Playback SDK [direct]
  4. Ads API [direct]
  5. iOS [direct]
  6. Android [direct]
  7. Embeds [direct]
  8. Commercial Hardware [direct]
  9. Open Access [direct]
  10. Spotify Soloist [direct]
  11. Design [direct]
  12. Accessibility [direct]
  13. Legal [direct]
  14. Community [direct]
  15. Building with AI [direct]
  16. Access Token [direct]
  17. API calls [direct]
  18. Apps [direct]
  19. Authorization [direct]
  20. Redirect URIs [direct]
  21. Playlists [direct]
  22. Quota modes [direct]
  23. Rate limits [direct]
  24. Scopes [direct]
  25. Spotify URIs and IDs [direct]
  26. Track Relinking [direct]
  27. Authorization code [direct]
  28. Authorization code PKCE [direct]
  29. Client credentials [direct]
  30. Implicit grant [Deprecated] [direct]
  31. Refreshing tokens [direct]
  32. Migration: Implicit grant to Authorization code [direct]
  33. Migration: Insecure redirect URI [direct]
  34. Migration: February 2026 Dev Mode Changes [direct]
  35. Display your Spotify profile data in a web app [direct]
  36. July 2026 [direct]
  37. May 2026 [direct]
  38. March 2026 [direct]
  39. February 2026 [direct]
  40. Get Album [direct]
  41. Get Several Albums [direct]
  42. Get Album Tracks [direct]
  43. Get User's Saved Albums [direct]
  44. Save Albums for Current User [direct]
  45. Remove Users' Saved Albums [direct]
  46. Check User's Saved Albums [direct]
  47. Get New Releases [direct]
  48. Get Artist [direct]
  49. Get Several Artists [direct]
  50. Get Artist's Albums [direct]
  51. Get Artist's Top Tracks [direct]
  52. Get Artist's Related Artists [direct]
  53. Get an Audiobook [direct]
  54. Get Several Audiobooks [direct]
  55. Get Audiobook Chapters [direct]
  56. Get User's Saved Audiobooks [direct]
  57. Save Audiobooks for Current User [direct]
  58. Remove User's Saved Audiobooks [direct]
  59. Check User's Saved Audiobooks [direct]
  60. Get Several Browse Categories [direct]
  61. Get Single Browse Category [direct]
  62. Get a Chapter [direct]
  63. Get Several Chapters [direct]
  64. Get Episode [direct]
  65. Get Several Episodes [direct]
  66. Get User's Saved Episodes [direct]
  67. Save Episodes for Current User [direct]
  68. Remove User's Saved Episodes [direct]
  69. Check User's Saved Episodes [direct]
  70. Get Available Genre Seeds [direct]
  71. Save Items to Library [direct]
  72. Remove Items from Library [direct]
  73. Check User's Saved Items [direct]
  74. Get Available Markets [direct]
  75. Get Playback State [direct]
  76. Transfer Playback [direct]
  77. Get Available Devices [direct]
  78. Get Currently Playing Track [direct]
  79. Start/Resume Playback [direct]
  80. Pause Playback [direct]