Spotify API Client for making requests to the Spotify Web API.

Hierarchy

  • SpotifyAPI

Constructors

Properties

Methods

addToMySavedAlbums addToMySavedShows addToMySavedTracks addToPlaylist addTracksToPlaylist addTracksToPlaylistWithIDs areFollowingPlaylist changePlaylistDetails clearPlaylist containsMySavedAlbums containsMySavedShows containsMySavedTracks createPlaylist followArtists followPlaylist followUsers getAlbum getAlbumTracks getAlbums getApiUrl getArtist getArtistAlbums getArtistRelatedArtists getArtistTopTracks getArtists getAudioAnalysisForTrack getAudioFeaturesForTrack getAudioFeaturesForTracks getAvailableGenreSeeds getCategories getCategory getCategoryPlaylists getEpisode getEpisodes getFeaturedPlaylists getFollowedArtists getMe getMyCurrentPlaybackState getMyCurrentPlayingTrack getMyDevices getMyPlaylists getMyRecentlyPlayedTracks getMySavedAlbums getMySavedShows getMySavedTracks getMyTopArtists getMyTopTracks getNewReleases getPlaylist getPlaylistCoverImage getPlaylistTracks getRecommendations getShow getShowEpisodes getShows getTrack getTracks getUser getUserPlaylists isFollowingArtists isFollowingUsers pause play queue removeFromMySavedAlbums removeFromMySavedShows removeFromMySavedTracks removeFromPlaylist removeFromPlaylistInPositions removeItemsFromPlaylistWithSnapshotID removeTracksFromPlaylist removeTracksFromPlaylistWithIDs reorderItemsInPlaylist replacePlaylistItems replacePlaylistItemsWithTrackIDs replacePlaylistItemsWithTracks request search searchAlbums searchArtists searchEpisodes searchPlaylists searchShows searchTracks seek setCustomFetch setRepeat setShuffle setVolume skipToNext skipToPrevious transferMyPlayback unfollowArtists unfollowPlaylist unfollowUsers uploadCustomPlaylistCoverImage

Constructors

Properties

auth: Auth

Methods

  • Save one or more albums to the current user's "Your Music" library.

    See

    Save Albums for Current User

    Parameters

    • albumIDs: string[]

      The ids of the albums.

    Returns Promise<SaveAlbumsForUserResponse>

  • Adds a list of shows to the current user's saved shows.

    See

    Save Shows for Current User

    Parameters

    • showIDs: string[]

      The ids of the shows.

    Returns Promise<SaveShowsForUserResponse>

  • Adds a list of tracks to the current user's saved tracks.

    See

    Save Tracks for Current User

    Parameters

    • trackIDs: string[]

      The ids of the tracks.

    Returns Promise<UsersSavedTracksResponse>

  • Add items to a playlist.

    See

    Add Items to a Playlist

    Parameters

    • playlistID: string

      The id of the playlist.

    • itemURIs: string[]

      A list of Spotify URIs for the items to be added.

    Returns Promise<AddTracksToPlaylistResponse>

  • Add tracks to a playlist.

    See

    Add Tracks to a Playlist

    See

    addToPlaylist for adding any items.

    Remarks

    This method is a convenience method for addToPlaylist.

    Parameters

    • playlistID: string

      The id of the playlist.

    • trackURIs: string[]

      A list of Spotify URIs for the tracks.

    Returns Promise<AddTracksToPlaylistResponse>

  • Add tracks to a playlist using Spotify IDs.

    See

    Add Tracks to a Playlist

    See

    Remarks

    This method is a convenience method for addToPlaylist.

    Parameters

    • playlistID: string

      The id of the playlist.

    • trackIDs: string[]

      A list of Spotify IDs for the tracks.

    Returns Promise<AddTracksToPlaylistResponse>

  • Check to see if one or more Spotify users are following a specified playlist.

    See

    Check if Users Follow a Playlist

    Parameters

    • playlistID: string

      The id of the playlist.

    • userIDs: string[]

      The ids of the users.

    Returns Promise<UsersFollowPlaylistResponse>

  • Change a playlist's name and public/private state

    See

    Change a Playlist's Details

    Parameters

    • playlistID: string

      The id of the playlist.

    • options: PlaylistOptions

      The options for changing the playlist details.

    Returns Promise<ChangePlaylistDetailsResponse>

  • Remove all items from a playlist

    See

    Replace a Playlist's Tracks

    Parameters

    • playlistID: string

      The id of the playlist.

    Returns Promise<ReplacePlaylistTracksResponse>

  • Check if one or more albums is already saved in the current Spotify user's "Your Music" library.

    See

    Check User's Saved Albums

    Parameters

    • albumIDs: string[]

      The ids of the albums.

    Returns Promise<CheckUserSavedAlbumsResponse>

  • Checks if the current user's saved shows contains a certain list of shows.

    See

    Check Current User's Saved Shows

    Parameters

    • showIDs: string[]

      The ids of the shows.

    Returns Promise<CheckUserSavedShowsResponse>

  • Checks if the current user's saved tracks contains a certain list of tracks.

    See

    Check Current User's Saved Tracks

    Parameters

    • trackIDs: string[]

      The ids of the tracks.

    Returns Promise<CheckUsersSavedTracksResponse>

  • Creates a playlist and stores it in the current user's library.

    See

    Create a Playlist

    Parameters

    • userID: string

      The id of the user.

    • options: PlaylistOptions

      Options for playlist creation.

    Returns Promise<CreatePlaylistResponse>

  • Adds the current user as a follower of one or more artists.

    See

    Follow Artists or Users

    Parameters

    • artistIDs: string[]

      The ids of the artists.

    Returns Promise<FollowArtistsOrUsersResponse>

  • Add the current user as a follower of one playlist.

    See

    Follow a Playlist

    Parameters

    • playlistID: string

      The id of the playlist.

    Returns Promise<FollowPlaylistResponse>

  • Adds the current user as a follower of one or more other Spotify users.

    See

    Follow Artists or Users

    Parameters

    • userIDs: string[]

      The ids of the users.

    Returns Promise<FollowArtistsOrUsersResponse>

  • Fetches an album from the Spotify catalog.

    See

    Get an Album

    Parameters

    • albumID: string

      The id of the album.

    Returns Promise<SingleAlbumResponse>

  • Fetches the tracks of an album from the Spotify catalog.

    See

    Get an Album's Tracks

    Parameters

    • albumID: string

      The id of the album.

    Returns Promise<AlbumTracksResponse>

  • Fetches multiple albums from the Spotify catalog.

    See

    Get Several Albums

    Parameters

    • albumIDs: string[]

      The ids of the albums.

    Returns Promise<MultipleAlbumsResponse>

  • Get the set API URL.

    Returns string

  • Fetches an artist from the Spotify catalog.

    See

    Get an Artist

    Parameters

    • artistID: string

      The id of the artist.

    Returns Promise<SingleArtistResponse>

  • Fetches the albums of an artist from the Spotify catalog.

    See

    Get an Artist's Albums

    Parameters

    • artistID: string

      The id of the artist.

    Returns Promise<ArtistsAlbumsResponse>

  • Fetches a list of artists related with a given one from the Spotify catalog.

    See

    Get an Artist's Related Artists

    Parameters

    • artistID: string

      The id of the artist.

    Returns Promise<ArtistsRelatedArtistsResponse>

  • Fetches a list of top tracks of an artist from the Spotify catalog, for a specific country.

    See

    Get an Artist's Top Tracks

    Parameters

    • artistID: string

      The id of the artist. If you know the Spotify URI it is easy to find the

    • countryID: string

      The id of the country (e.g. ES for Spain or US for United States)

    Returns Promise<ArtistsTopTracksResponse>

  • Fetches multiple artists from the Spotify catalog.

    See

    Get Several Artists

    Parameters

    • artistIDs: string[]

      The ids of the artists.

    Returns Promise<MultipleArtistsResponse>

  • Get audio analysis for a single track identified by its unique Spotify ID.

    See

    Get Audio Analysis for a Track

    Parameters

    • trackID: string

      The id of the track.

    Returns Promise<AudioAnalysisTrack>

  • Get audio features for a single track identified by its unique Spotify ID.

    See

    Get Audio Features for a Track

    Parameters

    • trackID: string

      The id of the track.

    Returns Promise<AudioFeaturesResponse>

  • Get audio features for multiple tracks based on their Spotify IDs.

    See

    Get Audio Features for Several Tracks

    Parameters

    • trackIDs: string[]

      The ids of the tracks.

    Returns Promise<MultipleAudioFeaturesResponse>

  • Retrieve a list of available genres seed parameter values for recommendations.

    See

    Available Genre Seeds

    Returns Promise<AvailableGenreSeedsResponse>

  • Get a list of categories used to tag items in Spotify (on, for example, the Spotify player's "Browse" tab).

    See

    Get a List of Categories

    Returns Promise<MultipleCategoriesResponse>

  • Get a single category used to tag items in Spotify (on, for example, the Spotify player's "Browse" tab).

    See

    Get a Category

    Parameters

    • categoryID: string

      The id of the category. These can be found with the getCategories function.

    Returns Promise<SingleCategoryResponse>

  • Get a list of Spotify playlists tagged with a particular category.

    See

    Get a Category's Playlists

    Parameters

    • categoryID: string

      The id of the category. These can be found with the getCategories function.

    Returns Promise<CategoryPlaylistsResponse>

  • Fetches an episode from the Spotify catalog.

    See

    Get an Episode

    Parameters

    • episodeID: string

      The id of the episode.

    • Optional market: string

    Returns Promise<EpisodeObject>

  • Fetches multiple episodes from the Spotify catalog.

    See

    Get Several Episodes

    Parameters

    • episodeIDs: string[]

      The ids of the episodes.

    • Optional market: string

    Returns Promise<MultipleEpisodesResponse>

  • Fetches a list of Spotify featured playlists (shown, for example, on a Spotify player's "Browse" tab).

    See

    Get a List of Featured Playlists

    Returns Promise<ListOfFeaturedPlaylistsResponse>

  • Get detailed profile information about the current user (including the current user's username).

    See

    Get Current User's Profile

    Returns Promise<UserProfileResponse>

  • Get the current user’s top artists based on calculated affinity.

    See

    Get a User’s Top Artists

    Returns Promise<UsersTopArtistsResponse>

  • Get the current user’s top tracks based on calculated affinity.

    See

    Get a User’s Top Tracks

    Returns Promise<UsersTopTracksResponse>

  • Fetches a list of new album releases featured in Spotify (shown, for example, on a Spotify player's "Browse" tab).

    See

    Get a List of New Releases

    Returns Promise<ListOfNewReleasesResponse>

  • Fetches a specific playlist.

    See

    Get a Playlist

    Parameters

    • playlistID: string

      The id of the playlist.

    Returns Promise<SinglePlaylistResponse>

  • Gets the current image associated with a specific playlist.

    See

    Get a Playlist Cover Image

    Parameters

    • playlistID: string

      The id of the playlist.

    Returns Promise<PlaylistCoverImageResponse>

  • Fetches the tracks from a specific playlist.

    See

    Get a Playlist's Tracks

    Parameters

    • playlistID: string

      The id of the playlist.

    Returns Promise<PlaylistTrackResponse>

  • Create a playlist-style listening experience based on seed artists, tracks and genres.

    See

    Get Recommendations Based on Seeds

    Parameters

    • options: RecommendationsOptionsObject

      An object with optional keys limit, market, min_*, etc...

    Returns Promise<RecommendationsFromSeedsResponse>

  • Fetches a show from the Spotify catalog.

    See

    Get a Show

    Parameters

    • showID: string

      The id of the show.

    • Optional market: string

    Returns Promise<ShowObject>

  • Fetches the episodes of a show from the Spotify catalog.

    See

    Get a Show's Episodes

    Parameters

    • showID: string

      The id of the show.

    • Optional market: string

    Returns Promise<ShowEpisodesResponse>

  • Fetches multiple shows from the Spotify catalog.

    See

    Get Several Shows

    Parameters

    • showIDs: string[]

      The ids of the shows.

    • Optional market: string

    Returns Promise<MultipleShowsResponse>

  • Fetches a track from the Spotify catalog.

    See

    Get a Track

    Parameters

    • trackID: string

      The id of the track.

    Returns Promise<SingleTrackResponse>

  • Fetches multiple tracks from the Spotify catalog.

    See

    Get Several Tracks

    Parameters

    • trackIDs: string[]

      The ids of the tracks.

    Returns Promise<MultipleTracksResponse>

  • Fetches information about a specific user.

    See

    Get a User's Profile

    Parameters

    • userID: string

      The id of the user.

    Returns Promise<UserProfileResponse>

  • Fetches a list of a user's playlists.

    See

    Get a List of a User's Playlists

    Parameters

    • userID: string

      The id of the user.

    Returns Promise<ListOfUsersPlaylistsResponse>

  • Checks to see if the current user is following one or more artists.

    See

    Check if Current User Follows

    Parameters

    • artistIDs: string[]

      The ids of the artists.

    Returns Promise<UserFollowsUsersOrArtistsResponse>

  • Checks to see if the current user is following one or more other Spotify users.

    See

    Check if Current User Follows Users or Artists

    Parameters

    • userIDs: string[]

      The ids of the users.

    Returns Promise<UserFollowsUsersOrArtistsResponse>

  • Remove one or more albums from the current user's "Your Music" library.

    See

    Remove Albums for Current User

    Parameters

    • albumIDs: string[]

      The ids of the albums.

    Returns Promise<RemoveAlbumsForUserResponse>

  • Remove a list of shows from the current user's saved shows.

    See

    Remove Shows for Current User

    Parameters

    • showIDs: string[]

      The ids of the shows.

    Returns Promise<RemoveShowsForUserResponse>

  • Remove a list of tracks from the current user's saved tracks.

    See

    Remove Tracks for Current User

    Parameters

    • trackIDs: string[]

      The ids of the tracks.

    Returns Promise<RemoveUsersSavedTracksResponse>

  • Remove items from a playlist

    See

    Remove Tracks from a Playlist

    Parameters

    • playlistID: string

      The id of the playlist.

    • itemURIs: string[]

      A list of items to be removed.

    Returns Promise<RemoveTracksFromPlaylistResponse>

  • Remove items from a playlist, specifying the positions of the items to be removed.

    See

    Remove Tracks from a Playlist

    Parameters

    • playlistID: string

      The id of the playlist.

    • positions: number[]

      A list of integers containing the positions of the items to remove from the playlist.

    • snapshotID: string

      The playlist's snapshot ID against which you want to make the changes

    Returns Promise<RemoveTracksFromPlaylistResponse>

  • Remove tracks from a playlist, specifying a snapshot id.

    See

    Remove Tracks from a Playlist

    Parameters

    • playlistID: string

      The id of the playlist.

    • itemURIs: string[]

      A list of tracks to be removed.

    • snapshotID: string

      The playlist's snapshot ID against which you want to make the changes

    Returns Promise<RemoveTracksFromPlaylistResponse>

  • Remove tracks from a playlist.

    See

    Remove Tracks from a Playlist

    See

    removeFromPlaylist for removing any items.

    Remarks

    This method is a convenience method for removeFromPlaylist.

    Parameters

    • playlistID: string

      The id of the playlist.

    • trackURIs: string[]

      A list of tracks to be removed.

    Returns Promise<RemoveTracksFromPlaylistResponse>

  • Remove tracks from a playlist.

    See

    Remove Tracks from a Playlist

    See

    removeFromPlaylist for removing any items.

    Remarks

    This method is a convenience method for removeFromPlaylist.

    Parameters

    • playlistID: string

      The id of the playlist.

    • trackIDs: string[]

      A list of tracks to be removed.

    Returns Promise<RemoveTracksFromPlaylistResponse>

  • Reorder items in a playlist

    See

    Reorder a Playlist’s Tracks

    Parameters

    • playlistID: string

      The id of the playlist.

    • rangeStart: number

      The position of the first track to be reordered.

    • insertBefore: number

      The position where the tracks should be inserted. To reorder the tracks to the end of the playlist, simply set insert_before to the position after the last track.

    • Optional rangeLength: number
    • Optional snapshotID: number

      The playlist’s snapshot ID against which you want to make the changes.

    Returns Promise<ReorderPlaylistTracksResponse>

  • Replace the items in a playlist with a list of items.

    See

    Replace a Playlist's Tracks

    Parameters

    • playlistID: string

      The id of the playlist.

    • itemURIs: string[]

      A list of Spotify URIs for the items

    Returns Promise<ReplacePlaylistTracksResponse>

  • Replace the items in a playlist with a list of tracks.

    See

    Replace a Playlist's Tracks

    See

    replacePlaylist for replacing with any items.

    Remarks

    This method is a convenience method for replaceInPlaylist.

    Parameters

    • playlistID: string

      The id of the playlist.

    • trackURIs: string[]

      A list of Spotify URIs for the tracks

    Returns Promise<ReplacePlaylistTracksResponse>

  • Make a request to the Spotify API. This method is used internally by the other methods but can be called directly if you want to make a request that is not yet implemented or modify an existing request.

    Remarks

    The method will automatically refresh the access token if it is expired, unless the refreshExpiredAccessToken option is set to false. It will also make GET requests by default if no method is specified.

    Parameters

    • options: string | SpotifyRequestOptions

      The options for the request to the Spotify API. A url as a string can be specified instead to make GET request to the specified url.

    Returns Promise<any>

  • Get Spotify catalog information about artists, albums, tracks or playlists that match a keyword string.

    See

    Search for an Item

    Parameters

    • query: string

      The search query

    • types: string[]

      A list of item types to search across. Valid types are: 'album', 'artist', 'playlist', and 'track'.

    Returns Promise<any>

  • Fetches albums from the Spotify catalog according to a query.

    See

    Search for an Item

    Parameters

    • query: string

      The search query

    Returns Promise<AlbumSearchResponse>

  • Fetches artists from the Spotify catalog according to a query.

    See

    Search for an Item

    Parameters

    • query: string

      The search query

    Returns Promise<ArtistSearchResponse>

  • Fetches episodes from the Spotify catalog according to a query.

    See

    Search for an Item

    Parameters

    • query: string

      The search query

    Returns Promise<EpisodeSearchResponse>

  • Fetches playlists from the Spotify catalog according to a query.

    See

    Search for an Item

    Parameters

    • query: string

      The search query

    Returns Promise<PlaylistSearchResponse>

  • Fetches shows from the Spotify catalog according to a query.

    See

    Search for an Item

    Parameters

    • query: string

      The search query

    Returns Promise<ShowSearchResponse>

  • Fetches tracks from the Spotify catalog according to a query.

    See

    Search for an Item

    Parameters

    • query: string

      The search query

    Returns Promise<TrackSearchResponse>

  • Set the API client to use a custom fetch implementation.

    Parameters

    • fetch: any

      A custom fetch implementation.

    Returns void

  • Skips to previous track in the user’s queue. Note that this will ALWAYS skip to the previous track, regardless of the current track’s progress. Returning to the start of the current track should be performed using .seek()

    See

    Skip User’s Playback To Previous Track

    Parameters

    • options: DeviceOptions

      An object with options that can be passed.

    Returns Promise<any>

  • Transfer playback to a new device and determine if it should start playing.

    See

    Transfer a User’s Playback

    Parameters

    • deviceID: string

      The ID of the device on which playback should be started/transferred.

    Returns Promise<any>

  • Removes the current user as a follower of one or more artists.

    See

    Unfollow Artists or Users

    Parameters

    • artistIDs: string[]

      The ids of the artists.

    Returns Promise<UnfollowArtistsOrUsersResponse>

  • Remove the current user as a follower of one playlist.

    See

    Unfollow a Playlist

    Parameters

    • playlistID: string

      The id of the playlist.

    Returns Promise<UnfollowPlaylistResponse>

  • Removes the current user as a follower of one or more other Spotify users.

    See

    Unfollow Artists or Users

    Parameters

    • userIDs: string[]

      The ids of the users.

    Returns Promise<UnfollowArtistsOrUsersResponse>

  • Upload a custom playlist cover image.

    See

    Upload A Custom Playlist Cover Image

    Parameters

    • playlistID: string

      The id of the playlist.

    • imageData: string

      Base64 encoded JPEG image data, maximum payload size is 256 KB.

    Returns Promise<UploadCustomPlaylistCoverImageResponse>

Generated using TypeDoc