- __construct
- addMyAlbums
- addMyEpisodes
- addMyShows
- addMyTracks
- addPlaylistTracks
- changeMyDevice
- changeVolume
- createPlaylist
- currentUserFollows
- deleteMyAlbums
- deleteMyEpisodes
- deleteMyShows
- deleteMyTracks
- deletePlaylistTracks
- followArtistsOrUsers
- followPlaylist
- getAlbum
- getAlbums
- getAlbumTracks
- getArtist
- getArtists
- getArtistRelatedArtists
- getArtistAlbums
- getArtistTopTracks
- getAudioAnalysis
- getAudiobook
- getAudiobooks
- getAudioFeatures
- getCategoriesList
- getCategory
- getCategoryPlaylists
- getChapter
- getChapters
- getEpisode
- getEpisodes
- getFeaturedPlaylists
- getGenreSeeds
- getLastResponse
- getMarkets
- getMultipleAudioFeatures
- getMyCurrentTrack
- getMyDevices
- getMyCurrentPlaybackInfo
- getMyPlaylists
- getMyQueue
- getMyRecentTracks
- getMySavedAlbums
- getMySavedEpisodes
- getMySavedTracks
- getMySavedShows
- getMyTop
- getNewReleases
- getPlaylist
- getPlaylistImage
- getPlaylistTracks
- getRecommendations
- getRequest
- getShow
- getShowEpisodes
- getShows
- getTrack
- getTracks
- getUser
- getUserFollowedArtists
- getUserPlaylists
- me
- myAlbumsContains
- myEpisodesContains
- myShowsContains
- myTracksContains
- next
- pause
- play
- previous
- queue
- reorderPlaylistTracks
- repeat
- replacePlaylistTracks
- search
- seek
- setAccessToken
- setOptions
- setSession
- shuffle
- unfollowArtistsOrUsers
- unfollowPlaylist
- updatePlaylist
- updatePlaylistImage
- usersFollowPlaylist
SpotifyWebAPI::__construct($options, $session, $request)
Constructor
Set options and class instances to use.
$options
array|object - Optional. Options to set.$session
\SpotifyWebAPI\Session - Optional. The Session object to use.$request
\SpotifyWebAPI\Request - Optional. The Request object to use.
SpotifyWebAPI::addMyAlbums($albums)
Add albums to the current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/#/operations/save-albums-user
$albums
string|array - Album IDs or URIs to add.
- bool Whether the albums was successfully added.
SpotifyWebAPI::addMyEpisodes($episodes)
Add episodes to the current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/#/operations/save-episodes-user
$episodes
string|array - Episode IDs or URIs to add.
- bool Whether the episodes was successfully added.
SpotifyWebAPI::addMyShows($shows)
Add shows to the current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/#/operations/save-shows-user
$shows
string|array - Show IDs or URIs to add.
- bool Whether the shows was successfully added.
SpotifyWebAPI::addMyTracks($tracks)
Add tracks to the current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/#/operations/save-tracks-user
$tracks
string|array - Track IDs or URIs to add.
- bool Whether the tracks was successfully added.
SpotifyWebAPI::addPlaylistTracks($playlistId, $tracks, $options)
Add tracks to a playlist.
https://developer.spotify.com/documentation/web-api/reference/#/operations/add-tracks-to-playlist
$playlistId
string - ID of the playlist to add tracks to.$tracks
string|array - Track IDs, track URIs, and episode URIs to add.$options
array|object - Optional. Options for the new tracks.- int position Optional. Zero-based track position in playlist. Tracks will be appended if omitted or false.
- string|bool A new snapshot ID or false if the tracks weren't successfully added.
SpotifyWebAPI::changeMyDevice($options)
Change the current user's playback device.
https://developer.spotify.com/documentation/web-api/reference/#/operations/transfer-a-users-playback
$options
array|object - Options for the playback transfer.- string|array device_ids Required. ID of the device to switch to.
- bool play Optional. Whether to start playing on the new device
- bool Whether the playback device was successfully changed.
SpotifyWebAPI::changeVolume($options)
Change playback volume for the current user.
https://developer.spotify.com/documentation/web-api/reference/#/operations/set-volume-for-users-playback
$options
array|object - Optional. Options for the playback volume.- int volume_percent Required. The volume to set.
- string device_id Optional. ID of the device to target.
- bool Whether the playback volume was successfully changed.
SpotifyWebAPI::createPlaylist($userId, $options)
Create a new playlist.
https://developer.spotify.com/documentation/web-api/reference/#/operations/create-playlist
$userId
string - ID or URI of the user to create the playlist for.$options
array|object - Options for the new playlist.- string name Required. Name of the playlist.
- bool collaborative Optional. Whether the playlist should be collaborative or not.
- string description Optional. Description of the playlist.
- bool public Optional. Whether the playlist should be public or not.
- array|object The new playlist. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::currentUserFollows($type, $ids)
Check to see if the current user is following one or more artists or other Spotify users.
https://developer.spotify.com/documentation/web-api/reference/#/operations/check-current-user-follows
$type
string - The type to check: either 'artist' or 'user'.$ids
string|array - IDs or URIs of the users or artists to check for.
- array Whether each user or artist is followed.
SpotifyWebAPI::deleteMyAlbums($albums)
Delete albums from the current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/#/operations/remove-albums-user
$albums
string|array - Album IDs or URIs to delete.
- bool Whether the albums was successfully deleted.
SpotifyWebAPI::deleteMyEpisodes($episodes)
Delete episodes from the current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/#/operations/remove-episodes-user
$episodes
string|array - Episode IDs or URIs to delete.
- bool Whether the episodes was successfully deleted.
SpotifyWebAPI::deleteMyShows($shows)
Delete shows from the current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/#/operations/remove-shows-user
$shows
string|array - Show IDs or URIs to delete.
- bool Whether the shows was successfully deleted.
SpotifyWebAPI::deleteMyTracks($tracks)
Delete tracks from the current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/#/operations/remove-tracks-user
$tracks
string|array - Track IDs or URIs to delete.
- bool Whether the tracks was successfully deleted.
SpotifyWebAPI::deletePlaylistTracks($playlistId, $tracks, $snapshotId)
Delete tracks from a playlist and retrieve a new snapshot ID.
https://developer.spotify.com/documentation/web-api/reference/#/operations/remove-tracks-playlist
$playlistId
string - ID or URI of the playlist to delete tracks from.$tracks
array - An array with the key "tracks" containing arrays or objects with tracks to delete. Or an array with the key "positions" containing integer positions of the tracks to delete. If the "tracks" key is used, the following fields are also available:- string uri Required. Track ID, track URI, or episode URI.
- int|array positions Optional. The track's positions in the playlist.
$snapshotId
string - Required when$tracks['positions']
is used, optional otherwise. The playlist's snapshot ID.
- string|bool A new snapshot ID or false if the tracks weren't successfully deleted.
SpotifyWebAPI::followArtistsOrUsers($type, $ids)
Add the current user as a follower of one or more artists or other Spotify users.
https://developer.spotify.com/documentation/web-api/reference/#/operations/follow-artists-users
$type
string - The type of ID to follow: either 'artist' or 'user'.$ids
string|array - IDs or URIs of the users or artists to follow.
- bool Whether the artist or user was successfully followed.
SpotifyWebAPI::followPlaylist($playlistId, $options)
Add the current user as a follower of a playlist.
https://developer.spotify.com/documentation/web-api/reference/#/operations/follow-playlist
$playlistId
string - ID or URI of the playlist to follow.$options
array|object - Optional. Options for the followed playlist.- bool public Optional. Whether the playlist should be followed publicly or not.
- bool Whether the playlist was successfully followed.
SpotifyWebAPI::getAlbum($albumId, $options)
Get an album.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-an-album
$albumId
string - ID or URI of the album.$options
array|object - Optional. Options for the album.- string market Optional. ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The requested album. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getAlbums($albumIds, $options)
Get multiple albums.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-multiple-albums
$albumIds
array - IDs or URIs of the albums.$options
array|object - Optional. Options for the albums.- string market Optional. ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The requested albums. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getAlbumTracks($albumId, $options)
Get an album's tracks.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-an-albums-tracks
$albumId
string - ID or URI of the album.$options
array|object - Optional. Options for the tracks.- int limit Optional. Limit the number of tracks.
- int offset Optional. Number of tracks to skip.
- string market Optional. ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The requested album tracks. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getArtist($artistId)
Get an artist.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-an-artist
$artistId
string - ID or URI of the artist.
- array|object The requested artist. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getArtists($artistIds)
Get multiple artists.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-multiple-artists
$artistIds
array - IDs or URIs of the artists.
- array|object The requested artists. Type is controlled by the
return_assoc
option.
Deprecated. See https://developer.spotify.com/blog/2024-11-27-changes-to-the-web-api
SpotifyWebAPI::getArtistRelatedArtists($artistId)
Get an artist's related artists.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-an-artists-related-artists
$artistId
string - ID or URI of the artist.
- array|object The artist's related artists. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getArtistAlbums($artistId, $options)
Get an artist's albums.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-an-artists-albums
$artistId
string - ID or URI of the artist.$options
array|object - Optional. Options for the albums.- string market Optional. Limit the results to items that are playable in this country, for example SE.
- string|array include_groups Optional. Album types to return. If omitted, all album types will be returned.
- int limit Optional. Limit the number of albums.
- int offset Optional. Number of albums to skip.
- array|object The artist's albums. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getArtistTopTracks($artistId, $options)
Get an artist's top tracks in a country.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-an-artists-top-tracks
$artistId
string - ID or URI of the artist.$options
array|object - Options for the tracks.- string market Required. An ISO 3166-1 alpha-2 country code specifying the country to get the top tracks for.
- array|object The artist's top tracks. Type is controlled by the
return_assoc
option.
Deprecated. See https://developer.spotify.com/blog/2024-11-27-changes-to-the-web-api
SpotifyWebAPI::getAudioAnalysis($trackId)
Get audio analysis for track.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-audio-analysis
$trackId
string - ID or URI of the track.
- array|object The track's audio analysis. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getAudiobook($audiobookId, $options)
Get an audiobook.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-an-audiobook
$audiobookId
string - ID or URI of the audiobook.$options
array|object - Optional. Options for the audiobook.- string market Optional. ISO 3166-1 alpha-2 country code, limit results to audiobooks available in that market.
- array|object The requested audiobook. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getAudiobooks($audiobookIds, $options)
Get multiple audiobooks.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-multiple-audiobooks
$audiobookIds
array - IDs or URIs of the audiobooks.$options
array|object - Optional. Options for the audiobooks.- string market Optional. ISO 3166-1 alpha-2 country code, limit results to audiobooks available in that market.
- array|object The requested audiobooks. Type is controlled by the
return_assoc
option.
Deprecated. See https://developer.spotify.com/blog/2024-11-27-changes-to-the-web-api
SpotifyWebAPI::getAudioFeatures($trackId)
Get audio features of a single track.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-audio-features
$trackId
string - ID or URI of the track.
- array|object The track's audio features. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getCategoriesList($options)
Get a list of categories used to tag items in Spotify (on, for example, the Spotify player’s "Discover" tab).
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-categories
$options
array|object - Optional. Options for the categories.- string locale Optional. Language to show categories in, for example 'sv_SE'.
- string country Optional. ISO 3166-1 alpha-2 country code. Show categories from this country.
- int limit Optional. Limit the number of categories.
- int offset Optional. Number of categories to skip.
- array|object The list of categories. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getCategory($categoryId, $options)
Get a single category used to tag items in Spotify (on, for example, the Spotify player’s "Discover" tab).
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-a-category
$categoryId
string - ID of the category.$options
array|object - Optional. Options for the category.- string locale Optional. Language to show category in, for example 'sv_SE'.
- string country Optional. ISO 3166-1 alpha-2 country code. Show category from this country.
- array|object The category. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getCategoryPlaylists($categoryId, $options)
Get a list of Spotify playlists tagged with a particular category.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-a-categories-playlists
$categoryId
string - ID of the category.$options
array|object - Optional. Options for the category's playlists.- string country Optional. ISO 3166-1 alpha-2 country code. Show category playlists from this country.
- int limit Optional. Limit the number of playlists.
- int offset Optional. Number of playlists to skip.
- array|object The list of playlists. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getChapter($chapterId, $options)
Get a chapter.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-chapter
$chapterId
string - ID or URI of the chapter.$options
array|object - Optional. Options for the chapter.- string market Optional. ISO 3166-1 alpha-2 country code, limit results to episodes available in that market.
- array|object The requested chapter. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getChapters($chapterIds, $options)
Get multiple chapters.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-several-chapters
$chapterIds
array - IDs or URIs of the chapters.$options
array|object - Optional. Options for the chapters.- string market Optional. ISO 3166-1 alpha-2 country code, limit results to episodes available in that market.
- array|object The requested chapters. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getEpisode($episodeId, $options)
Get an episode.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-an-episode
$episodeId
string - ID or URI of the episode.$options
array|object - Optional. Options for the episode.- string market Optional. ISO 3166-1 alpha-2 country code, limit results to episodes available in that market.
- array|object The requested episode. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getEpisodes($episodeIds, $options)
Get multiple episodes.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-multiple-episodes
$episodeIds
string|array - IDs or URIs of the episodes.$options
array|object - Optional. Options for the episodes.- string market Optional. ISO 3166-1 alpha-2 country code, limit results to episodes available in that market.
- array|object The requested episodes. Type is controlled by the
return_assoc
option.
Deprecated. See https://developer.spotify.com/blog/2024-11-27-changes-to-the-web-api
SpotifyWebAPI::getFeaturedPlaylists($options)
Get Spotify featured playlists.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-featured-playlists
$options
array|object - Optional. Options for the playlists.- string locale Optional. Language to show playlists in, for example 'sv_SE'.
- string country Optional. ISO 3166-1 alpha-2 country code. Show playlists from this country.
- string timestamp Optional. A ISO 8601 timestamp. Show playlists relevant to this date and time.
- int limit Optional. Limit the number of playlists.
- int offset Optional. Number of playlists to skip.
- array|object The featured playlists. Type is controlled by the
return_assoc
option.
Deprecated. See https://developer.spotify.com/blog/2024-11-27-changes-to-the-web-api
SpotifyWebAPI::getGenreSeeds()
Get a list of possible seed genres.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-recommendation-genres
- array|object All possible seed genres. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getLastResponse()
Get the latest full response from the Spotify API.
- array Response data.
- array|object body The response body. Type is controlled by the
return_assoc
option. - array headers Response headers.
- int status HTTP status code.
- string url The requested URL.
- array|object body The response body. Type is controlled by the
SpotifyWebAPI::getMarkets()
Get all markets where Spotify is available.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-available-markets
- array|object All markets where Spotify is available. Type is controlled by the
return_assoc
option.
Deprecated. See https://developer.spotify.com/blog/2024-11-27-changes-to-the-web-api
SpotifyWebAPI::getMultipleAudioFeatures($trackIds)
Get audio features of multiple tracks.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-several-audio-features
$trackIds
string|array - IDs or URIs of the tracks.
- array|object The tracks' audio features. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getMyCurrentTrack($options)
Get the current user’s currently playing track.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-the-users-currently-playing-track
$options
array|object - Optional. Options for the track.- string market Optional. ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- string|array additional_types Optional. Types of media to return info about.
- array|object|null The user's currently playing track or null if nothing's currently playing. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getMyDevices()
Get the current user’s devices.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-a-users-available-devices
- array|object The user's devices. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getMyCurrentPlaybackInfo($options)
Get the current user’s current playback information.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-information-about-the-users-current-playback
$options
array|object - Optional. Options for the info.- string market Optional. ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- string|array additional_types Optional. Types of media to return info about.
- array|object|null The user's playback information or null if nothing's currently playing. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getMyPlaylists($options)
Get the current user’s playlists.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-a-list-of-current-users-playlists
$options
array|object - Optional. Options for the playlists.- int limit Optional. Limit the number of playlists.
- int offset Optional. Number of playlists to skip.
- array|object The user's playlists. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getMyQueue()
Get the current user’s queue.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-queue
- array|object The currently playing song and queue. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getMyRecentTracks($options)
Get the current user’s recently played tracks.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-recently-played
$options
array|object - Optional. Options for the tracks.- int limit Optional. Number of tracks to return.
- string after Optional. Unix timestamp in ms (13 digits). Returns all items after this position.
- string before Optional. Unix timestamp in ms (13 digits). Returns all items before this position.
- array|object The most recently played tracks. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getMySavedAlbums($options)
Get the current user’s saved albums.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-users-saved-albums
$options
array|object - Optional. Options for the albums.- int limit Optional. Number of albums to return.
- int offset Optional. Number of albums to skip.
- string market Optional. ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The user's saved albums. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getMySavedEpisodes($options)
Get the current user’s saved episodes.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-users-saved-episodes
$options
array|object - Optional. Options for the episodes.- int limit Optional. Number of episodes to return.
- int offset Optional. Number of episodes to skip.
- string market Optional. ISO 3166-1 alpha-2 country code, limit results to episodes available in that market.
- array|object The user's saved episodes. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getMySavedTracks($options)
Get the current user’s saved tracks.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-users-saved-tracks
$options
array|object - Optional. Options for the tracks.- int limit Optional. Limit the number of tracks.
- int offset Optional. Number of tracks to skip.
- string market Optional. ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The user's saved tracks. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getMySavedShows($options)
Get the current user’s saved shows.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-users-saved-shows
$options
array|object - Optional. Options for the shows.- int limit Optional. Limit the number of shows.
- int offset Optional. Number of shows to skip.
- array|object The user's saved shows. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getMyTop($type, $options)
Get the current user's top tracks or artists.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-users-top-artists-and-tracks
$type
string - The type to fetch, either 'artists' or 'tracks'.$options
array - Optional. Options for the results.- int limit Optional. Limit the number of results.
- int offset Optional. Number of results to skip.
- string time_range Optional. Over what time frame the data is calculated. See Spotify API docs for more info.
- array|object A list of the requested top entity. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getNewReleases($options)
Get new releases.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-new-releases
$options
array|object - Optional. Options for the items.- string country Optional. ISO 3166-1 alpha-2 country code. Show items relevant to this country.
- int limit Optional. Limit the number of items.
- int offset Optional. Number of items to skip.
- array|object The new releases. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getPlaylist($playlistId, $options)
Get a specific playlist.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-playlist
$playlistId
string - ID or URI of the playlist.$options
array|object - Optional. Options for the playlist.- string|array fields Optional. A list of fields to return. See Spotify docs for more info.
- string market Optional. ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- string|array additional_types Optional. Types of media to return info about.
- array|object The user's playlist. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getPlaylistImage($playlistId)
Get a playlist's cover image.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-playlist-cover
$playlistId
string - ID or URI of the playlist.
- array|object The playlist cover image. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getPlaylistTracks($playlistId, $options)
Get the tracks in a playlist.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-playlists-tracks
$playlistId
string - ID or URI of the playlist.$options
array|object - Optional. Options for the tracks.- string|array fields Optional. A list of fields to return. See Spotify docs for more info.
- int limit Optional. Limit the number of tracks.
- int offset Optional. Number of tracks to skip.
- string market Optional. ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- string|array additional_types Optional. Types of media to return info about.
- array|object The tracks in the playlist. Type is controlled by the
return_assoc
option.
Deprecated. See https://developer.spotify.com/blog/2024-11-27-changes-to-the-web-api
SpotifyWebAPI::getRecommendations($options)
Get recommendations based on artists, tracks, or genres.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-recommendations
$options
array|object - Optional. Options for the recommendations.- int limit Optional. Limit the number of recommendations.
- string market Optional. ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- mixed max_* Optional. Max value for one of the tunable track attributes.
- mixed min_* Optional. Min value for one of the tunable track attributes.
- array seed_artists Artist IDs to seed by.
- array seed_genres Genres to seed by. Call SpotifyWebAPI::getGenreSeeds() for a complete list.
- array seed_tracks Track IDs to seed by.
- mixed target_* Optional. Target value for one of the tunable track attributes.
- array|object The requested recommendations. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getRequest()
Get the Request object in use.
- \SpotifyWebAPI\Request The Request object in use.
SpotifyWebAPI::getShow($showId, $options)
Get a show.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-a-show
$showId
string - ID or URI of the show.$options
array|object - Optional. Options for the show.- string market Optional. ISO 3166-1 alpha-2 country code, limit results to shows available in that market.
- array|object The requested show. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getShowEpisodes($showId, $options)
Get a show's episodes.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-a-shows-episodes
$showId
string - ID or URI of the album.$options
array|object - Optional. Options for the episodes.- int limit Optional. Limit the number of episodes.
- int offset Optional. Number of episodes to skip.
- string market Optional. ISO 3166-1 alpha-2 country code, limit results to episodes available in that market.
- array|object The requested show episodes. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getShows($showIds, $options)
Get multiple shows.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-multiple-shows
$showIds
string|array - IDs or URIs of the shows.$options
array|object - Optional. Options for the shows.- string market Optional. ISO 3166-1 alpha-2 country code, limit results to shows available in that market.
- array|object The requested shows. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getTrack($trackId, $options)
Get a track.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-track
$trackId
string - ID or URI of the track.$options
array|object - Optional. Options for the track.- string market Optional. ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The requested track. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getTracks($trackIds, $options)
Get multiple tracks.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-several-tracks
$trackIds
array - IDs or URIs of the tracks.$options
array|object - Optional. Options for the tracks.- string market Optional. ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking.
- array|object The requested tracks. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getUser($userId)
Get a user.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-users-profile
$userId
string - ID or URI of the user.
- array|object The requested user. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getUserFollowedArtists($options)
Get the artists followed by the current user.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-followed
$options
array|object - Optional. Options for the artists.- int limit Optional. Limit the number of artists returned.
- string after Optional. The last artist ID retrieved from the previous request.
- array|object A list of artists. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::getUserPlaylists($userId, $options)
Get a user's playlists.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-list-users-playlists
$userId
string - ID or URI of the user.$options
array|object - Optional. Options for the tracks.- int limit Optional. Limit the number of tracks.
- int offset Optional. Number of tracks to skip.
- array|object The user's playlists. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::me()
Get the currently authenticated user.
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-current-users-profile
- array|object The currently authenticated user. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::myAlbumsContains($albums)
Check if albums are saved in the current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/#/operations/check-users-saved-albums
$albums
string|array - Album IDs or URIs to check for.
- array Whether each album is saved.
SpotifyWebAPI::myEpisodesContains($episodes)
Check if episodes are saved in the current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/#/operations/check-users-saved-episodes
$episodes
string|array - Episode IDs or URIs to check for.
- array Whether each episode is saved.
SpotifyWebAPI::myShowsContains($shows)
Check if shows are saved in the current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/#/operations/check-users-saved-shows
$shows
string|array - Show IDs or URIs to check for.
- array Whether each show is saved.
SpotifyWebAPI::myTracksContains($tracks)
Check if tracks are saved in the current user's Spotify library.
https://developer.spotify.com/documentation/web-api/reference/#/operations/check-users-saved-tracks
$tracks
string|array - Track IDs or URIs to check for.
- array Whether each track is saved.
SpotifyWebAPI::next($deviceId)
Play the next track in the current users's queue.
https://developer.spotify.com/documentation/web-api/reference/#/operations/skip-users-playback-to-next-track
$deviceId
string - Optional. ID of the device to target.
- bool Whether the track was successfully skipped.
SpotifyWebAPI::pause($deviceId)
Pause playback for the current user.
https://developer.spotify.com/documentation/web-api/reference/#/operations/pause-a-users-playback
$deviceId
string - Optional. ID of the device to pause on.
- bool Whether the playback was successfully paused.
SpotifyWebAPI::play($deviceId, $options)
Start playback for the current user.
https://developer.spotify.com/documentation/web-api/reference/#/operations/start-a-users-playback
$deviceId
string - Optional. ID of the device to play on.$options
array|object - Optional. Options for the playback.- string context_uri Optional. URI of the context to play, for example an album.
- array uris Optional. Spotify track URIs to play.
- object offset Optional. Indicates from where in the context playback should start.
- int position_ms. Optional. Indicates the position to start playback from.
- bool Whether the playback was successfully started.
SpotifyWebAPI::previous($deviceId)
Play the previous track in the current users's queue.
https://developer.spotify.com/documentation/web-api/reference/#/operations/skip-users-playback-to-previous-track
$deviceId
string - Optional. ID of the device to target.
- bool Whether the track was successfully skipped.
SpotifyWebAPI::queue($trackUri, $deviceId)
Add an item to the queue.
https://developer.spotify.com/documentation/web-api/reference/#/operations/add-to-queue
$trackUri
string - Required. Track ID, track URI or episode URI to queue.$deviceId
string - Optional. ID of the device to target.
- bool Whether the track was successfully queued.
SpotifyWebAPI::reorderPlaylistTracks($playlistId, $options)
Reorder the tracks in a playlist.
https://developer.spotify.com/documentation/web-api/reference/#/operations/reorder-or-replace-playlists-tracks
$playlistId
string - ID or URI of the playlist.$options
array|object - Options for the new tracks.- int range_start Required. Position of the first track to be reordered.
- int range_length Optional. The amount of tracks to be reordered.
- int insert_before Required. Position where the tracks should be inserted.
- string snapshot_id Optional. The playlist's snapshot ID.
- string|bool A new snapshot ID or false if the tracks weren't successfully reordered.
SpotifyWebAPI::repeat($options)
Set repeat mode for the current user’s playback.
https://developer.spotify.com/documentation/web-api/reference/#/operations/set-repeat-mode-on-users-playback
$options
array|object - Optional. Options for the playback repeat mode.- string state Required. The repeat mode. See Spotify docs for possible values.
- string device_id Optional. ID of the device to target.
- bool Whether the playback repeat mode was successfully changed.
SpotifyWebAPI::replacePlaylistTracks($playlistId, $tracks)
Replace all tracks in a playlist with new ones.
https://developer.spotify.com/documentation/web-api/reference/#/operations/reorder-or-replace-playlists-tracks
$playlistId
string - ID or URI of the playlist.$tracks
string|array - IDs, track URIs, or episode URIs to replace with.
- bool Whether the tracks was successfully replaced.
SpotifyWebAPI::search($query, $type, $options)
Search for an item.
https://developer.spotify.com/documentation/web-api/reference/#/operations/search
$query
string - The term to search for.$type
string|array - The type of item to search for.$options
array|object - Optional. Options for the search.- string market Optional. Limit the results to items that are playable in this market, for example SE.
- int limit Optional. Limit the number of items.
- int offset Optional. Number of items to skip.
- string include_external Optional. Whether or not to mark externally hosted content as playable.
- array|object The search results. Type is controlled by the
return_assoc
option.
SpotifyWebAPI::seek($options)
Change playback position for the current user.
https://developer.spotify.com/documentation/web-api/reference/#/operations/seek-to-position-in-currently-playing-track
$options
array|object - Optional. Options for the playback seeking.- string position_ms Required. The position in milliseconds to seek to.
- string device_id Optional. ID of the device to target.
- bool Whether the playback position was successfully changed.
SpotifyWebAPI::setAccessToken($accessToken)
Set the access token to use.
$accessToken
string - The access token.
- self
SpotifyWebAPI::setOptions($options)
Set options
$options
array|object - Options to set.
- self
SpotifyWebAPI::setSession($session)
Set the Session object to use.
$session
\SpotifyWebAPI\Session - The Session object.
- self
SpotifyWebAPI::shuffle($options)
Set shuffle mode for the current user’s playback.
https://developer.spotify.com/documentation/web-api/reference/#/operations/toggle-shuffle-for-users-playback
$options
array|object - Optional. Options for the playback shuffle mode.- bool state Required. The shuffle mode. See Spotify docs for possible values.
- string device_id Optional. ID of the device to target.
- bool Whether the playback shuffle mode was successfully changed.
SpotifyWebAPI::unfollowArtistsOrUsers($type, $ids)
Remove the current user as a follower of one or more artists or other Spotify users.
https://developer.spotify.com/documentation/web-api/reference/#/operations/unfollow-artists-users
$type
string - The type to check: either 'artist' or 'user'.$ids
string|array - IDs or URIs of the users or artists to unfollow.
- bool Whether the artists or users were successfully unfollowed.
SpotifyWebAPI::unfollowPlaylist($playlistId)
Remove the current user as a follower of a playlist.
https://developer.spotify.com/documentation/web-api/reference/#/operations/unfollow-playlist
$playlistId
string - ID or URI of the playlist to unfollow.
- bool Whether the playlist was successfully unfollowed.
SpotifyWebAPI::updatePlaylist($playlistId, $options)
Update the details of a playlist.
https://developer.spotify.com/documentation/web-api/reference/#/operations/change-playlist-details
$playlistId
string - ID or URI of the playlist to update.$options
array|object - Options for the playlist.- bool collaborative Optional. Whether the playlist should be collaborative or not.
- string description Optional. Description of the playlist.
- string name Optional. Name of the playlist.
- bool public Optional. Whether the playlist should be public or not.
- bool Whether the playlist was successfully updated.
SpotifyWebAPI::updatePlaylistImage($playlistId, $imageData)
Update the image of a playlist.
https://developer.spotify.com/documentation/web-api/reference/#/operations/upload-custom-playlist-cover
$playlistId
string - ID or URI of the playlist to update.$imageData
string - Base64 encoded JPEG image data, maximum 256 KB in size.
- bool Whether the playlist was successfully updated.
SpotifyWebAPI::usersFollowPlaylist($playlistId, $options)
Check if a set of users are following a playlist.
https://developer.spotify.com/documentation/web-api/reference/#/operations/check-if-user-follows-playlist
$playlistId
string - ID or URI of the playlist.$options
array|object - Options for the check.- ids string|array Required. IDs or URIs of the users to check for.
- array Whether each user is following the playlist.