Endpoint

PUT https://api.spotify.com/v1/me/albums?ids={ids}

Request Parameters

Note that the Spotify IDs of the albums to be saved can be passed either as a JSON array in the request body or as a list in the query string. An album can only be saved once; duplicate IDs are ignored.

Header Fields

Header Field Value
Authorization Required. A valid access token from the Spotify Accounts service: see the Web API Authorization Guide for details.
Modification of the current user’s “Your Music” collection requires authorization of the user-library-modify scope.
Content-Type Required if the IDs are passed in the request body, otherwise ignored. The content type of the request body: application/json

Query Parameters

Query Parameter Value
ids Optional. A comma-separated list of the Spotify IDs. For example: ids=4iV5W9uYEdYUVa79Axb7Rh,1301WleyT98MSxVHPZCA6M. Maximum: 50 IDs.

Body Parameters

Request Body Data Value Type Value
  array of Spotify ID strings Optional. A JSON array of the Spotify IDs. For example: ["4iV5W9uYEdYUVa79Axb7Rh", "1301WleyT98MSxVHPZCA6M"]
A maximum of 50 items can be specified in one request. Note: if the ids parameter is present in the query string, any IDs listed here in the body will be ignored.

Response Format

On success, the HTTP status code in the response header is 201 Created. On error, the header status code is an error code and the response body contains an error object. Trying to add an album when you do not have the user’s authorization returns error 403 Forbidden.

Example Request (save the request body’s albums to “Your Music”)

curl -X PUT "https://api.spotify.com/v1/me/albums" -H "Authorization: Bearer {your access token}" -H "Content-Type: application/json" --data "[\"6akEvsycLGftJxYudPjmqK\", \"628oezqK2qfmCjC6eXNors\"]"

Note that cURL requires quotation marks within the JSON data to be escaped, for example. \"628oezqK2qfmCjC6eXNors\".

Example Response

HTTP 201 Created

Try it