Get track recommendations
curl --request GET \
--url https://spotify-api31.p.rapidapi.com/api/v1/tracks/recommendations \
--header 'x-rapidapi-key: <api-key>'import requests
url = "https://spotify-api31.p.rapidapi.com/api/v1/tracks/recommendations"
headers = {"x-rapidapi-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-rapidapi-key': '<api-key>'}};
fetch('https://spotify-api31.p.rapidapi.com/api/v1/tracks/recommendations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://spotify-api31.p.rapidapi.com/api/v1/tracks/recommendations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-rapidapi-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://spotify-api31.p.rapidapi.com/api/v1/tracks/recommendations"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-rapidapi-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://spotify-api31.p.rapidapi.com/api/v1/tracks/recommendations")
.header("x-rapidapi-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://spotify-api31.p.rapidapi.com/api/v1/tracks/recommendations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-rapidapi-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"message": "Success",
"statusCode": 200,
"pagination": {
"total": 100,
"hasMore": true,
"continuation": "CDsQ8FsiEwje95_F1pmRAxXlsykDHUX"
},
"data": [
{
"id": "5QTlj4L7ODIKNnTkhDE16p",
"name": "Rhymes",
"uri": "spotify:track:5QTlj4L7ODIKNnTkhDE16p",
"duration": 200005,
"artists": [
{
"name": "Hannah Wants",
"uri": "spotify:artist:7sK4hnuUOXw6VStDw0q8NI"
}
],
"album": {
"id": "4hqlx8mdrCorDXsdzQfmX1",
"uri": "spotify:album:4hqlx8mdrCorDXsdzQfmX1",
"name": "Rhymes",
"coverArt": [
{
"url": "https://i.scdn.co/image/ab67616d00001e02823349c9546161f25941b7c9",
"width": 300,
"height": 300
}
]
},
"playability": {
"playable": true,
"reason": "PLAYABLE"
},
"contentRating": {
"label": "NONE"
}
}
]
}{
"message": "Bad request"
}{
"message": "Invalid API key"
}{
"message": "You are not subscribed to this API, please subscribe before using"
}{
"success": false,
"message": "Internal Server Error",
"status_code": 500,
"cost": 0,
"explain": "Internal Server Error"
}Tracks
Get track recommendations
Get recommended tracks based on a specific track
GET
/
api
/
v1
/
tracks
/
recommendations
Get track recommendations
curl --request GET \
--url https://spotify-api31.p.rapidapi.com/api/v1/tracks/recommendations \
--header 'x-rapidapi-key: <api-key>'import requests
url = "https://spotify-api31.p.rapidapi.com/api/v1/tracks/recommendations"
headers = {"x-rapidapi-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-rapidapi-key': '<api-key>'}};
fetch('https://spotify-api31.p.rapidapi.com/api/v1/tracks/recommendations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://spotify-api31.p.rapidapi.com/api/v1/tracks/recommendations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-rapidapi-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://spotify-api31.p.rapidapi.com/api/v1/tracks/recommendations"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-rapidapi-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://spotify-api31.p.rapidapi.com/api/v1/tracks/recommendations")
.header("x-rapidapi-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://spotify-api31.p.rapidapi.com/api/v1/tracks/recommendations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-rapidapi-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"message": "Success",
"statusCode": 200,
"pagination": {
"total": 100,
"hasMore": true,
"continuation": "CDsQ8FsiEwje95_F1pmRAxXlsykDHUX"
},
"data": [
{
"id": "5QTlj4L7ODIKNnTkhDE16p",
"name": "Rhymes",
"uri": "spotify:track:5QTlj4L7ODIKNnTkhDE16p",
"duration": 200005,
"artists": [
{
"name": "Hannah Wants",
"uri": "spotify:artist:7sK4hnuUOXw6VStDw0q8NI"
}
],
"album": {
"id": "4hqlx8mdrCorDXsdzQfmX1",
"uri": "spotify:album:4hqlx8mdrCorDXsdzQfmX1",
"name": "Rhymes",
"coverArt": [
{
"url": "https://i.scdn.co/image/ab67616d00001e02823349c9546161f25941b7c9",
"width": 300,
"height": 300
}
]
},
"playability": {
"playable": true,
"reason": "PLAYABLE"
},
"contentRating": {
"label": "NONE"
}
}
]
}{
"message": "Bad request"
}{
"message": "Invalid API key"
}{
"message": "You are not subscribed to this API, please subscribe before using"
}{
"success": false,
"message": "Internal Server Error",
"status_code": 500,
"cost": 0,
"explain": "Internal Server Error"
}Authorizations
API Key
Query Parameters
Spotify track URI to get recommendations for
Pattern:
^spotify:track:[a-zA-Z0-9]+$Example:
"spotify:track:4WNcduiCmDNfmTEz7JvmLv"
Number of recommendations to return
Required range:
1 <= x <= 50Example:
20
Was this page helpful?
⌘I

