API calls | Spotify for Developers (2024)

The Spotify Web API is a restful API with different endpoints which return JSONmetadata about music artists, albums, and tracks, directly from the SpotifyData Catalogue.

Base URL

The base address of Web API is https://api.spotify.com.

Authorization

All requests to Spotify Web API require authorization. Make sure you have readthe authorization guide tounderstand the basics.

To access private data through the Web API, such as user profiles andplaylists, an application must get the user’s permission to access the data.

Requests

Data resources are accessed via standard HTTP requests in UTF-8 format to anAPI endpoint. The Web API uses the following HTTP verbs:

MethodAction
GETRetrieves resources
POSTCreates resources
PUTChanges and/or replaces resources or collections
DELETEDeletes resources

Responses

Web API normally returns JSON in the response body. Some endpoints (e.g ChangePlaylist Details)don't return JSON but the HTTP status code

Response Status Codes

Web API uses the following response status codes, as defined in the RFC 2616 and RFC 6585:

Status CodeDescription
200OK - The request has succeeded. The client can read the result of the request in the body and the headers of the response.
201Created - The request has been fulfilled and resulted in a new resource being created.
202Accepted - The request has been accepted for processing, but the processing has not been completed.
204No Content - The request has succeeded but returns no message body.
304Not Modified. See Conditional requests.
400Bad Request - The request could not be understood by the server due to malformed syntax. The message body will contain more information; see Response Schema.
401Unauthorized - The request requires user authentication or, if the request included authorization credentials, authorization has been refused for those credentials.
403Forbidden - The server understood the request, but is refusing to fulfill it.
404Not Found - The requested resource could not be found. This error can be due to a temporary or permanent condition.
429Too Many Requests - Rate limiting has been applied.
500Internal Server Error. You should never receive this error because our clever coders catch them all ... but if you are unlucky enough to get one, please report it to us through a comment at the bottom of this page.
502Bad Gateway - The server was acting as a gateway or proxy and received an invalid response from the upstream server.
503Service Unavailable - The server is currently unable to handle the request due to a temporary condition which will be alleviated after some delay. You can choose to resend the request again.

Response Error

Web API uses two different formats to describe an error:

  • Authentication Error Object
  • Regular Error Object

Authentication Error Object

Whenever the application makes requests related to authentication or authorization to Web API, such as retrieving an access token or refreshing an access token, the error response follows RFC 6749 on the OAuth 2.0 Authorization Framework.

KeyValue TypeValue Description
errorstringA high level description of the error as specified in RFC 6749 Section 5.2.
error_descriptionstringA more detailed description of the error as specified in RFC 6749 Section 4.1.2.1.

Here is an example of a failing request to refresh an access token.


_10

$ curl -H "Authorization: Basic Yjc...cK" -d grant_type=refresh_token -d refresh_token=AQD...f0 "https://accounts.spotify.com/api/token"

_10

_10

{

_10

"error": "invalid_client",

_10

"error_description": "Invalid client secret"

_10

}


Regular Error Object

Apart from the response code, unsuccessful responses return a JSON object containing the following information:

KeyValue TypeValue Description
statusintegerThe HTTP status code that is also returned in the response header. For further information, see Response Status Codes.
messagestringA short description of the cause of the error.

Here, for example is the error that occurs when trying to fetch information for a non-existent track:


_10

$ curl -i "https://api.spotify.com/v1/tracks/2KrxsD86ARO5beq7Q0Drfqa"

_10

_10

HTTP/1.1 400 Bad Request

_10

{

_10

"error": {

_10

"status": 400,

_10

"message": "invalid id"

_10

}

_10

}


Conditional Requests

Most API responses contain appropriate cache-control headers set to assist in client-side caching:

  • If you have cached a response, do not request it again until the response has expired.
  • If the response contains an ETag, set the If-None-Match request header to the ETag value.
  • If the response has not changed, the Spotify service responds quickly with 304 Not Modified status, meaning that your cached version is still good and your application should use it.

Timestamps

Timestamps are returned in ISO 8601format as Coordinated Universal Time(UTC) witha zero offset: YYYY-MM-DDTHH:MM:SSZ. If the time is imprecise (for example,the date/time of an album release), an additional field indicates theprecision; see for example, release_date in an AlbumObject.

Pagination

Some endpoints support a way of paging the dataset, taking an offset and limit as query parameters:


_10

$ curl

_10

https://api.spotify.com/v1/artists/1vCWHaC5f2uS3yhpwWbIA6/albums?album_type=SINGLE&offset=20&limit=10


In this example, in a list of 50 (total) singles by the specified artist :From the twentieth (offset) single, retrieve the next 10 (limit) singles.

API calls | Spotify for Developers (2024)
Top Articles
Como colocar cursos, certificados no currículo (CV): exemplo
Revisión por la alta dirección del SG-SST - SafetYA®
Cpmc Mission Bernal Campus & Orthopedic Institute Photos
Kreme Delite Menu
Methstreams Boxing Stream
Loves Employee Pay Stub
Craigslist Campers Greenville Sc
DEA closing 2 offices in China even as the agency struggles to stem flow of fentanyl chemicals
Sarah F. Tebbens | people.wright.edu
OSRS Fishing Training Guide: Quick Methods To Reach Level 99 - Rune Fanatics
Videos De Mexicanas Calientes
Zitobox 5000 Free Coins 2023
30% OFF Jellycat Promo Code - September 2024 (*NEW*)
[PDF] INFORMATION BROCHURE - Free Download PDF
Phillies Espn Schedule
Insidekp.kp.org Hrconnect
Sand Castle Parents Guide
Stihl Km 131 R Parts Diagram
Love In The Air Ep 9 Eng Sub Dailymotion
Craigslist Missoula Atv
Mahpeople Com Login
Pickswise Review 2024: Is Pickswise a Trusted Tipster?
Myql Loan Login
Silky Jet Water Flosser
Ficoforum
4Oxfun
Churchill Downs Racing Entries
Bra Size Calculator & Conversion Chart: Measure Bust & Convert Sizes
Danielle Ranslow Obituary
Yu-Gi-Oh Card Database
897 W Valley Blvd
Tu Housing Portal
Eegees Gift Card Balance
Top Songs On Octane 2022
FREE Houses! All You Have to Do Is Move Them. - CIRCA Old Houses
Fairwinds Shred Fest 2023
Khatrimmaza
Pnc Bank Routing Number Cincinnati
Chattanooga Booking Report
Barrage Enhancement Lost Ark
Pensacola 311 Citizen Support | City of Pensacola, Florida Official Website
Polk County Released Inmates
American Bully Xxl Black Panther
Levothyroxine Ati Template
Sam's Club Gas Prices Deptford Nj
Ramsey County Recordease
Dcilottery Login
Achieving and Maintaining 10% Body Fat
Craigslist Farm And Garden Reading Pa
Valls family wants to build a hotel near Versailles Restaurant
Hanco*ck County Ms Busted Newspaper
Lesson 5 Homework 4.5 Answer Key
Latest Posts
Article information

Author: Kieth Sipes

Last Updated:

Views: 6322

Rating: 4.7 / 5 (67 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Kieth Sipes

Birthday: 2001-04-14

Address: Suite 492 62479 Champlin Loop, South Catrice, MS 57271

Phone: +9663362133320

Job: District Sales Analyst

Hobby: Digital arts, Dance, Ghost hunting, Worldbuilding, Kayaking, Table tennis, 3D printing

Introduction: My name is Kieth Sipes, I am a zany, rich, courageous, powerful, faithful, jolly, excited person who loves writing and wants to share my knowledge and understanding with you.