APIYard
Back to APIs
EntertainmentOAuth 2.0Free tier

Spotify

Search for songs, albums, and artists; manage playlists; get audio features; and control playback on connected devices.

Base URL

https://api.spotify.com/v1
musictracksplaylistsartistsplayback

Endpoints

GET/search

Search for tracks, albums, artists, or playlists.

const response = await fetch("https://api.spotify.com/v1/search?q=radiohead&type=artist&limit=5", {
  method: "GET",
  headers: {
  "Content-Type": "application/json",
  "Authorization": "Bearer YOUR_ACCESS_TOKEN"
  }
});

const data = await response.json();
console.log(data);

Response Preview

{
  "artists": {
    "items": [{
      "name": "Radiohead",
      "popularity": 82,
      "followers": { "total": 8200000 },
      "genres": ["alternative rock", "art rock"]
    }]
  }
}
GET/audio-features/{id}

Get audio feature analysis for a track.

const response = await fetch("https://api.spotify.com/v1/audio-features/4uLU6hMCjMI75M1A2tKUQC", {
  method: "GET",
  headers: {
  "Content-Type": "application/json",
  "Authorization": "Bearer YOUR_ACCESS_TOKEN"
  }
});

const data = await response.json();
console.log(data);

Response Preview

{
  "danceability": 0.421,
  "energy": 0.812,
  "key": 5,
  "loudness": -6.34,
  "tempo": 148.002,
  "valence": 0.198,
  "duration_ms": 254387
}