Skip to main content

Spotify API Client

A TypeScript client library for the Spotify API. This library provides easy access to Spotify search, artists, albums, tracks, playlists, podcasts, and users APIs.

Installation

Install the package using npm:

Quick Start

Configuration

Configure the Spotify client with your API credentials:
Get your API key: RapidAPI - Spotify API API Documentation: ZiloData API Docs :::note The API endpoint is hardcoded and cannot be changed. :::

API Structure

The library is organized into modules, each providing specific functionality:
? = Optional parameter

API Reference

Explore Module

The explore module provides search and suggestion functionality for discovering Spotify content. Search for tracks, artists, albums, playlists, podcasts, and more on Spotify. Method: client.explore.search() Parameters: Example:
Example Response:

Suggestions

Get search suggestions based on a keyword to help users discover related content. Method: client.explore.suggestions() Parameters: Example:
Example Response:

Artists Module

The artists module provides comprehensive access to artist information, discography, related artists, and more.

Get Overview

Get overview information about a specific artist including profile details, statistics, and metadata. Method: client.artists.getOverview() Parameters: Example:

Get Playlists

Get playlists created by or associated with the artist. Method: client.artists.getPlaylists() Parameters: Example:

Get Albums

Get albums for the specified artist with pagination and sorting options. Method: client.artists.getAlbums() Parameters: Example:

Get Singles

Get singles released by the specified artist. Method: client.artists.getSingles() Parameters: Example:

Get Compilations

Get compilation albums featuring the specified artist. Method: client.artists.getCompilations() Parameters: Example:
Get artists related to the specified artist based on listening patterns and music similarity. Method: client.artists.getRelated() Parameters: Example:

Get Appears On

Get albums that the artist appears on but did not release as the primary artist. Method: client.artists.getAppearsOn() Parameters: Example:

Get Featuring

Get artists that have featured this artist in their tracks. Method: client.artists.getFeaturing() Parameters: Example:

Get Discovered On

Get playlists where the artist is commonly discovered by listeners. Method: client.artists.getDiscoveredOn() Parameters: Example:

Get Concerts

Get concert and tour information for the artist. Method: client.artists.getConcerts() Parameters: Example:

Get Discography Overview

Get a comprehensive discography overview for the artist including all releases organized by type. Method: client.artists.getDiscographyOverview() Parameters: Example:

Albums Module

The albums module provides access to album details and track listings.

Get Detail

Get detailed information about an album including metadata, artists, release date, and cover art. Method: client.albums.getDetail() Parameters: Example:
Example Response:

Get Tracks

Get all tracks from an album with pagination support. Method: client.albums.getTracks() Parameters: Example:

Tracks Module

The tracks module provides access to track details, lyrics, and recommendations.

Get Detail

Get detailed information about a track including metadata, artists, album, and duration. Method: client.tracks.getDetail() Parameters: Example:
Example Response:

Get Lyrics

Get lyrics for a track if available. Method: client.tracks.getLyrics() Parameters: Example:

Get Recommendations

Get track recommendations based on a specific track using Spotify’s recommendation algorithm. Method: client.tracks.getRecommendations() Parameters: Example:

Playlists Module

The playlists module provides access to playlist details and track listings.

Get Detail

Get detailed information about a playlist including metadata, owner, description, and follower count. Method: client.playlists.getDetail() Parameters: Example:

Get Tracks

Get all tracks from a playlist with pagination support. Method: client.playlists.getTracks() Parameters: Example:

Podcasts Module

The podcasts module provides access to podcast show details and episode listings.

Get Detail

Get detailed information about a podcast show including metadata, description, and publisher information. Method: client.podcasts.getDetail() Parameters: Example:

Get Episodes

Get episodes from a podcast show with pagination support. Method: client.podcasts.getEpisodes() Parameters: Example:

Users Module

The users module provides access to user profile information, followers, and following lists.

Get Profile

Get user profile information including display name, followers count, and profile image. Method: client.users.getProfile() Parameters: Example:

Get Followers

Get list of users following the specified user. Method: client.users.getFollowers() Parameters: Example:

Get Following

Get list of users that the specified user is following. Method: client.users.getFollowing() Parameters: Example:

Error Handling

The client uses axios for HTTP requests. Errors will be thrown as axios errors with detailed information:

Additional Resources