PUT https://api.spotify.com/v1/playlists/{playlist_id}/tracks

Request Parameters

Path Parameters

Path Parameter Value
playlist_id The Spotify ID for the playlist.
Header Field Value
Authorization Required. 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 items in the current user’s public playlists requires authorization of the playlist-modify-public scope; setting items in the current user’s private playlist (including collaborative playlists) requires the playlist-modify-private scope. See Using Scopes.
Content-Type Required 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 and episodes 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 items; any additional items will need to be added using the “Add Items to a Playlist” endpoint.

Query Parameters

Query Parameter Value Type Value
uris list of Spotify URIs Optional. A comma-separated list of Spotify URIs to set, can be track or episode URIs. For example: uris=spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:track:1301WleyT98MSxVHPZCA6M,spotify:episode:512ojhOuo1ktJprKbVcKyQ
A maximum of 100 items can be set in one request.

Body Parameters

Request Body Data Value Type Value
uris array of Spotify URI strings Optional. A JSON array of the Spotify URIs to set, can be track or episode URIs. For example: {"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "spotify:track:1301WleyT98MSxVHPZCA6M", "spotify:episode:512ojhOuo1ktJprKbVcKyQ"]}
Currently, a maximum of 100 items 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 an item when you do not have the user’s authorization returns error 403 Forbidden.

Example (replace the playlist’s items with the items 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 "https://api.spotify.com/v1/playlists/0vXtvEeftmc2aVQD9QBWrQ/tracks" -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

NOTE: looking for PUT https://api.spotify.com/v1/users/{user_id}/playlists/{playlist_id}/tracks? Read the blog post.