spotify-cli / api/playlists
api/playlists
Spotify Web API wrapper for playlist endpoints.
See
Functions
addTracksToPlaylist()
addTracksToPlaylist(
id,uris,position?,fetch?):Promise<unknown>
Defined in: src/api/playlists.ts:60
Adds tracks to a playlist.
Parameters
id
string
The Spotify playlist ID.
uris
string[]
Array of Spotify track URIs to add.
position?
number
Zero-based position to insert tracks at. Appends if omitted.
fetch?
<T>(path, options) => Promise<T>
Returns
Promise<unknown>
See
POST /playlists/{id}/items
createPlaylist()
createPlaylist(
options,fetch?):Promise<unknown>
Defined in: src/api/playlists.ts:101
Creates a new playlist for the current user.
Parameters
options
Playlist creation options.
description?
string
Optional description.
name
string
Name for the new playlist.
public?
boolean
Whether the playlist should be public (defaults to true).
fetch?
<T>(path, options) => Promise<T>
Returns
Promise<unknown>
See
POST /me/playlists
getCurrentUserPlaylists()
getCurrentUserPlaylists(
options,fetch?):Promise<unknown>
Defined in: src/api/playlists.ts:26
Lists the current user's playlists with pagination.
Parameters
options
Pagination options.
limit?
number
Maximum number of playlists to return.
offset?
number
Index of the first playlist to return.
fetch?
<T>(path, options) => Promise<T>
Returns
Promise<unknown>
See
GET /me/playlists
getPlaylist()
getPlaylist(
id,fetch?):Promise<unknown>
Defined in: src/api/playlists.ts:15
Fetches details for a single playlist.
Parameters
id
string
The Spotify playlist ID.
fetch?
<T>(path, options) => Promise<T>
Returns
Promise<unknown>
See
GET /playlists/{id}
getPlaylistTracks()
getPlaylistTracks(
id,options,fetch?):Promise<unknown>
Defined in: src/api/playlists.ts:43
Lists the tracks in a playlist with pagination.
Parameters
id
string
The Spotify playlist ID.
options
Pagination options.
limit?
number
Maximum number of tracks to return.
offset?
number
Index of the first track to return.
fetch?
<T>(path, options) => Promise<T>
Returns
Promise<unknown>
See
GET /playlists/{id}/items
removeTracksFromPlaylist()
removeTracksFromPlaylist(
id,uris,fetch?):Promise<unknown>
Defined in: src/api/playlists.ts:73
Removes tracks from a playlist.
Parameters
id
string
The Spotify playlist ID.
uris
string[]
Array of Spotify track URIs to remove.
fetch?
<T>(path, options) => Promise<T>
Returns
Promise<unknown>
See
DELETE /playlists/{id}/items
replacePlaylistTracks()
replacePlaylistTracks(
id,uris,fetch?):Promise<unknown>
Defined in: src/api/playlists.ts:86
Replaces all tracks in a playlist with the given URIs in order.
Parameters
id
string
The Spotify playlist ID.
uris
string[]
Ordered array of Spotify track URIs (max 100 per request).
fetch?
<T>(path, options) => Promise<T>
Returns
Promise<unknown>
See
PUT /playlists/{id}/tracks