Remove one or more tracks from a user’s playlist.
Endpoint
DELETE https://api.spotify.com/v1/users/{user_id}/playlists/{playlist_id}/tracks
Request Parameters
| Path parameter | Value |
|---|---|
| user_id | The user's Spotify user ID. |
| 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. Removing tracks from a user's public playlist requires authorization of the playlist-modify-public scope; removing tracks from a private playlist requires the playlist-modify-private scope. See Using Scopes. |
| Content-Type | Required. The content type of the request body: application/json |
There are several ways to specify which tracks to remove, determined by the request parameters.
Removing all occurrences of specific tracks
You can remove all occurrences of a track (or multiple tracks) by specifying only the track URI(s):
| Request data | Value type | Value |
|---|---|---|
| tracks | array of objects containing Spotify URI strings | Required. An array of objects containing Spotify URIs of the tracks to remove. For example: { "tracks": [{ "uri": "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" },{ . A maximum of 100 objects can be sent at once. |
Removing a specific occurrence of a track
You can remove a track from a certain position by specifying both the track URI and the track position in the playlist. If you specify incorrect information (for example, if the given track does not exist at the given position) an error will be returned and the entire request will fail. If you specify multiple deletions and one is malformed, the entire request will be failed and no edits will take place.
| Request data | Value type | Value |
|---|---|---|
| tracks | array of objects containing Spotify URI strings and their position in the playlist | Required. An array of objects containing Spotify URIs of the tracks to remove with their current positions in the playlist. For example: { "tracks": [{ "uri": "spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "positions": [0,3] },{The positions parameter is zero-indexed, that is the first track in the playlist has the value 0, the second track 1, and so on.A maximum of 100 objects can be sent at once. |
Removing a specific occurrence of a track in a specific playlist snapshot
To guard against errors when concurrent edits happen to the same playlist, we recommend specifying a snapshot_id parameter. The snapshot_id lets us know which version of the playlist you are trying to edit. Concurrent edits by another user will be automatically resolved. If a given track in a given position is not found in the specified snapshot, the entire request will fail an no edits will take place.
snapshot_id available.| Request data | Value type | Value |
|---|---|---|
| tracks | array of objects containing Spotify URI strings and their position in the playlist | Required. An array of objects containing Spotify URIs of the tracks to remove with their current positions in the playlist. For example: { "tracks":[{"uri": "spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "positions": [2] },{The positions parameter is zero-indexed, that is the first track in the playlist has the value 0, the second track 1, and so on.A maximum of 100 objects can be sent at once. |
| snapshot_id | string | Optional. The playlist's snapshot ID against which you want to make the changes. The API will validate that the specified tracks exist and in the specified positions and make the changes, even if more recent changes have been made to the playlist. |
Removing the track at a given position in a specific playlist snapshot
Instead of specifying the tracks’ URIs, this endpoint also accepts which positions to remove. To guard against errors during concurrent editing, this requires you to specify snapshot_id parameter.
| Request data | Value type | Value |
|---|---|---|
| positions | array of integers containing the positions of the tracks to remove from the playlist | Required. The positions parameter is zero-indexed, that is the first track in the playlist has the value 0, the second track 1, and so on.Example: "positions" : [0,1,3,99]A maximum of 100 positions can be sent at once. |
| snapshot_id | string | Required. The playlist's snapshot ID against which you want to make the changes. |
Response Format
On success, the response body contains a snapshot_id in JSON format and the HTTP status code in the response header is 200 OK. The snapshot_id can be used to identify your playlist version in future requests.
On error, the header status code is an error code and the response body contains an error object. Trying to remove a track when you do not have the user’s authorization returns error 403 Forbidden. Attempting to use several different ways to remove tracks returns 400 Bad Request. Other client errors returning 400 Bad Request include specifying invalid positions.
Example
\"spotify:track:1301WleyT98MSxVHPZCA6M\".curl -X DELETE -i -H "Authorization: Bearer {your access token}" -H "Content-Type: application/json" "https://api.spotify.com/v1/users/wizzler/playlists/71m0QB5fUFrnqfnxVerUup/tracks" --data "{\"tracks\":[{\"uri\": \"spotify:track:4iV5W9uYEdYUVa79Axb7Rh\", \"positions\": [2] },{\"uri\":\"spotify:track:1301WleyT98MSxVHPZCA6M\", \"positions\": [7] }] }"
HTTP/1.1 200 OK
{ "snapshot_id" : "JbtmHBDBAYu3/bt8BOXKjzKx3i0b6LCa/wVjyl6qQ2Yf6nFXkbmzuEa+ZI/U1yF+" }
Frequenty Asked Questions
- Is it possible to delete a playlist?
No, it isn’t. The reason there is no endpoint for this is explained in our Playlist Guide in the section Following and Unfollowing a Playlist. - Can I use
X-HTTP-Method-Overrideor similar to send a DELETE request overriding the HTTP verb?
Not at the moment, the delete operation needs to be specified through a DELETE request.