[GH-ISSUE #1098] spotify web api is ignoring the position param in delete /playlists/{playlist_id}/tracks #653

Closed
opened 2026-02-28 00:00:34 +03:00 by kerem · 8 comments
Owner

Originally created by @lfg6000 on GitHub (May 5, 2024).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1098

summary

playlist_remove_specific_occurrences_of_items(playlist_id, items, snapshot_id=None) uses delete /playlists/{playlist_id}/tracks web api which is currently ignoring the position param in items[{"uri": xxx, "position": xxx}]

https://community.spotify.com/t5/Spotify-for-Developers/Positions-field-in-JSON-body-is-ignored-when-removing-tracks/td-p/6044424

this is the post i put up on the spotify dev forum

removing the position parameter from the web api delete /playlists/{playlist_id}/tracks is a major issue for www.spotifyfinder.com users want to be able to delete a specific duplicate based on position. now that position is being ignored multiple instances of the same track are being removed. this breaks www.spotifyfinder.com i am really hoping that the position parameter is supported once again.

sometimes

sometimes spotify breaks an api and if you wait a couple of weeks spotify will fix the issue. i am hopeful. if the issue gets fixed i will update this issue

Originally created by @lfg6000 on GitHub (May 5, 2024). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1098 summary ---------- playlist_remove_specific_occurrences_of_items(playlist_id, items, snapshot_id=None) uses delete /playlists/{playlist_id}/tracks web api which is currently ignoring the position param in items[{"uri": xxx, "position": xxx}] here is a link to the spotify dev forum discussing the issue: ----------------------------------------------------------- https://community.spotify.com/t5/Spotify-for-Developers/Positions-field-in-JSON-body-is-ignored-when-removing-tracks/td-p/6044424 this is the post i put up on the spotify dev forum -------------------------------------------------- removing the position parameter from the web api delete /playlists/{playlist_id}/tracks is a major issue for www.spotifyfinder.com users want to be able to delete a specific duplicate based on position. now that position is being ignored multiple instances of the same track are being removed. this breaks www.spotifyfinder.com i am really hoping that the position parameter is supported once again. sometimes ------------ sometimes spotify breaks an api and if you wait a couple of weeks spotify will fix the issue. i am hopeful. if the issue gets fixed i will update this issue
kerem 2026-02-28 00:00:34 +03:00
  • closed this issue
  • added the
    api-bug
    label
Author
Owner

@dieser-niko commented on GitHub (May 12, 2024):

Hi, according to this comment, reordering works again (using the same endpoint), so maybe deleting specific occurrences works too. I'll try that when I get around to it.
https://github.com/spotipy-dev/spotipy/issues/1099#issuecomment-2106251082

<!-- gh-comment-id:2106255208 --> @dieser-niko commented on GitHub (May 12, 2024): Hi, according to this comment, reordering works again (using the same endpoint), so maybe deleting specific occurrences works too. I'll try that when I get around to it. https://github.com/spotipy-dev/spotipy/issues/1099#issuecomment-2106251082
Author
Owner

@lfg6000 commented on GitHub (May 12, 2024):

just tried it. it appears spotify is still ignoring the position param sent by playlist_remove_specific_occurrences_of_items()

<!-- gh-comment-id:2106259206 --> @lfg6000 commented on GitHub (May 12, 2024): just tried it. it appears spotify is still ignoring the position param sent by playlist_remove_specific_occurrences_of_items()
Author
Owner

@lfg6000 commented on GitHub (May 13, 2024):

Here is an effort to clearly summarize the impact of this api-bug

Prior to this Spotify Change
If you have Multiple Copies of the Same Track in a playlist and you selected ONE of them to be removed, just the selected track would be removed.

After this Spotify Change
If you have Multiple Copies of the Same Track in a playlist and you selected ONE of them to be removed, now ALL copies of the selected track will be removed from the playlist.

Example
If you have two copies of the same track in a playlist you can no longer remove just one of them, both copies of the track will be removed. It is no longer possible to remove duplicates from a playlist using the web api. All you can do is remove all copies of a track from a playlist.

Spotify Web API Documentation
I sure hope the Spotify Remove Playlist Items doc page gets updated to make this clear.

Spotipy Code and Documentation
Once it becomes clear spotify is not going to fix this issue, it seems like the spotipy playlist_remove_specific_occurrences_of_items() api docs and code will need to be updated so that the items param to longer requires a position for each track id.

<!-- gh-comment-id:2107990709 --> @lfg6000 commented on GitHub (May 13, 2024): Here is an effort to clearly summarize the impact of this api-bug Prior to this Spotify Change If you have Multiple Copies of the Same Track in a playlist and you selected ONE of them to be removed, just the selected track would be removed. After this Spotify Change If you have Multiple Copies of the Same Track in a playlist and you selected ONE of them to be removed, now ALL copies of the selected track will be removed from the playlist. Example If you have two copies of the same track in a playlist you can no longer remove just one of them, both copies of the track will be removed. It is no longer possible to remove duplicates from a playlist using the web api. All you can do is remove all copies of a track from a playlist. Spotify Web API Documentation I sure hope the Spotify Remove Playlist Items doc page gets updated to make this clear. Spotipy Code and Documentation Once it becomes clear spotify is not going to fix this issue, it seems like the spotipy playlist_remove_specific_occurrences_of_items() api docs and code will need to be updated so that the items param to longer requires a position for each track id.
Author
Owner

@dieser-niko commented on GitHub (May 17, 2024):

I think they are trying to make sure that the documentation matches the API. They recently removed an argument that isn't in the documentation for quite a while. Maybe it's the same in this case here. #1107

<!-- gh-comment-id:2117422068 --> @dieser-niko commented on GitHub (May 17, 2024): I think they are trying to make sure that the documentation matches the API. They recently removed an argument that isn't in the documentation for quite a while. Maybe it's the same in this case here. #1107
Author
Owner

@dieser-niko commented on GitHub (Jun 19, 2024):

One of the comments in your community post seems to mention UIDs that would identify different items in a playlist. Let's hope this is implemented in the API. Would be a good replacement.

I've also contacted Spotify support directly, maybe a moderator will take a look and give us an answer.

<!-- gh-comment-id:2178471743 --> @dieser-niko commented on GitHub (Jun 19, 2024): One of the comments in your community post seems to mention UIDs that would identify different items in a playlist. Let's hope this is implemented in the API. Would be a good replacement. I've also contacted Spotify support directly, maybe a moderator will take a look and give us an answer.
Author
Owner

@lfg6000 commented on GitHub (Jun 19, 2024):

thanks for contacting the moderator. maybe the moderator will contact a spotify employee....

<!-- gh-comment-id:2178499558 --> @lfg6000 commented on GitHub (Jun 19, 2024): thanks for contacting the moderator. maybe the moderator will contact a spotify employee....
Author
Owner

@mawkler commented on GitHub (Apr 16, 2025):

This issue seems to still not have been fixed. Did the documentation use to mention a position parameter? Now the word "position" only appears in the snapshot_id description:

The playlist's snapshot ID against which you want to make the changes. The API will validate that the specified items exist and in the specified positions and make the changes, even if more recent changes have been made to the playlist.

<!-- gh-comment-id:2808785925 --> @mawkler commented on GitHub (Apr 16, 2025): This issue seems to still not have been fixed. Did the documentation use to mention a `position` parameter? Now the word "position" only appears [in the `snapshot_id` description](https://developer.spotify.com/documentation/web-api/reference/remove-tracks-playlist): > The playlist's snapshot ID against which you want to make the changes. The API will validate that the specified items exist and in the specified **positions** and make the changes, even if more recent changes have been made to the playlist.
Author
Owner

@stephanebruckert commented on GitHub (May 22, 2025):

Closing as this is an issue on the Spotify side:

  • the positions sub-field is now ignored,
  • the optional snapshot_id field, when specified, gives a 502, which would have beem the best solution if your app kept track of snapshot_ids when adding items.

Keeping the spotipy code as-is to reflect the API docs.

If removing possible duplicates, please use this method (removing duplicates, adding them back once).

<!-- gh-comment-id:2902272813 --> @stephanebruckert commented on GitHub (May 22, 2025): Closing as this is an issue on the Spotify side: - the `positions` sub-field is now ignored, - the optional [`snapshot_id`](https://developer.spotify.com/documentation/web-api/reference/remove-tracks-playlist) field, when specified, [gives a 502](https://community.spotify.com/t5/Spotify-for-Developers/Getting-502-response-on-DELETE-for-playlist-lt-playlistid-tracks/td-p/6736837), which would have beem the best solution if your app kept track of `snapshot_ids` when adding items. Keeping the spotipy code as-is to reflect the API docs. If removing possible duplicates, please use [this method](https://community.spotify.com/t5/Spotify-for-Developers/Positions-field-in-JSON-body-is-ignored-when-removing-tracks/m-p/6055483/highlight/true#M13828) (removing duplicates, adding them back once).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#653
No description provided.