spotify
Module spotify
API
Definitions
ballerinax/spotify Ballerina library
Overview
Spotify is a music and podcast streaming service that gives listeners access to millions of tracks, albums, podcasts, and audiobooks, along with personalised playlists and recommendations.
The Spotify connector provides a Ballerina client for the Spotify Web API. It lets you search the Spotify catalogue, read and manage a user's library and playlists, follow artists and users, and inspect and control playback on a user's devices from your integrations.
Key Features
- Browse the Spotify catalogue: albums, artists, tracks, shows, episodes, audiobooks, and chapters
- Search for any catalogue item and fetch new releases, categories, and recommendations
- Create and update playlists, and add, reorder, or remove their items
- Manage a user's saved tracks, albums, shows, episodes, and audiobooks, and the artists and users they follow
- Read the user's listening history and top items, inspect playback state, and control playback on their devices
Setup guide
To use the Spotify connector, you need a Spotify account and an app registered in the Spotify Developer Dashboard.
Step 1: Create a Spotify app
- Sign in to the Spotify Developer Dashboard and select Create app.
- Enter an app name and description, add a redirect URI such as
http://127.0.0.1:8080/callback, select the Web API option, accept the terms of service, and save the app. - Open the app's Settings page and note the Client ID and Client secret.
Step 2: Obtain a refresh token
-
Open the authorization URL in a browser, replacing the placeholders. Request the scopes your integration needs, for example
user-read-private playlist-modify-private user-top-read user-library-read.https://accounts.spotify.com/authorize?client_id=<client-id>&response_type=code&redirect_uri=<redirect-uri>&scope=<space-separated-scopes> -
Approve the request. Spotify redirects to your redirect URI with a
codequery parameter. -
Exchange the code for tokens.
curl -X POST "https://accounts.spotify.com/api/token" \ -H "Authorization: Basic <base64 of client-id:client-secret>" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "grant_type=authorization_code&code=<code>&redirect_uri=<redirect-uri>" -
Copy the
refresh_tokenfrom the response. The connector uses it to obtain new access tokens automatically.
Note: Refresh tokens for apps created in the Spotify Developer Dashboard expire six months after the user authorizes the app. Refreshing access tokens does not extend this period. Once the refresh token expires, token requests fail with an
invalid_granterror, and the user must go through the authorization flow above again to obtain a new refresh token for the connector.
Note: Endpoints that read or change user data need a token granted by that user through this flow. Alternatively, a short-lived access token can be passed with the
tokenfield of the connector's bearer-token configuration.
Quickstart
To use the Spotify connector in your Ballerina application, modify the .bal file as follows.
Step 1: Import the connector
import ballerinax/spotify;
Step 2: Create a new connector instance
Create a Config.toml file with your credentials.
clientId = "<client-id>" clientSecret = "<client-secret>" refreshToken = "<refresh-token>"
Then create a client from them.
configurable string clientId = ?; configurable string clientSecret = ?; configurable string refreshToken = ?; spotify:Client spotify = check new ({ auth: {clientId, clientSecret, refreshToken} });
Step 3: Invoke the connector operation
Fetch a track from the Spotify catalogue.
public function main() returns error? { spotify:TrackObject _ = check spotify->getTrack("2Foc5Q5nqNiosCNqttzHof"); }
Step 4: Run the Ballerina application
bal run
Examples
The Spotify connector provides practical examples illustrating usage in various scenarios. Explore these examples, covering the following use cases:
- Listening taste profile - Summarise the signed-in user's top artists, top tracks, and favourite genres.
- Top tracks playlist builder - Turn the user's top tracks into a new playlist.
Build from source
Setting up prerequisites
-
Download and install Java SE Development Kit (JDK) version 21 from either of the following sources:
Note: After installation, remember to set the
JAVA_HOMEenvironment variable to the directory where the JDK is installed. -
Download and install Ballerina Swan Lake.
-
Download and install Docker.
Note: Ensure that the Docker daemon is running before executing any tests.
-
Export a GitHub Personal Access Token with read package permissions as follows:
export packageUser=<Username> export packagePAT=<Personal Access Token>
Build options
Run the following commands to build from source.
-
To build the package:
./gradlew clean build -
To run the tests:
./gradlew clean test -
To build without the tests:
./gradlew clean build -x test -
To run tests against different environments:
./gradlew clean test -Pgroups=<Comma separated groups/test cases> -
To debug the package with a remote debugger:
./gradlew clean build -Pdebug=<port> -
To debug with the Ballerina language:
./gradlew clean build -PbalJavaDebug=<port> -
Publish the generated artifacts to the local Ballerina Central repository:
./gradlew clean build -PpublishToLocalCentral=true -
Publish the generated artifacts to the Ballerina Central repository:
./gradlew clean build -PpublishToCentral=true
Contribute to Ballerina
As an open-source project, Ballerina welcomes contributions from the community.
For more information, go to the contribution guidelines.
Code of conduct
All the contributors are encouraged to read the Ballerina Code of Conduct.
Useful links
- For more information go to the
spotifypackage. - For example demonstrations of the usage, go to Ballerina By Examples.
- Chat live with us via our Discord server.
- Post all technical questions on Stack Overflow with the #ballerina tag.
Clients
spotify: Client
Client for the Spotify Web API. Search the Spotify catalog, manage a user's library and playlists, follow artists and users, and control playback on a user's devices. Requests need an OAuth 2.0 access token.
Constructor
Gets invoked to initialize the connector.
init (ConnectionConfig config, string serviceUrl)- config ConnectionConfig - The configurations to be used when initializing the
connector
- serviceUrl string "https://api.spotify.com/v1" - URL of the target service
getAlbum
function getAlbum(string id, map<string|string[]> headers, *GetAlbumQueries queries) returns AlbumObject|errorGet Album
Parameters
- id string - The Spotify ID of the album
- queries *GetAlbumQueries - Queries to be sent with the request
Return Type
- AlbumObject|error - An album
listAlbumTracks
function listAlbumTracks(string id, map<string|string[]> headers, *ListAlbumTracksQueries queries) returns PagingSimplifiedTrackObject|errorGet Album Tracks
Parameters
- id string - The Spotify ID of the album
- queries *ListAlbumTracksQueries - Queries to be sent with the request
Return Type
- PagingSimplifiedTrackObject|error - Pages of tracks
getArtist
Get Artist
Parameters
- id string - The Spotify ID of the artist
Return Type
- ArtistObject|error - An artist
listArtistAlbums
function listArtistAlbums(string id, map<string|string[]> headers, *ListArtistAlbumsQueries queries) returns PagingArtistDiscographyAlbumObject|errorGet Artist's Albums
Parameters
- id string - The Spotify ID of the artist
- queries *ListArtistAlbumsQueries - Queries to be sent with the request
Return Type
- PagingArtistDiscographyAlbumObject|error - Pages of albums
getShow
function getShow(string id, map<string|string[]> headers, *GetShowQueries queries) returns ShowObject|errorGet Show
Parameters
- id string - The Spotify ID of the show
- queries *GetShowQueries - Queries to be sent with the request
Return Type
- ShowObject|error - A show
listShowEpisodes
function listShowEpisodes(string id, map<string|string[]> headers, *ListShowEpisodesQueries queries) returns PagingSimplifiedEpisodeObject|errorGet Show Episodes
Parameters
- id string - The Spotify ID of the show
- queries *ListShowEpisodesQueries - Queries to be sent with the request
Return Type
- PagingSimplifiedEpisodeObject|error - Pages of episodes
getEpisode
function getEpisode(string id, map<string|string[]> headers, *GetEpisodeQueries queries) returns EpisodeObject|errorGet Episode
Parameters
- id string - The Spotify ID of the episode
- queries *GetEpisodeQueries - Queries to be sent with the request
Return Type
- EpisodeObject|error - An episode
getAudiobook
function getAudiobook(string id, map<string|string[]> headers, *GetAudiobookQueries queries) returns AudiobookObject|errorGet an Audiobook
Parameters
- id string - The Spotify ID of the audiobook
- queries *GetAudiobookQueries - Queries to be sent with the request
Return Type
- AudiobookObject|error - An Audiobook
listAudiobookChapters
function listAudiobookChapters(string id, map<string|string[]> headers, *ListAudiobookChaptersQueries queries) returns PagingSimplifiedChapterObject|errorGet Audiobook Chapters
Parameters
- id string - The Spotify ID of the audiobook
- queries *ListAudiobookChaptersQueries - Queries to be sent with the request
Return Type
- PagingSimplifiedChapterObject|error - Pages of chapters
listSavedAudiobooks
function listSavedAudiobooks(map<string|string[]> headers, *ListSavedAudiobooksQueries queries) returns PagingSimplifiedAudiobookObject|errorGet User's Saved Audiobooks
Parameters
- queries *ListSavedAudiobooksQueries - Queries to be sent with the request
Return Type
- PagingSimplifiedAudiobookObject|error - Pages of audiobooks
getChapter
function getChapter(string id, map<string|string[]> headers, *GetChapterQueries queries) returns ChapterObject|errorGet a Chapter
Parameters
- id string - The Spotify ID of the chapter
- queries *GetChapterQueries - Queries to be sent with the request
Return Type
- ChapterObject|error - A Chapter
getTrack
function getTrack(string id, map<string|string[]> headers, *GetTrackQueries queries) returns TrackObject|errorGet Track
Parameters
- id string - The Spotify ID of the track
- queries *GetTrackQueries - Queries to be sent with the request
Return Type
- TrackObject|error - A track
searchItems
function searchItems(map<string|string[]> headers, *SearchItemsQueries queries) returns SearchResultsResponse|errorSearch for Item
Parameters
- queries *SearchItemsQueries - Queries to be sent with the request
Return Type
- SearchResultsResponse|error - Search response
getCurrentUserProfile
function getCurrentUserProfile(map<string|string[]> headers) returns PrivateUserObject|errorGet Current User's Profile
Return Type
- PrivateUserObject|error - A user
getPlaylist
function getPlaylist(string playlistId, map<string|string[]> headers, *GetPlaylistQueries queries) returns PlaylistObject|errorGet Playlist
Parameters
- playlistId string - The Spotify ID of the playlist
- queries *GetPlaylistQueries - Queries to be sent with the request
Return Type
- PlaylistObject|error - A playlist
updatePlaylistDetails
function updatePlaylistDetails(string playlistId, UpdatePlaylistDetailsRequest payload, map<string|string[]> headers) returns error?Change Playlist Details
Parameters
- playlistId string - The Spotify ID of the playlist
- payload UpdatePlaylistDetailsRequest - Playlist name, description, and visibility details to change
Return Type
- error? - Playlist updated
listPlaylistItems
function listPlaylistItems(string playlistId, map<string|string[]> headers, *ListPlaylistItemsQueries queries) returns PagingPlaylistTrackObject|errorGet Playlist Items
Parameters
- playlistId string - The Spotify ID of the playlist
- queries *ListPlaylistItemsQueries - Queries to be sent with the request
Return Type
- PagingPlaylistTrackObject|error - Pages of tracks
updatePlaylistItems
function updatePlaylistItems(string playlistId, UpdatePlaylistItemsRequest payload, map<string|string[]> headers, *UpdatePlaylistItemsQueries queries) returns PlaylistSnapshotResponse|errorUpdate Playlist Items
Parameters
- playlistId string - The Spotify ID of the playlist
- payload UpdatePlaylistItemsRequest - URIs to replace the playlist items, or range to reorder
- queries *UpdatePlaylistItemsQueries - Queries to be sent with the request
Return Type
- PlaylistSnapshotResponse|error - A snapshot ID for the playlist
addItemsToPlaylist
function addItemsToPlaylist(string playlistId, AddItemsToPlaylistRequest payload, map<string|string[]> headers, *AddItemsToPlaylistQueries queries) returns PlaylistSnapshotResponse|errorAdd Items to Playlist
Parameters
- playlistId string - The Spotify ID of the playlist
- payload AddItemsToPlaylistRequest - Item URIs and optional position to add to the playlist
- queries *AddItemsToPlaylistQueries - Queries to be sent with the request
Return Type
- PlaylistSnapshotResponse|error - A snapshot ID for the playlist
removePlaylistItems
function removePlaylistItems(string playlistId, RemovePlaylistItemsRequest payload, map<string|string[]> headers) returns PlaylistSnapshotResponse|errorRemove Playlist Items
Parameters
- playlistId string - The Spotify ID of the playlist
- payload RemovePlaylistItemsRequest - Item URIs to remove from the playlist
Return Type
- PlaylistSnapshotResponse|error - A snapshot ID for the playlist
listCurrentUserPlaylists
function listCurrentUserPlaylists(map<string|string[]> headers, *ListCurrentUserPlaylistsQueries queries) returns PagingPlaylistObject|errorGet Current User's Playlists
Parameters
- queries *ListCurrentUserPlaylistsQueries - Queries to be sent with the request
Return Type
- PagingPlaylistObject|error - A paged set of playlists
createPlaylist
function createPlaylist(CreatePlaylistRequest payload, map<string|string[]> headers) returns PlaylistObject|errorCreate Playlist
Parameters
- payload CreatePlaylistRequest - Name, description, and visibility of the playlist to create
Return Type
- PlaylistObject|error - A playlist
saveLibraryItems
function saveLibraryItems(map<string|string[]> headers, *SaveLibraryItemsQueries queries) returns error?Save Items to Library
Parameters
- queries *SaveLibraryItemsQueries - Queries to be sent with the request
Return Type
- error? - Items saved to library
removeLibraryItems
function removeLibraryItems(map<string|string[]> headers, *RemoveLibraryItemsQueries queries) returns error?Remove Items from Library
Parameters
- queries *RemoveLibraryItemsQueries - Queries to be sent with the request
Return Type
- error? - Items removed from library
checkSavedLibraryItems
function checkSavedLibraryItems(map<string|string[]> headers, *CheckSavedLibraryItemsQueries queries) returns boolean[]|errorCheck User's Saved Items
Parameters
- queries *CheckSavedLibraryItemsQueries - Queries to be sent with the request
listSavedAlbums
function listSavedAlbums(map<string|string[]> headers, *ListSavedAlbumsQueries queries) returns PagingSavedAlbumObject|errorGet User's Saved Albums
Parameters
- queries *ListSavedAlbumsQueries - Queries to be sent with the request
Return Type
- PagingSavedAlbumObject|error - Pages of albums
listSavedTracks
function listSavedTracks(map<string|string[]> headers, *ListSavedTracksQueries queries) returns PagingSavedTrackObject|errorGet User's Saved Tracks
Parameters
- queries *ListSavedTracksQueries - Queries to be sent with the request
Return Type
- PagingSavedTrackObject|error - Pages of tracks
listSavedEpisodes
function listSavedEpisodes(map<string|string[]> headers, *ListSavedEpisodesQueries queries) returns PagingSavedEpisodeObject|errorGet User's Saved Episodes
Parameters
- queries *ListSavedEpisodesQueries - Queries to be sent with the request
Return Type
- PagingSavedEpisodeObject|error - Pages of episodes
listSavedShows
function listSavedShows(map<string|string[]> headers, *ListSavedShowsQueries queries) returns PagingSavedShowObject|errorGet User's Saved Shows
Parameters
- queries *ListSavedShowsQueries - Queries to be sent with the request
Return Type
- PagingSavedShowObject|error - Bad or expired token. This can happen if the user revoked a token or the access token has expired. You should re-authenticate the user
listTopItems
function listTopItems("artists"|"tracks" 'type, map<string|string[]> headers, *ListTopItemsQueries queries) returns PagingArtistOrTrackResponse|errorGet User's Top Items
Parameters
- 'type "artists"|"tracks" - The type of entity to return, either
artistsortracks
- queries *ListTopItemsQueries - Queries to be sent with the request
Return Type
- PagingArtistOrTrackResponse|error - Pages of artists or tracks
getPlaylistCoverImage
function getPlaylistCoverImage(string playlistId, map<string|string[]> headers) returns ImageObject[]|errorGet Playlist Cover Image
Parameters
- playlistId string - The Spotify ID of the playlist
Return Type
- ImageObject[]|error - A set of images
uploadPlaylistCoverImage
function uploadPlaylistCoverImage(string playlistId, Request request, map<string|string[]> headers) returns error?Add Custom Playlist Cover Image
Parameters
- playlistId string - The Spotify ID of the playlist
- request Request - Base64 encoded JPEG image to use as the playlist cover
Return Type
- error? - Image uploaded
listFollowedArtists
function listFollowedArtists(map<string|string[]> headers, *ListFollowedArtistsQueries queries) returns FollowedArtistsResponse|errorGet Followed Artists
Parameters
- queries *ListFollowedArtistsQueries - Queries to be sent with the request
Return Type
- FollowedArtistsResponse|error - A paged set of artists
getPlaybackState
function getPlaybackState(map<string|string[]> headers, *GetPlaybackStateQueries queries) returns CurrentlyPlayingContextObject|error?Get Playback State
Parameters
- queries *GetPlaybackStateQueries - Queries to be sent with the request
Return Type
- CurrentlyPlayingContextObject|error? - Information about playback
transferPlayback
function transferPlayback(TransferPlaybackRequest payload, map<string|string[]> headers) returns error?Transfer Playback
Parameters
- payload TransferPlaybackRequest - Device IDs to transfer playback to and whether to start playing
Return Type
- error? - Playback transferred
listDevices
function listDevices(map<string|string[]> headers) returns DevicesResponse|errorGet Available Devices
Return Type
- DevicesResponse|error - A set of devices
getCurrentlyPlaying
function getCurrentlyPlaying(map<string|string[]> headers, *GetCurrentlyPlayingQueries queries) returns CurrentlyPlayingContextObject|error?Get Currently Playing Track
Parameters
- queries *GetCurrentlyPlayingQueries - Queries to be sent with the request
Return Type
- CurrentlyPlayingContextObject|error? - Information about the currently playing track
startPlayback
function startPlayback(StartPlaybackRequest payload, map<string|string[]> headers, *StartPlaybackQueries queries) returns error?Start/Resume Playback
Parameters
- payload StartPlaybackRequest - Context, items, offset, and position to start playback from
- queries *StartPlaybackQueries - Queries to be sent with the request
Return Type
- error? - Playback started
pausePlayback
function pausePlayback(map<string|string[]> headers, *PausePlaybackQueries queries) returns error?Pause Playback
Parameters
- queries *PausePlaybackQueries - Queries to be sent with the request
Return Type
- error? - Playback paused
skipToNext
function skipToNext(map<string|string[]> headers, *SkipToNextQueries queries) returns error?Skip To Next
Parameters
- queries *SkipToNextQueries - Queries to be sent with the request
Return Type
- error? - Command sent
skipToPrevious
function skipToPrevious(map<string|string[]> headers, *SkipToPreviousQueries queries) returns error?Skip To Previous
Parameters
- queries *SkipToPreviousQueries - Queries to be sent with the request
Return Type
- error? - Command sent
seekToPosition
function seekToPosition(map<string|string[]> headers, *SeekToPositionQueries queries) returns error?Seek To Position
Parameters
- queries *SeekToPositionQueries - Queries to be sent with the request
Return Type
- error? - Command sent
setRepeatMode
function setRepeatMode(map<string|string[]> headers, *SetRepeatModeQueries queries) returns error?Set Repeat Mode
Parameters
- queries *SetRepeatModeQueries - Queries to be sent with the request
Return Type
- error? - Command sent
setPlaybackVolume
function setPlaybackVolume(map<string|string[]> headers, *SetPlaybackVolumeQueries queries) returns error?Set Playback Volume
Parameters
- queries *SetPlaybackVolumeQueries - Queries to be sent with the request
Return Type
- error? - Command sent
setShuffle
function setShuffle(map<string|string[]> headers, *SetShuffleQueries queries) returns error?Toggle Playback Shuffle
Parameters
- queries *SetShuffleQueries - Queries to be sent with the request
Return Type
- error? - Command sent
listRecentlyPlayed
function listRecentlyPlayed(map<string|string[]> headers, *ListRecentlyPlayedQueries queries) returns CursorPagingPlayHistoryObject|errorGet Recently Played Tracks
Parameters
- queries *ListRecentlyPlayedQueries - Queries to be sent with the request
Return Type
- CursorPagingPlayHistoryObject|error - A paged set of tracks
getQueue
function getQueue(map<string|string[]> headers) returns QueueObject|errorGet the User's Queue
Return Type
- QueueObject|error - Information about the queue
addToQueue
function addToQueue(map<string|string[]> headers, *AddToQueueQueries queries) returns error?Add Item to Playback Queue
Parameters
- queries *AddToQueueQueries - Queries to be sent with the request
Return Type
- error? - Command received
Records
spotify: AddItemsToPlaylistQueries
Represents the Queries record for the operation: addItemsToPlaylist
Fields
- uris? string - A comma-separated list of Spotify URIs to add, can be track or episode URIs. For example:<br/>
uris=spotify:track:4iV5W9uYEdYUVa79Axb7Rh, spotify:track:1301WleyT98MSxVHPZCA6M, spotify:episode:512ojhOuo1ktJprKbVcKyQ<br/>A maximum of 100 items can be added in one request. <br/> Note: it is likely that passing a large number of item URIs as a query parameter will exceed the maximum length of the request URI. When adding a large number of items, it is recommended to pass them in the request body, see below.
- position? int - The position to insert the items, a zero-based index. For example, to insert the items in the first position:
position=0; to insert the items in the third position:position=2. If omitted, the items will be appended to the playlist. Items are added in the order they are listed in the query string or request body.
spotify: AddItemsToPlaylistRequest
Fields
- uris? string[] - A JSON array of the Spotify URIs to add. For example:
{"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh","spotify:track:1301WleyT98MSxVHPZCA6M", "spotify:episode:512ojhOuo1ktJprKbVcKyQ"]}<br/>A maximum of 100 items can be added in one request. Note: if theurisparameter is present in the query string, any URIs listed here in the body will be ignored.
- position? int - The position to insert the items, a zero-based index. For example, to insert the items in the first position:
position=0; to insert the items in the third position:position=2. If omitted, the items will be appended to the playlist. Items are added in the order they appear in the uris array. For example:{"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh","spotify:track:1301WleyT98MSxVHPZCA6M"], "position": 3}
spotify: AddToQueueQueries
Represents the Queries record for the operation: addToQueue
Fields
- device_id? string - The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
- uri string - The uri of the item to add to the queue. Must be a track or an episode uri.
spotify: AlbumBase
Fields
- images ImageObject[] - The cover art for the album in various sizes, widest first
- availableMarkets string[] - The markets in which the album is available: ISO 3166-1 alpha-2 country codes. NOTE: an album is considered available in a market when at least 1 of its tracks is available in that market.
- restrictions? AlbumRestrictionObject - Included in the response when a content restriction is applied
- releaseDatePrecision "year"|"month"|"day" - The precision with which
release_datevalue is known
- 'type "album" - The object type
- uri string - The Spotify URI for the album
- totalTracks int - The number of tracks in the album
- releaseDate string - The date the album was first released
- name string - The name of the album. In case of an album takedown, the value may be an empty string
- albumType "album"|"single"|"compilation" - The type of the album
- href string - A link to the Web API endpoint providing full details of the album
- id string - The Spotify ID for the album
- externalUrls ExternalUrlObject - Known external URLs for this album
spotify: AlbumObject
Fields
- Fields Included from *AlbumBase
- images ImageObject[]
- availableMarkets string[]
- restrictions AlbumRestrictionObject
- releaseDatePrecision "year"|"month"|"day"
- type "album"
- uri string
- totalTracks int
- releaseDate string
- name string
- albumType "album"|"single"|"compilation"
- href string
- id string
- externalUrls ExternalUrlObject
- anydata...
- artists SimplifiedArtistObject[] - The artists of the album. Each artist object includes a link in
hrefto more detailed information about the artist
- copyrights CopyrightObject[] - The copyright statements of the album
- genres string[] - Deprecated The array is always empty
- popularity int - The popularity of the album. The value will be between 0 and 100, with 100 being the most popular
- label string - The label associated with the album
- externalIds ExternalIdObject - Known external IDs for the album
- tracks PagingSimplifiedTrackObject - The tracks of the album
spotify: AlbumRestrictionObject
Fields
- reason? "market"|"product"|"explicit" - The reason for the restriction. Albums may be restricted if the content is not available in a given market, to the user's subscription type, or when the user's account is set to not play explicit content. Additional reasons may be added in the future
spotify: ArtistDiscographyAlbumObject
Fields
- Fields Included from *SimplifiedAlbumObject
- artists SimplifiedArtistObject[]
- images ImageObject[]
- availableMarkets string[]
- restrictions AlbumRestrictionObject
- releaseDatePrecision "year"|"month"|"day"
- type "album"
- uri string
- totalTracks int
- releaseDate string
- name string
- albumType "album"|"single"|"compilation"
- href string
- id string
- externalUrls ExternalUrlObject
- anydata...
- albumGroup "album"|"single"|"compilation"|"appears_on" - This field describes the relationship between the artist and the album
spotify: ArtistObject
Fields
- images? ImageObject[] - Images of the artist in various sizes, widest first
- followers? FollowersObject - Information about the followers of the artist
- genres? string[] - A list of the genres the artist is associated with. If not yet classified, the array is empty
- popularity? int - The popularity of the artist. The value will be between 0 and 100, with 100 being the most popular. The artist's popularity is calculated from the popularity of all the artist's tracks
- name? string - The name of the artist
- href? string - A link to the Web API endpoint providing full details of the artist
- id? string - The Spotify ID for the artist
- 'type? "artist" - The object type
- externalUrls? ExternalUrlObject - Known external URLs for this artist
- uri? string - The Spotify URI for the artist
spotify: AudiobookBase
Fields
- images ImageObject[] - The cover art for the audiobook in various sizes, widest first
- copyrights CopyrightObject[] - The copyright statements of the audiobook
- availableMarkets string[] - A list of the countries in which the audiobook can be played, identified by their ISO 3166-1 alpha-2 code
- description string - A description of the audiobook. HTML tags are stripped away from this field, use
html_descriptionfield in case HTML tags are needed
- edition? string - The edition of the audiobook
- 'type "audiobook" - The object type
- htmlDescription string - A description of the audiobook. This field may contain HTML tags
- uri string - The Spotify URI for the audiobook
- explicit boolean - Whether or not the audiobook has explicit content (true = yes it does; false = no it does not OR unknown)
- mediaType string - The media type of the audiobook
- name string - The name of the audiobook
- totalChapters int - The number of chapters in this audiobook
- publisher string - The publisher of the audiobook
- href string - A link to the Web API endpoint providing full details of the audiobook
- id string - The Spotify ID for the audiobook
- externalUrls ExternalUrlObject - External URLs for this audiobook
- authors AuthorObject[] - The author(s) for the audiobook
- narrators NarratorObject[] - The narrator(s) for the audiobook
spotify: AudiobookObject
Fields
- Fields Included from *AudiobookBase
- images ImageObject[]
- languages string[]
- copyrights CopyrightObject[]
- availableMarkets string[]
- description string
- edition string
- type "audiobook"
- htmlDescription string
- uri string
- explicit boolean
- mediaType string
- name string
- totalChapters int
- publisher string
- href string
- id string
- externalUrls ExternalUrlObject
- authors AuthorObject[]
- narrators NarratorObject[]
- anydata...
- chapters PagingSimplifiedChapterObject - The chapters of the audiobook
spotify: AuthorObject
Fields
- name? string - The name of the author
spotify: ChapterBase
Fields
- images ImageObject[] - The cover art for the chapter in various sizes, widest first
- chapterNumber int - The number of the chapter
- availableMarkets? string[] - A list of the countries in which the chapter can be played, identified by their ISO 3166-1 alpha-2 code
- description string - A description of the chapter. HTML tags are stripped away from this field, use
html_descriptionfield in case HTML tags are needed
- restrictions? ChapterRestrictionObject - Included in the response when a content restriction is applied
- releaseDatePrecision "year"|"month"|"day" - The precision with which
release_datevalue is known
- 'type "episode" - The object type
- htmlDescription string - A description of the chapter. This field may contain HTML tags
- uri string - The Spotify URI for the chapter
- audioPreviewUrl string? - A URL to a 30 second preview (MP3 format) of the chapter.
nullif not available
- durationMs int - The chapter length in milliseconds
- explicit boolean - Whether or not the chapter has explicit content (true = yes it does; false = no it does not OR unknown)
- isPlayable boolean - True if the chapter is playable in the given market. Otherwise false
- resumePoint? ResumePointObject - The user's most recent position in the chapter. Set if the supplied access token is a user token and has the scope 'user-read-playback-position'
- releaseDate string - The date the chapter was first released, for example
"1981-12-15". Depending on the precision, it might be shown as"1981"or"1981-12"
- name string - The name of the chapter
- href string - A link to the Web API endpoint providing full details of the chapter
- id string - The Spotify ID for the chapter
- externalUrls ExternalUrlObject - External URLs for this chapter
spotify: ChapterObject
Fields
- Fields Included from *ChapterBase
- images ImageObject[]
- languages string[]
- chapterNumber int
- availableMarkets string[]
- description string
- restrictions ChapterRestrictionObject
- releaseDatePrecision "year"|"month"|"day"
- type "episode"
- htmlDescription string
- uri string
- audioPreviewUrl string|()
- durationMs int
- explicit boolean
- isPlayable boolean
- resumePoint ResumePointObject
- releaseDate string
- name string
- href string
- id string
- externalUrls ExternalUrlObject
- anydata...
- audiobook SimplifiedAudiobookObject - The audiobook for which the chapter belongs
spotify: ChapterRestrictionObject
Fields
- reason? string - The reason for the restriction. Supported values:
market- The content item is not available in the given market.product- The content item is not available for the user's subscription type.explicit- The content item is explicit and the user's account is set to not play explicit content.payment_required- Payment is required to play the content item.
spotify: CheckSavedLibraryItemsQueries
Represents the Queries record for the operation: checkSavedLibraryItems
Fields
- uris string - A comma-separated list of Spotify URIs. Maximum: 40 URIs.
Supported URI types:
spotify:track:{id}spotify:album:{id}spotify:episode:{id}spotify:show:{id}spotify:audiobook:{id}spotify:artist:{id}spotify:user:{id}spotify:playlist:{id}
spotify: ConnectionConfig
Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint.
Fields
- auth BearerTokenConfig|OAuth2RefreshTokenGrantConfig - Configurations related to client authentication
- httpVersion HttpVersion(default http:HTTP_2_0) - The HTTP version understood by the client
- http1Settings ClientHttp1Settings(default {}) - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings(default {}) - Configurations related to HTTP/2 protocol
- timeout decimal(default 30) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded/x-forwardedheader
- followRedirects? FollowRedirects - Configurations associated with Redirection
- poolConfig? PoolConfiguration - Configurations associated with request pooling
- cache CacheConfig(default {}) - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding) header
- circuitBreaker? CircuitBreakerConfig - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig? RetryConfig - Configurations associated with retrying
- cookieConfig? CookieConfig - Configurations associated with cookies
- responseLimits ResponseLimitConfigs(default {}) - Configurations associated with inbound response size limits
- secureSocket? ClientSecureSocket - SSL/TLS-related options
- proxy? ProxyConfig - Proxy server related options
- socketConfig ClientSocketConfig(default {}) - Provides settings related to client socket configuration
- validation boolean(default true) - Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default
- laxDataBinding boolean(default true) - Enables relaxed data binding on the client side. When enabled,
nilvalues are treated as optional, and absent fields are handled asnilabletypes. Enabled by default.
spotify: ContextObject
Fields
- href? string - A link to the Web API endpoint providing full details of the track
- 'type? string - The object type, e.g. "artist", "playlist", "album", "show"
- externalUrls? ExternalUrlObject - External URLs for this context
- uri? string - The Spotify URI for the context
spotify: CopyrightObject
Fields
- text? string - The copyright text for this content
- 'type? string - The type of copyright:
C= the copyright,P= the sound recording (performance) copyright
spotify: CreatePlaylistRequest
Fields
- name string - The name for the new playlist, for example
"Your Coolest Playlist". This name does not need to be unique; a user may have several playlists with the same name.
- 'public? boolean - Defaults to
true. The playlist's public/private status (if it should be added to the user's profile or not):truethe playlist will be public,falsethe playlist will be private. To be able to create private playlists, the user must have granted theplaylist-modify-privatescope. For more about public/private status, see Working with Playlists
- description? string - value for playlist description as displayed in Spotify Clients and in the Web API.
spotify: CurrentlyPlayingContextObject
Fields
- item? TrackObject|EpisodeObject - The currently playing track or episode. Can be
null
- currentlyPlayingType? string - The object type of the currently playing item. Can be one of
track,episode,adorunknown
- shuffleState? boolean - If shuffle is on or off
- context? ContextObject - A Context Object. Can be
null
- isPlaying? boolean - If something is currently playing, return
true
- progressMs? int - Progress into the currently playing track or episode. Can be
null
- device? DeviceObject - The device that is currently active
- actions? DisallowsObject - Allows to update the user interface based on which playback actions are available within the current context
- repeatState? string - off, track, context
- timestamp? int - Unix Millisecond Timestamp when playback state was last changed (play, pause, skip, scrub, new song, etc.)
spotify: CursorObject
Fields
- before? string - The cursor to use as key to find the previous page of items
- after? string - The cursor to use as key to find the next page of items
spotify: CursorPagingObject
Fields
- next? string - URL to the next page of items. (
nullif none)
- cursors? CursorObject - The cursors used to find the next set of items
- total? int - The total number of items available to return
- 'limit? int - The maximum number of items in the response (as set in the query or by default)
- href? string - A link to the Web API endpoint returning the full result of the request
spotify: CursorPagingPlayHistoryObject
Fields
- Fields Included from *CursorPagingObject
- next string
- cursors CursorObject
- total int
- limit int
- href string
- anydata...
- items? PlayHistoryObject[] -
spotify: CursorPagingSimplifiedArtistObject
Fields
- Fields Included from *CursorPagingObject
- next string
- cursors CursorObject
- total int
- limit int
- href string
- anydata...
- items? ArtistObject[] -
spotify: DeviceObject
Fields
- isActive? boolean - If this device is the currently active device
- isPrivateSession? boolean - If this device is currently in a private session
- isRestricted? boolean - Whether controlling this device is restricted. At present if this is "true" then no Web API commands will be accepted by this device
- name? string - A human-readable name for the device. Some devices have a name that the user can configure (e.g. "Loudest speaker") and some devices have a generic name associated with the manufacturer or device model
- id? string? - The device ID. This ID is unique and persistent to some extent. However, this is not guaranteed and any cached
device_idshould periodically be cleared out and refetched as necessary
- 'type? string - Device type, such as "computer", "smartphone" or "speaker"
- supportsVolume? boolean - If this device can be used to set the volume
- volumePercent? int? - The current volume in percent
spotify: DevicesResponse
A set of devices
Fields
- devices DeviceObject[] - The available playback devices
spotify: DisallowsObject
Fields
- togglingShuffle? boolean - Toggling shuffle flag. Optional field
- transferringPlayback? boolean - Transfering playback between devices. Optional field
- skippingNext? boolean - Skipping to the next context. Optional field
- pausing? boolean - Pausing. Optional field
- resuming? boolean - Resuming. Optional field
- skippingPrev? boolean - Skipping to the previous context. Optional field
- togglingRepeatContext? boolean - Toggling repeat context flag. Optional field
- interruptingPlayback? boolean - Interrupting playback. Optional field
- seeking? boolean - Seeking playback location. Optional field
- togglingRepeatTrack? boolean - Toggling repeat track flag. Optional field
spotify: EpisodeBase
Fields
- images ImageObject[] - The cover art for the episode in various sizes, widest first
- description string - A description of the episode. HTML tags are stripped away from this field, use
html_descriptionfield in case HTML tags are needed
- restrictions? EpisodeRestrictionObject - Included in the response when a content restriction is applied
- releaseDatePrecision "year"|"month"|"day" - The precision with which
release_datevalue is known
- 'type "episode" - The object type
- htmlDescription string - A description of the episode. This field may contain HTML tags
- uri string - The Spotify URI for the episode
- isExternallyHosted boolean - True if the episode is hosted outside of Spotify's CDN
- audioPreviewUrl string? - A URL to a 30 second preview (MP3 format) of the episode.
nullif not available
- durationMs int - The episode length in milliseconds
- explicit boolean - Whether or not the episode has explicit content (true = yes it does; false = no it does not OR unknown)
- isPlayable boolean - True if the episode is playable in the given market. Otherwise false
- resumePoint? ResumePointObject - The user's most recent position in the episode. Set if the supplied access token is a user token and has the scope 'user-read-playback-position'
- releaseDate string - The date the episode was first released, for example
"1981-12-15". Depending on the precision, it might be shown as"1981"or"1981-12"
- name string - The name of the episode
- href string - A link to the Web API endpoint providing full details of the episode
- id string - The Spotify ID for the episode
- externalUrls ExternalUrlObject - External URLs for this episode
spotify: EpisodeObject
Fields
- Fields Included from *EpisodeBase
- images ImageObject[]
- languages string[]
- description string
- restrictions EpisodeRestrictionObject
- language string
- releaseDatePrecision "year"|"month"|"day"
- type "episode"
- htmlDescription string
- uri string
- isExternallyHosted boolean
- audioPreviewUrl string|()
- durationMs int
- explicit boolean
- isPlayable boolean
- resumePoint ResumePointObject
- releaseDate string
- name string
- href string
- id string
- externalUrls ExternalUrlObject
- anydata...
- show SimplifiedShowObject - The show on which the episode belongs
spotify: EpisodeRestrictionObject
Fields
- reason? string - The reason for the restriction. Supported values:
market- The content item is not available in the given market.product- The content item is not available for the user's subscription type.explicit- The content item is explicit and the user's account is set to not play explicit content.
spotify: ExplicitContentSettingsObject
Fields
- filterLocked? boolean - When
true, indicates that the explicit content setting is locked and can't be changed by the user
- filterEnabled? boolean - When
true, indicates that explicit content should not be played
spotify: ExternalIdObject
Fields
- upc? string - Universal Product Code
spotify: ExternalUrlObject
Fields
- spotify? string - The Spotify URL for the object
spotify: FollowedArtistsResponse
A cursor-paged set of artists
Fields
- artists CursorPagingSimplifiedArtistObject - A cursor-paged set of the artists the current user follows
spotify: FollowersObject
Fields
- total? int - The total number of followers
- href? string? - This will always be set to null, as the Web API does not support it at the moment
spotify: GetAlbumQueries
Represents the Queries record for the operation: getAlbum
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
spotify: GetAudiobookQueries
Represents the Queries record for the operation: getAudiobook
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
spotify: GetChapterQueries
Represents the Queries record for the operation: getChapter
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
spotify: GetCurrentlyPlayingQueries
Represents the Queries record for the operation: getCurrentlyPlaying
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
- additionalTypes? string - A comma-separated list of item types that your client supports besides the default
tracktype. Valid types are:trackandepisode.<br/> Note: This parameter was introduced to allow existing clients to maintain their current behaviour and might be deprecated in the future.<br/> In addition to providing this parameter, make sure that your client properly handles cases of new types in the future by checking against thetypefield of each object.
spotify: GetEpisodeQueries
Represents the Queries record for the operation: getEpisode
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
spotify: GetPlaybackStateQueries
Represents the Queries record for the operation: getPlaybackState
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
- additionalTypes? string - A comma-separated list of item types that your client supports besides the default
tracktype. Valid types are:trackandepisode.<br/> Note: This parameter was introduced to allow existing clients to maintain their current behaviour and might be deprecated in the future.<br/> In addition to providing this parameter, make sure that your client properly handles cases of new types in the future by checking against thetypefield of each object.
spotify: GetPlaylistQueries
Represents the Queries record for the operation: getPlaylist
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
- additionalTypes? string - A comma-separated list of item types that your client supports besides the default
tracktype. Valid types are:trackandepisode.<br/> Note: This parameter was introduced to allow existing clients to maintain their current behaviour and might be deprecated in the future.<br/> In addition to providing this parameter, make sure that your client properly handles cases of new types in the future by checking against thetypefield of each object.
- fields? string - Filters for the query: a comma-separated list of the
fields to return. If omitted, all fields are returned. For example, to get
just the playlist''s description and URI:
fields=description,uri. A dot separator can be used to specify non-reoccurring fields, while parentheses can be used to specify reoccurring fields within objects. For example, to get just the added date and user ID of the adder:fields=tracks.items(added_at,added_by.id). Use multiple parentheses to drill down into nested objects, for example:fields=tracks.items(track(name,href,album(name,href))). Fields can be excluded by prefixing them with an exclamation mark, for example:fields=tracks.items(track(name,href,album(!name,href)))
spotify: GetShowQueries
Represents the Queries record for the operation: getShow
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
spotify: GetTrackQueries
Represents the Queries record for the operation: getTrack
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
spotify: ImageObject
Fields
- width int? - The image width in pixels
- url string - The source URL of the image
- height int? - The image height in pixels
spotify: LinkedTrackObject
Fields
- href? string - A link to the Web API endpoint providing full details of the track
- id? string - The Spotify ID for the track
- 'type? string - The object type: "track"
- externalUrls? ExternalUrlObject - Known external URLs for this track
- uri? string - The Spotify URI for the track
spotify: ListAlbumTracksQueries
Represents the Queries record for the operation: listAlbumTracks
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
- offset int(default 0) - The index of the first item to return. Default: 0 (the first item). Use with limit to get the next set of items.
- 'limit int(default 20) - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
spotify: ListArtistAlbumsQueries
Represents the Queries record for the operation: listArtistAlbums
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
- offset int(default 0) - The index of the first item to return. Default: 0 (the first item). Use with limit to get the next set of items.
- includeGroups? string - A comma-separated list of keywords that will be used to filter the response. If not supplied, all album types will be returned. <br/>
Valid values are:<br/>-
album<br/>-single<br/>-appears_on<br/>-compilation<br/>For example:include_groups=album,single.
- 'limit int(default 5) - The maximum number of items to return. Default: 5. Minimum: 1. Maximum: 10.
spotify: ListAudiobookChaptersQueries
Represents the Queries record for the operation: listAudiobookChapters
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
- offset int(default 0) - The index of the first item to return. Default: 0 (the first item). Use with limit to get the next set of items.
- 'limit int(default 20) - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
spotify: ListCurrentUserPlaylistsQueries
Represents the Queries record for the operation: listCurrentUserPlaylists
Fields
- offset int(default 0) - 'The index of the first playlist to return. Default:
0 (the first object). Maximum offset: 100.000. Use with
limitto get the next set of playlists.'
- 'limit int(default 20) - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
spotify: ListFollowedArtistsQueries
Represents the Queries record for the operation: listFollowedArtists
Fields
- 'limit int(default 20) - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
- after? string - The last artist ID retrieved from the previous request.
- 'type "artist" - The ID type: currently only
artistis supported.
spotify: ListPlaylistItemsQueries
Represents the Queries record for the operation: listPlaylistItems
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
- additionalTypes? string - A comma-separated list of item types that your client supports besides the default
tracktype. Valid types are:trackandepisode.<br/> Note: This parameter was introduced to allow existing clients to maintain their current behaviour and might be deprecated in the future.<br/> In addition to providing this parameter, make sure that your client properly handles cases of new types in the future by checking against thetypefield of each object.
- offset int(default 0) - The index of the first item to return. Default: 0 (the first item). Use with limit to get the next set of items.
- 'limit int(default 20) - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
- fields? string - Filters for the query: a comma-separated list of the
fields to return. If omitted, all fields are returned. For example, to get
just the total number of items and the request limit:<br/>
fields=total,limit<br/>A dot separator can be used to specify non-reoccurring fields, while parentheses can be used to specify reoccurring fields within objects. For example, to get just the added date and user ID of the adder:<br/>fields=items(added_at,added_by.id)<br/>Use multiple parentheses to drill down into nested objects, for example:<br/>fields=items(track(name,href,album(name,href)))<br/>Fields can be excluded by prefixing them with an exclamation mark, for example:<br/>fields=items.track.album(!external_urls,images)
spotify: ListRecentlyPlayedQueries
Represents the Queries record for the operation: listRecentlyPlayed
Fields
- before? int - A Unix timestamp in milliseconds. Returns all items
before (but not including) this cursor position. If
beforeis specified,aftermust not be specified.
- 'limit int(default 20) - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
- after? int - A Unix timestamp in milliseconds. Returns all items
after (but not including) this cursor position. If
afteris specified,beforemust not be specified.
spotify: ListSavedAlbumsQueries
Represents the Queries record for the operation: listSavedAlbums
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
- offset int(default 0) - The index of the first item to return. Default: 0 (the first item). Use with limit to get the next set of items.
- 'limit int(default 20) - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
spotify: ListSavedAudiobooksQueries
Represents the Queries record for the operation: listSavedAudiobooks
Fields
- offset int(default 0) - The index of the first item to return. Default: 0 (the first item). Use with limit to get the next set of items.
- 'limit int(default 20) - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
spotify: ListSavedEpisodesQueries
Represents the Queries record for the operation: listSavedEpisodes
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
- offset int(default 0) - The index of the first item to return. Default: 0 (the first item). Use with limit to get the next set of items.
- 'limit int(default 20) - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
spotify: ListSavedShowsQueries
Represents the Queries record for the operation: listSavedShows
Fields
- offset int(default 0) - The index of the first item to return. Default: 0 (the first item). Use with limit to get the next set of items.
- 'limit int(default 20) - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
spotify: ListSavedTracksQueries
Represents the Queries record for the operation: listSavedTracks
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
- offset int(default 0) - The index of the first item to return. Default: 0 (the first item). Use with limit to get the next set of items.
- 'limit int(default 20) - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
spotify: ListShowEpisodesQueries
Represents the Queries record for the operation: listShowEpisodes
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
- offset int(default 0) - The index of the first item to return. Default: 0 (the first item). Use with limit to get the next set of items.
- 'limit int(default 20) - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
spotify: ListTopItemsQueries
Represents the Queries record for the operation: listTopItems
Fields
- offset int(default 0) - The index of the first item to return. Default: 0 (the first item). Use with limit to get the next set of items.
- timeRange string(default "medium_term") - Over what time frame the affinities are computed. Valid values:
long_term(calculated from ~1 year of data and including all new data as it becomes available),medium_term(approximately last 6 months),short_term(approximately last 4 weeks). Default:medium_term
- 'limit int(default 20) - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
spotify: NarratorObject
Fields
- name? string - The name of the Narrator
spotify: OAuth2RefreshTokenGrantConfig
OAuth2 Refresh Token Grant Configs
Fields
- Fields Included from *OAuth2RefreshTokenGrantConfig
- refreshUrl string(default "https://accounts.spotify.com/api/token") - Refresh URL
spotify: PagingArtistDiscographyAlbumObject
Fields
- Fields Included from *PagingObject
- items? ArtistDiscographyAlbumObject[] -
spotify: PagingArtistObject
Fields
- Fields Included from *PagingObject
- items? ArtistObject[] -
spotify: PagingArtistOrTrackResponse
Pages of artists or tracks
Fields
- Fields Included from *PagingObject
- items? (ArtistObject|TrackObject)[] - The artists or tracks on this page
spotify: PagingObject
Fields
- next string? - URL to the next page of items. (
nullif none)
- total int - The total number of items available to return
- offset int - The offset of the items returned (as set in the query or by default)
- previous string? - URL to the previous page of items. (
nullif none)
- 'limit int - The maximum number of items in the response (as set in the query or by default)
- href string - A link to the Web API endpoint returning the full result of the request
spotify: PagingPlaylistObject
Fields
- Fields Included from *PagingObject
- items? SimplifiedPlaylistObject[] -
spotify: PagingPlaylistTrackObject
Fields
- Fields Included from *PagingObject
- items? PlaylistTrackObject[] -
spotify: PagingSavedAlbumObject
Fields
- Fields Included from *PagingObject
- items? SavedAlbumObject[] -
spotify: PagingSavedEpisodeObject
Fields
- Fields Included from *PagingObject
- items? SavedEpisodeObject[] -
spotify: PagingSavedShowObject
Fields
- Fields Included from *PagingObject
- items? SavedShowObject[] -
spotify: PagingSavedTrackObject
Fields
- Fields Included from *PagingObject
- items? SavedTrackObject[] -
spotify: PagingSimplifiedAlbumObject
Fields
- Fields Included from *PagingObject
- items? SimplifiedAlbumObject[] -
spotify: PagingSimplifiedAudiobookObject
Fields
- Fields Included from *PagingObject
- items? SimplifiedAudiobookObject[] -
spotify: PagingSimplifiedChapterObject
Fields
- Fields Included from *PagingObject
- items? SimplifiedChapterObject[] -
spotify: PagingSimplifiedEpisodeObject
Fields
- Fields Included from *PagingObject
- items? SimplifiedEpisodeObject[] -
spotify: PagingSimplifiedShowObject
Fields
- Fields Included from *PagingObject
- items? SimplifiedShowObject[] -
spotify: PagingSimplifiedTrackObject
Fields
- Fields Included from *PagingObject
- items? SimplifiedTrackObject[] -
spotify: PagingTrackObject
Fields
- Fields Included from *PagingObject
- items? TrackObject[] -
spotify: PausePlaybackQueries
Represents the Queries record for the operation: pausePlayback
Fields
- deviceId? string - The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
spotify: PlayHistoryObject
Fields
- context? ContextObject - The context the track was played from
- playedAt? string - The date and time the track was played
- track? TrackObject - The track the user listened to
spotify: PlaylistObject
Fields
- owner? PlaylistOwnerObject - The user who owns the playlist
- images? ImageObject[] - Images for the playlist. The array may be empty or contain up to three images. The images are returned by size in descending order. See Working with Playlists. Note: If returned, the source URL for the image (
url) is temporary and will expire in less than a day.
- snapshotId? string - The version identifier for the current playlist. Can be supplied in other requests to target a specific playlist version
- collaborative? boolean -
trueif the owner allows other users to modify the playlist
- description? string? - The playlist description. Only returned for modified, verified playlists, otherwise
null
- 'type? string - The object type: "playlist"
- uri? string - The Spotify URI for the playlist
- tracks? PagingPlaylistTrackObject - Deprecated: Use
itemsinstead. The tracks of the playlist
- 'public? boolean - The playlist's public/private status (if it is added to the user's profile):
truethe playlist is public,falsethe playlist is private,nullthe playlist status is not relevant. For more about public/private status, see Working with Playlists
- name? string - The name of the playlist
- href? string - A link to the Web API endpoint providing full details of the playlist
- id? string - The Spotify ID for the playlist
- externalUrls? ExternalUrlObject - Known external URLs for this playlist
- items? PagingPlaylistTrackObject - The items of the playlist. Note: This field is only available for playlists owned by the current user or playlists the user is a collaborator of.
spotify: PlaylistOwnerObject
Fields
- Fields Included from *PlaylistUserObject
- href string
- id string
- type "user"
- externalUrls ExternalUrlObject
- uri string
- anydata...
- displayName? string? - The name displayed on the user's profile.
nullif not available
spotify: PlaylistSnapshotResponse
The snapshot ID of the playlist after the change
Fields
- snapshotId? string - The snapshot ID of the playlist
spotify: PlaylistTrackObject
Fields
- addedAt? string - The date and time the track or episode was added. Note: some very old playlists may return
nullin this field.
- item? TrackObject|EpisodeObject - Information about the track or episode
- addedBy? PlaylistUserObject - The Spotify user who added the track or episode. Note: some very old playlists may return
nullin this field.
- isLocal? boolean - Whether this track or episode is a local file or not
- track? TrackObject|EpisodeObject - Deprecated: Use
iteminstead. Information about the track or episode
spotify: PlaylistTrackReference
Fields
- uri? string - Spotify URI
spotify: PlaylistTracksRefObject
Fields
- total? int - Number of tracks in the playlist
- href? string - A link to the Web API endpoint where full details of the playlist's tracks can be retrieved
spotify: PlaylistUserObject
Fields
- href? string - A link to the Web API endpoint for this user
- id? string - The Spotify user ID for this user
- 'type? "user" - The object type
- externalUrls? ExternalUrlObject - Known public external URLs for this user
- uri? string - The Spotify URI for this user
spotify: PrivateUserObject
Fields
- country? string - The country of the user, as set in the user's account profile. An ISO 3166-1 alpha-2 country code. This field is only available when the current user has granted access to the user-read-private scope.
- images? ImageObject[] - The user's profile image
- product? string - The user's Spotify subscription level: "premium", "free", etc. (The subscription level "open" can be considered the same as "free".) This field is only available when the current user has granted access to the user-read-private scope.
- explicitContent? ExplicitContentSettingsObject - The user's explicit content settings. This field is only available when the current user has granted access to the user-read-private scope.
- displayName? string - The name displayed on the user's profile.
nullif not available
- 'type? string - The object type: "user"
- uri? string - The Spotify URI for the user
- accountId? string - A public, immutable, pseudoanonymous identifier for the user's account. Use this field for account linking rather than the
idfield, as it is stable and will not change over the lifetime of the account
- followers? FollowersObject - Information about the followers of the user
- href? string - A link to the Web API endpoint for this user
- id? string - The Spotify user ID for the user. Do not use this field for account linking — use
account_idinstead, which is immutable
- externalUrls? ExternalUrlObject - Known external URLs for this user
- email? string - The user's email address, as entered by the user when creating their account. Important! This email address is unverified; there is no proof that it actually belongs to the user. This field is only available when the current user has granted access to the user-read-email scope.
spotify: QueueObject
Fields
- currentlyPlaying? TrackObject|EpisodeObject - The currently playing track or episode. Can be
null
- queue? QueueObjectQueue[] - The tracks or episodes in the queue. Can be empty
spotify: RemoveLibraryItemsQueries
Represents the Queries record for the operation: removeLibraryItems
Fields
- uris string - A comma-separated list of Spotify URIs. Maximum: 40 URIs.
Supported URI types:
spotify:track:{id}spotify:album:{id}spotify:episode:{id}spotify:show:{id}spotify:audiobook:{id}spotify:user:{id}spotify:playlist:{id}
spotify: RemovePlaylistItemsRequest
Fields
- snapshotId? string - 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
- items PlaylistTrackReference[] - An array of objects containing Spotify URIs of the tracks or episodes to remove.
For example:
{ "items": [{ "uri": "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" },{ "uri": "spotify:track:1301WleyT98MSxVHPZCA6M" }] }. A maximum of 100 objects can be sent at once
spotify: ResumePointObject
Fields
- fullyPlayed? boolean - Whether or not the episode has been fully played by the user
- resumePositionMs? int - The user's most recent position in the episode in milliseconds
spotify: SavedAlbumObject
Fields
- addedAt? string - The date and time the album was saved Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ. If the time is imprecise (for example, the date/time of an album release), an additional field indicates the precision; see for example, release_date in an album object
- album? AlbumObject - Information about the album
spotify: SavedEpisodeObject
Fields
- addedAt? string - The date and time the episode was saved. Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ
- episode? EpisodeObject - Information about the episode
spotify: SavedShowObject
Fields
- addedAt? string - The date and time the show was saved. Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ. If the time is imprecise (for example, the date/time of an album release), an additional field indicates the precision; see for example, release_date in an album object
- show? SimplifiedShowObject - Information about the show
spotify: SavedTrackObject
Fields
- addedAt? string - The date and time the track was saved. Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ. If the time is imprecise (for example, the date/time of an album release), an additional field indicates the precision; see for example, release_date in an album object
- track? TrackObject - Information about the track
spotify: SaveLibraryItemsQueries
Represents the Queries record for the operation: saveLibraryItems
Fields
- uris string - A comma-separated list of Spotify URIs. Maximum: 40 URIs.
Supported URI types:
spotify:track:{id}spotify:album:{id}spotify:episode:{id}spotify:show:{id}spotify:audiobook:{id}spotify:user:{id}spotify:playlist:{id}
spotify: SearchItemsQueries
Represents the Queries record for the operation: searchItems
Fields
- market? string - An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.<br/> If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.<br/> Note: If neither market or user country are provided, the content is considered unavailable for the client.<br/> Users can view the country that is associated with their account in the account settings.
- q string - Your search query.
You can narrow down your search using field filters. The available filters are
album,artist,track,year,upc,tag:hipster,tag:new,isrc, andgenre. Each field filter only applies to certain result types. Theartistandyearfilters can be used while searching albums, artists and tracks. You can filter on a singleyearor a range (e.g. 1955-1960).<br /> Thealbumfilter can be used while searching albums and tracks.<br /> Thegenrefilter can be used while searching artists and tracks.<br /> Theisrcandtrackfilters can be used while searching tracks.<br /> Theupc,tag:newandtag:hipsterfilters can only be used while searching albums. Thetag:newfilter will return albums released in the past two weeks andtag:hipstercan be used to return only albums with the lowest 10% popularity.<br />
- offset int(default 0) - The index of the first result to return. Use with limit to get the next page of search results.
- includeExternal? "audio" - If
include_external=audiois specified it signals that the client can play externally hosted audio content, and marks the content as playable in the response. By default externally hosted audio content is marked as unplayable in the response.
- 'limit int(default 5) - The maximum number of results to return in each item type.
- 'type ("album"|"artist"|"playlist"|"track"|"show"|"episode"|"audiobook")[] - A comma-separated list of item types to search across. Search results include hits
from all the specified item types. For example:
q=abacab&type=album,trackreturns both albums and tracks matching "abacab".
spotify: SearchResultsResponse
Search results grouped by item type
Fields
- albums? PagingSimplifiedAlbumObject - A page of albums matching the search query
- shows? PagingSimplifiedShowObject - A page of shows matching the search query
- artists? PagingArtistObject - A page of artists matching the search query
- audiobooks? PagingSimplifiedAudiobookObject - A page of audiobooks matching the search query
- playlists? PagingPlaylistObject - A page of playlists matching the search query
- tracks? PagingTrackObject - A page of tracks matching the search query
- episodes? PagingSimplifiedEpisodeObject - A page of episodes matching the search query
spotify: SeekToPositionQueries
Represents the Queries record for the operation: seekToPosition
Fields
- positionMs int - The position in milliseconds to seek to. Must be a positive number. Passing in a position that is greater than the length of the track will cause the player to start playing the next song.
- deviceId? string - The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
spotify: SetPlaybackVolumeQueries
Represents the Queries record for the operation: setPlaybackVolume
Fields
- deviceId? string - The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
- volumePercent int - The volume to set. Must be a value from 0 to 100 inclusive.
spotify: SetRepeatModeQueries
Represents the Queries record for the operation: setRepeatMode
Fields
- deviceId? string - The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
- state string - track, context or off.<br/> track will repeat the current track.<br/> context will repeat the current context.<br/> off will turn repeat off.
spotify: SetShuffleQueries
Represents the Queries record for the operation: setShuffle
Fields
- deviceId? string - The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
- state boolean - true : Shuffle user's playback.<br/> false : Do not shuffle user's playback.
spotify: ShowBase
Fields
- images ImageObject[] - The cover art for the show in various sizes, widest first
- copyrights CopyrightObject[] - The copyright statements of the show
- availableMarkets string[] - A list of the countries in which the show can be played, identified by their ISO 3166-1 alpha-2 code
- description string - A description of the show. HTML tags are stripped away from this field, use
html_descriptionfield in case HTML tags are needed
- 'type "show" - The object type
- htmlDescription string - A description of the show. This field may contain HTML tags
- uri string - The Spotify URI for the show
- isExternallyHosted boolean - True if all of the shows episodes are hosted outside of Spotify's CDN. This field might be
nullin some cases
- totalEpisodes int - The total number of episodes in the show
- explicit boolean - Whether or not the show has explicit content (true = yes it does; false = no it does not OR unknown)
- mediaType string - The media type of the show
- name string - The name of the episode
- publisher string - The publisher of the show
- href string - A link to the Web API endpoint providing full details of the show
- id string - The Spotify ID for the show
- externalUrls ExternalUrlObject - External URLs for this show
spotify: ShowObject
Fields
- Fields Included from *ShowBase
- images ImageObject[]
- languages string[]
- copyrights CopyrightObject[]
- availableMarkets string[]
- description string
- type "show"
- htmlDescription string
- uri string
- isExternallyHosted boolean
- totalEpisodes int
- explicit boolean
- mediaType string
- name string
- publisher string
- href string
- id string
- externalUrls ExternalUrlObject
- anydata...
- episodes PagingSimplifiedEpisodeObject - The episodes of the show
spotify: SimplifiedAlbumObject
Fields
- Fields Included from *AlbumBase
- images ImageObject[]
- availableMarkets string[]
- restrictions AlbumRestrictionObject
- releaseDatePrecision "year"|"month"|"day"
- type "album"
- uri string
- totalTracks int
- releaseDate string
- name string
- albumType "album"|"single"|"compilation"
- href string
- id string
- externalUrls ExternalUrlObject
- anydata...
- artists SimplifiedArtistObject[] - The artists of the album. Each artist object includes a link in
hrefto more detailed information about the artist
spotify: SimplifiedArtistObject
Fields
- name? string - The name of the artist
- href? string - A link to the Web API endpoint providing full details of the artist
- id? string - The Spotify ID for the artist
- 'type? "artist" - The object type
- externalUrls? ExternalUrlObject - Known external URLs for this artist
- uri? string - The Spotify URI for the artist
spotify: SimplifiedAudiobookObject
Fields
- Fields Included from *AudiobookBase
- images ImageObject[]
- languages string[]
- copyrights CopyrightObject[]
- availableMarkets string[]
- description string
- edition string
- type "audiobook"
- htmlDescription string
- uri string
- explicit boolean
- mediaType string
- name string
- totalChapters int
- publisher string
- href string
- id string
- externalUrls ExternalUrlObject
- authors AuthorObject[]
- narrators NarratorObject[]
- anydata...
spotify: SimplifiedChapterObject
Fields
- Fields Included from *ChapterBase
- images ImageObject[]
- languages string[]
- chapterNumber int
- availableMarkets string[]
- description string
- restrictions ChapterRestrictionObject
- releaseDatePrecision "year"|"month"|"day"
- type "episode"
- htmlDescription string
- uri string
- audioPreviewUrl string|()
- durationMs int
- explicit boolean
- isPlayable boolean
- resumePoint ResumePointObject
- releaseDate string
- name string
- href string
- id string
- externalUrls ExternalUrlObject
- anydata...
spotify: SimplifiedEpisodeObject
Fields
- Fields Included from *EpisodeBase
- images ImageObject[]
- languages string[]
- description string
- restrictions EpisodeRestrictionObject
- language string
- releaseDatePrecision "year"|"month"|"day"
- type "episode"
- htmlDescription string
- uri string
- isExternallyHosted boolean
- audioPreviewUrl string|()
- durationMs int
- explicit boolean
- isPlayable boolean
- resumePoint ResumePointObject
- releaseDate string
- name string
- href string
- id string
- externalUrls ExternalUrlObject
- anydata...
spotify: SimplifiedPlaylistObject
Fields
- owner? PlaylistOwnerObject - The user who owns the playlist
- images? ImageObject[] - Images for the playlist. The array may be empty or contain up to three images. The images are returned by size in descending order. See Working with Playlists. Note: If returned, the source URL for the image (
url) is temporary and will expire in less than a day.
- snapshotId? string - The version identifier for the current playlist. Can be supplied in other requests to target a specific playlist version
- collaborative? boolean -
trueif the owner allows other users to modify the playlist
- description? string - The playlist description. Only returned for modified, verified playlists, otherwise
null
- 'type? string - The object type: "playlist"
- uri? string - The Spotify URI for the playlist
- tracks? PlaylistTracksRefObject - Deprecated: Use
itemsinstead. A collection containing a link (href) to the Web API endpoint where full details of the playlist's tracks can be retrieved, along with thetotalnumber of tracks in the playlist. Note, a track object may benull. This can happen if a track is no longer available
- 'public? boolean - The playlist's public/private status (if it is added to the user's profile):
truethe playlist is public,falsethe playlist is private,nullthe playlist status is not relevant. For more about public/private status, see Working with Playlists
- name? string - The name of the playlist
- href? string - A link to the Web API endpoint providing full details of the playlist
- id? string - The Spotify ID for the playlist
- externalUrls? ExternalUrlObject - Known external URLs for this playlist
- items? PlaylistTracksRefObject - A collection containing a link (
href) to the Web API endpoint where full details of the playlist's items can be retrieved, along with thetotalnumber of items in the playlist. Note, a track object may benull. This can happen if a track is no longer available
spotify: SimplifiedShowObject
Fields
- Fields Included from *ShowBase
- images ImageObject[]
- languages string[]
- copyrights CopyrightObject[]
- availableMarkets string[]
- description string
- type "show"
- htmlDescription string
- uri string
- isExternallyHosted boolean
- totalEpisodes int
- explicit boolean
- mediaType string
- name string
- publisher string
- href string
- id string
- externalUrls ExternalUrlObject
- anydata...
spotify: SimplifiedTrackObject
Fields
- discNumber? int - The disc number (usually
1unless the album consists of more than one disc)
- availableMarkets? string[] - A list of the countries in which the track can be played, identified by their ISO 3166-1 alpha-2 code
- restrictions? TrackRestrictionObject - Included in the response when a content restriction is applied
- 'type? string - The object type: "track"
- uri? string - The Spotify URI for the track
- durationMs? int - The track length in milliseconds
- explicit? boolean - Whether or not the track has explicit lyrics (
true= yes it does;false= no it does not OR unknown)
- isPlayable? boolean - Part of the response when Track Relinking is applied. If
true, the track is playable in the given market. Otherwisefalse
- artists? SimplifiedArtistObject[] - The artists who performed the track. Each artist object includes a link in
hrefto more detailed information about the artist
- linkedFrom? LinkedTrackObject - Part of the response when Track Relinking is applied and is only part of the response if the track linking, in fact, exists. The requested track has been replaced with a different track. The track in the
linked_fromobject contains information about the originally requested track
- previewUrl? string? - A URL to a 30 second preview (MP3 format) of the track
- name? string - The name of the track
- trackNumber? int - The number of the track. If an album has several discs, the track number is the number on the specified disc
- href? string - A link to the Web API endpoint providing full details of the track
- id? string - The Spotify ID for the track
- isLocal? boolean - Whether or not the track is from a local file
- externalUrls? ExternalUrlObject - External URLs for this track
spotify: SkipToNextQueries
Represents the Queries record for the operation: skipToNext
Fields
- deviceId? string - The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
spotify: SkipToPreviousQueries
Represents the Queries record for the operation: skipToPrevious
Fields
- deviceId? string - The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
spotify: StartPlaybackQueries
Represents the Queries record for the operation: startPlayback
Fields
- deviceId? string - The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
spotify: StartPlaybackRequest
Fields
- context_uri? record {} - Optional. Spotify URI of the context to play.
Valid contexts are albums, artists & playlists.
{context_uri:"spotify:album:1Je1IMUlBXcx1Fz0WE7oPT"}
- uris? string[] - Optional. A JSON array of the Spotify track URIs to play.
For example:
{"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "spotify:track:1301WleyT98MSxVHPZCA6M"]}
- offset? record {} - Optional. Indicates from where in the context playback should start. Only available when context_uri corresponds to an album or playlist object
"position" is zero based and can’t be negative. Example:
"offset": {"position": 5}"uri" is a string representing the uri of the item to start at. Example:"offset": {"uri": "spotify:track:1301WleyT98MSxVHPZCA6M"}
- position_ms? record {} - integer
spotify: TrackObject
Fields
- discNumber? int - The disc number (usually
1unless the album consists of more than one disc)
- album? SimplifiedAlbumObject - The album on which the track appears. The album object includes a link in
hrefto full information about the album
- availableMarkets? string[] - A list of the countries in which the track can be played, identified by their ISO 3166-1 alpha-2 code
- restrictions? TrackRestrictionObject - Included in the response when a content restriction is applied
- 'type? "track" - The object type: "track"
- externalIds? ExternalIdObject - Known external IDs for the track
- uri? string - The Spotify URI for the track
- durationMs? int - The track length in milliseconds
- explicit? boolean - Whether or not the track has explicit lyrics (
true= yes it does;false= no it does not OR unknown)
- isPlayable? boolean - Part of the response when Track Relinking is applied. If
true, the track is playable in the given market. Otherwisefalse
- artists? SimplifiedArtistObject[] - The artists who performed the track. Each artist object includes a link in
hrefto more detailed information about the artist
- linkedFrom? record {} - Part of the response when Track Relinking is applied, and the requested track has been replaced with different track. The track in the
linked_fromobject contains information about the originally requested track
- previewUrl? string? - A link to a 30 second preview (MP3 format) of the track. Can be
null
- popularity? int - The popularity of the track. The value will be between 0 and 100, with 100 being the most popular.<br/>The popularity of a track is a value between 0 and 100, with 100 being the most popular. The popularity is calculated by algorithm and is based, in the most part, on the total number of plays the track has had and how recent those plays are.<br/>Generally speaking, songs that are being played a lot now will have a higher popularity than songs that were played a lot in the past. Duplicate tracks (e.g. the same track from a single and an album) are rated independently. Artist and album popularity is derived mathematically from track popularity. Note: the popularity value may lag actual popularity by a few days: the value is not updated in real time.
- name? string - The name of the track
- trackNumber? int - The number of the track. If an album has several discs, the track number is the number on the specified disc
- href? string - A link to the Web API endpoint providing full details of the track
- id? string - The Spotify ID for the track
- isLocal? boolean - Whether or not the track is from a local file
- externalUrls? ExternalUrlObject - Known external URLs for this track
spotify: TrackRestrictionObject
Fields
- reason? string - The reason for the restriction. Supported values:
market- The content item is not available in the given market.product- The content item is not available for the user's subscription type.explicit- The content item is explicit and the user's account is set to not play explicit content.
spotify: TransferPlaybackRequest
Fields
- device_ids string[] - A JSON array containing the ID of the device on which playback should be started/transferred.<br/>For example:
{device_ids:["74ASZWbe4lXaubB36ztrGX"]}<br/>Note: Although an array is accepted, only a single device_id is currently supported. Supplying more than one will return400 Bad Request
- play? record {} - true: ensure playback happens on new device.<br/>false or not provided: keep the current playback state.
spotify: UpdatePlaylistDetailsRequest
Fields
- name? string - The new name for the playlist, for example
"My New Playlist Title"
- 'public? boolean - The playlist's public/private status (if it should be added to the user's profile or not):
truethe playlist will be public,falsethe playlist will be private,nullthe playlist status is not relevant. For more about public/private status, see Working with Playlists
- collaborative? boolean - If
true, the playlist will become collaborative and other users will be able to modify the playlist in their Spotify client. <br/> Note: You can only setcollaborativetotrueon non-public playlists.
- description? string - Value for playlist description as displayed in Spotify Clients and in the Web API.
spotify: UpdatePlaylistItemsQueries
Represents the Queries record for the operation: updatePlaylistItems
Fields
- uris? string - A comma-separated list of Spotify URIs to set, can be track or episode URIs. For example:
uris=spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:track:1301WleyT98MSxVHPZCA6M,spotify:episode:512ojhOuo1ktJprKbVcKyQ<br/>A maximum of 100 items can be set in one request.
spotify: UpdatePlaylistItemsRequest
Fields
- uris? string[] -
- range_start? int - The position of the first item to be reordered.
- insert_before? int - The position where the items should be inserted.<br/>To reorder the items to the end of the playlist, simply set insert_before to the position after the last item.<br/>Examples:<br/>To reorder the first item to the last position in a playlist with 10 items, set range_start to 0, and insert_before to 10.<br/>To reorder the last item in a playlist with 10 items to the start of the playlist, set range_start to 9, and insert_before to 0.
- range_length? int - The amount of items to be reordered. Defaults to 1 if not set.<br/>The range of items to be reordered begins from the range_start position, and includes the range_length subsequent items.<br/>Example:<br/>To move the items at index 9-10 to the start of the playlist, range_start is set to 9, and range_length is set to 2.
- snapshot_id? string - The playlist's snapshot ID against which you want to make the changes.
Union types
spotify: QueueObjectQueue
QueueObjectQueue
Import
import ballerinax/spotify;Metadata
Released date: 1 day ago
Version: 2.0.0
License: Apache-2.0
Security
Direct vulnerabilities: No known direct vulnerabilities
Indirect vulnerabilities:
Checked on 2026-11-23 via OSV.dev
Compatibility
Platform: any
Ballerina version: 2201.12.0
GraalVM compatible: Yes
Pull count
Total: 2303
Current verison: 1
Weekly downloads
Keywords
Type/Connector
Vendor/Spotify
Area/Productivity & Collaboration
Contributors