Overview
TheAsyncPlaylistService provides comprehensive operations for managing Spotify playlists, including retrieving playlist details, managing tracks, and customizing playlist metadata and cover images.
This service is available in both async (
AsyncPlaylistService) and sync (PlaylistService) variants.Get Playlist
Retrieve full details of a Spotify playlist.The Spotify ID of the playlist.
An ISO 3166-1 alpha-2 country code. If specified, only content available in that market will be returned.
Filters for the query: a comma-separated list of fields to return. If omitted, all fields are returned.Examples:
"description,uri"- Get only description and URI"tracks.items(added_at,added_by.id)"- Get added date and user ID"tracks.items(track(name,href,album(name,href)))"- Nested field selection- Prefix with
!to exclude:"tracks.items(track(name,href,album(!name,href)))"
Returns
Complete playlist object including tracks, metadata, and owner information.
Example
Get Playlist Items
Retrieve paginated tracks and episodes from a playlist.The Spotify ID of the playlist.
An ISO 3166-1 alpha-2 country code for market-specific content.
Comma-separated list of fields to return. Supports dot notation and parentheses for nested fields.
Maximum number of items to return. Default: 20. Range: 1-50.
Index of the first item to return. Default: 0.
Returns
Paginated response containing playlist tracks with added_at timestamps and user information.
Example
Get Current User’s Playlists
Retrieve playlists owned or followed by the authenticated user.Maximum number of playlists to return. Default: 20. Range: 1-50.
Index of the first playlist to return. Default: 0. Maximum: 100.
Returns
Paginated list of simplified playlist objects.
Example
Get User’s Playlists
Retrieve playlists owned or followed by a specific user.The user’s Spotify ID.
Maximum number of playlists. Default: 20. Range: 1-50.
Index of first playlist. Default: 0. Maximum: 100.
Returns
Paginated list of playlists for the specified user.
Example
Create Playlist
Create a new playlist for a Spotify user.The Spotify user ID that will own the playlist.
The name for the new playlist.
Whether the playlist should be public. Must be
False if collaborative is True.Whether the playlist should be collaborative. If
True, public must be False.Optional description for the playlist.
Returns
The newly created playlist object.
Example
When creating a collaborative playlist,
public must be set to False.Change Playlist Details
Update playlist metadata including name, description, and privacy settings.The Spotify playlist ID.
New name for the playlist.
New public/private status. Cannot be
True if collaborative is True.New collaborative status. Cannot be
True if public is True.New description for the playlist.
Example
Add Items to Playlist
Add tracks or episodes to a playlist.The Spotify playlist ID.
List of Spotify track or episode URIs to add (e.g.,
["spotify:track:...", "spotify:episode:..."]).Zero-based position where items should be inserted. If omitted, items are appended.
Returns
New playlist snapshot ID for concurrency control.
Example
Remove Items from Playlist
Remove tracks or episodes from a playlist.The Spotify playlist ID.
URIs to remove (all occurrences). Mutually exclusive with
tracks.Explicit track objects with
uri and optional positions list. Mutually exclusive with uris.Format: [{"uri": "spotify:track:...", "positions": [0, 3]}]Playlist snapshot ID for optimistic concurrency control.
Returns
New playlist snapshot ID.
Example
You must provide exactly one of
uris or tracks. Providing both or neither raises a ValueError.Reorder or Replace Playlist Items
Reorder existing items or replace all playlist content.The Spotify playlist ID.
Replace mode: Complete list of URIs to replace all playlist content.
Reorder mode: Starting index of items to move.
Reorder mode: Target index where items should be inserted.
Reorder mode: Number of items to move. Default: 1.
Playlist snapshot ID for concurrency control.
Returns
New playlist snapshot ID.
Example
Get Playlist Cover Image
Retrieve the cover image(s) for a playlist.The Spotify ID of the playlist.
Returns
List of image objects with URL, height, and width information.
Example
Upload Playlist Cover Image
Upload a custom cover image for a playlist.The Spotify playlist ID.
Base64-encoded JPEG image data (maximum 256KB).
Example
The image must be in JPEG format and encoded as base64. Maximum file size is 256KB.