SpotifyPublicAPI

FREE
By dimas
Updated 5 months ago
Music
7.9/10
Popularity Score
345ms
Latency
100%
Success Rate

SpotifyPublicAPI API Overview

Spotify Public API - Retireve music data from the entire Spotify music catalog. Get information about artists, albums, and tracks from Spotify. Test an API call in your browser and export the code into your app.

The Spotify Public API is free under certain use cases and limits as of 3/1/2017: https://developer.spotify.com/developer-terms-of-use/#section-iv-restrictions

Contact API Provider
star-blueRate

SpotifyPublicAPI

SpotifyPublicAPI Package

This package offers a variety of blocks by Spotify that do not require any authentication.

  • Domain: spotify.com
  • Credentials: accessToken

How to get credentials:

  1. Go to Spotify Console
  2. Log in and generate accessToken
  3. Use your accessToken.

SpotifyPublicAPI.searchAlbums

Field Type Description
accessToken credentials The accessToken obtained from Spotify.
query String The search query's keywords (and optional field filters and operators).
market String An ISO 3166-1 alpha-2 country code or the string from_token.
limit String The maximum number of results to return. Default: 20. Minimum: 1. Maximum: 50.
offset String The index of the first result to return. Default: 0 (i.e., the first result). Maximum offset: 100.000. Use with limit to get the next page of search results.

Request example

{    
  "query": "...",
    "market": "...",
    "limit": "...",
    "offset": "..."
}

SpotifyPublicAPI.searchArtists

Field Type Description
accessToken credentials The accessToken obtained from Spotify.
query String The search query's keywords (and optional field filters and operators).
market String An ISO 3166-1 alpha-2 country code or the string from_token.
limit String The maximum number of results to return. Default: 20. Minimum: 1. Maximum: 50.
offset String The index of the first result to return. Default: 0 (i.e., the first result). Maximum offset: 100.000. Use with limit to get the next page of search results.

Request example

{    
  "query": "...",
    "market": "...",
    "limit": "...",
    "offset": "..."
}

SpotifyPublicAPI.searchPlaylists

Field Type Description
accessToken credentials The accessToken obtained from Spotify.
query String The search query's keywords (and optional field filters and operators).
market String An ISO 3166-1 alpha-2 country code or the string from_token.
limit String The maximum number of results to return. Default: 20. Minimum: 1. Maximum: 50.
offset String The index of the first result to return. Default: 0 (i.e., the first result). Maximum offset: 100.000. Use with limit to get the next page of search results.

Request example

{    
  "query": "...",
    "market": "...",
    "limit": "...",
    "offset": "..."
}

SpotifyPublicAPI.searchTracks

Field Type Description
accessToken credentials The accessToken obtained from Spotify.
query String The search query's keywords (and optional field filters and operators).
market String An ISO 3166-1 alpha-2 country code or the string from_token.
limit String The maximum number of results to return. Default: 20. Minimum: 1. Maximum: 50.
offset String The index of the first result to return. Default: 0 (i.e., the first result). Maximum offset: 100.000. Use with limit to get the next page of search results.

Request example

{    
  "query": "...",
    "market": "...",
    "limit": "...",
    "offset": "..."
}

SpotifyPublicAPI.getAlbum

Field Type Description
accessToken credentials The accessToken obtained from Spotify.
id String The Spotify ID for the album.

Request example

{    
  "id": "..."
}

SpotifyPublicAPI.getAlbumTracks

Field Type Description
accessToken credentials The accessToken obtained from Spotify.
id String The Spotify ID for the track.

Request example

{    
  "id": "..."
}

SpotifyPublicAPI.getArtist

Field Type Description
accessToken credentials The accessToken obtained from Spotify.
id String The Spotify ID for the artist.

Request example

{    
  "id": "..."
}

SpotifyPublicAPI.getArtistAlbums

Field Type Description
accessToken credentials The accessToken obtained from Spotify.
id String The Spotify ID for the artist.
album_type List A comma-separated list of keywords that will be used to filter the response. If not supplied, all album types will be returned. Valid values are:album, single, appears_on, compilation.
market String An ISO 3166-1 alpha-2 country code. Supply this parameter to limit the response to one particular geographical market.
limit String The number of album objects to return. Default: 20. Minimum: 1. Maximum: 50.
offset String The index of the first album to return. Default: 0 (i.e., the first album). Use with limit to get the next set of albums.

Request example

{    
  "id": "...",
    "album_type": "...",
    "market": "...",
    "limit": "...",
    "offset": "..."
}

SpotifyPublicAPI.getArtistTopTracks

Field Type Description
accessToken credentials The accessToken obtained from Spotify.
id String The Spotify ID for the artist.
country String The country: an ISO 3166-1 alpha-2 country code.

Request example

{    
  "id": "...",
    "country": "..."
}

SpotifyPublicAPI.getArtistRelatedArtists

Field Type Description
accessToken credentials The accessToken obtained from Spotify.
id String The Spotify ID for the artist.

Request example

{    
  "id": "..."
}

SpotifyPublicAPI.getTrack

Field Type Description
accessToken credentials The accessToken obtained from Spotify.
id String The Spotify ID for the track.

Request example

{    
  "id": "..."
}

SpotifyPublicAPI.getUserProfile

Field Type Description
accessToken credentials The accessToken obtained from Spotify.
id String The Spotify ID for the user profile.

Request example

{    
  "id": "..."
}

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.post("https://SpotifyPublicAPIdimasV1.p.rapidapi.com/getAlbum")
.header("X-RapidAPI-Host", "SpotifyPublicAPIdimasV1.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Content-Type", "application/x-www-form-urlencoded")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication