Replace all the tracks in a playlist, overwriting its existing tracks. This powerful request can be useful for replacing tracks, re-ordering existing tracks, or clearing the playlist.



Request Parameters

Path parameter
The user's Spotify user ID.
The Spotify ID for the playlist.
Header field
AuthorizationRequired. A valid access token from the Spotify Accounts service: see the Web API Authorization Guide for details. The access token must have been issued on behalf of the user.

Setting tracks in the current user's public playlists requires authorization of the playlist-modify-public scope; setting tracks in the current user's private playlist (including collaborative playlists) requires the playlist-modify-private scope. See Using Scopes.
Content-TypeRequired if URIs are passed in the request body, otherwise ignored. The content type of the request body: application/json
The Spotify URIs of the tracks to set can be passed either as a JSON array in the request body or as a list in the query string. The request can only accept a maximum of 100 tracks; any additional tracks will need to be added using the “Add Tracks to a Playlist” endpoint.
Query parameterValue typeValue
urislist of Spotify URIsOptional. A comma-separated list of Spotify track URIs to set. For example:

A maximum of 100 tracks can be set in one request.
Request body dataValue typeValue
urisarray of Spotify URI stringsOptional. A JSON array of the Spotify track URIs to set. For example: {"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "spotify:track:1301WleyT98MSxVHPZCA6M"]}

Currently, a maximum of 100 tracks can be set. Note: if the uris parameter is present in the query string, any URIs 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, the response body contains an error object, and the existing playlist is unmodified. Trying to set a track when you do not have the user’s authorization returns error 403 Forbidden.

Example (replace the playlist’s tracks with the tracks in the request body)

Note that cURL requires quotation marks within the JSON data to be escaped, for example. \"spotify:track:4iV5W9uYEdYUVa79Axb7Rh\".
curl -i -X PUT "" -H "Authorization: Bearer {your access token}" -H "Content-Type:application/json" --data "{ \"uris\" : [\"spotify:track:4iV5W9uYEdYUVa79Axb7Rh\", \"spotify:track:1301WleyT98MSxVHPZCA6M\" ] }"
HTTP/1.1 201 Created

Try it