Skip to main content

Spotify

Base URL: https://drain.lat/api/v1/spotify
Get a Spotify artist by their Spotify ID.
GET /api/v1/spotify/artist/:id
id
string
required
Spotify artist ID (e.g. 3TVXtAsR1Inumwj472S9r4 for Drake).
curl "https://drain.lat/api/v1/spotify/artist/3TVXtAsR1Inumwj472S9r4" \
  -H "x-api-key: YOUR_API_KEY"
Response
{
  "id": "3TVXtAsR1Inumwj472S9r4",
  "name": "Drake",
  "genres": ["canadian hip hop", "rap", "toronto rap"],
  "followers": 88000000,
  "popularity": 96,
  "avatarUrl": "https://i.scdn.co/image/...",
  "spotifyUrl": "https://open.spotify.com/artist/3TVXtAsR1Inumwj472S9r4",
  "scrapedAt": "2026-05-05T12:00:00.000Z"
}
Get an artist’s top 10 tracks.
GET /api/v1/spotify/artist/:id/tracks
id
string
required
Spotify artist ID.
curl "https://drain.lat/api/v1/spotify/artist/3TVXtAsR1Inumwj472S9r4/tracks" \
  -H "x-api-key: YOUR_API_KEY"
artistId
string
Spotify artist ID.
tracks
array
Response
{
  "artistId": "3TVXtAsR1Inumwj472S9r4",
  "tracks": [
    {
      "id": "2507CQMJ8xFZbFGSC9FXMX",
      "name": "God's Plan",
      "album": "Scorpion",
      "albumArt": "https://i.scdn.co/image/...",
      "durationMs": 198973,
      "popularity": 88,
      "previewUrl": "https://p.scdn.co/mp3-preview/...",
      "spotifyUrl": "https://open.spotify.com/track/2507CQMJ8xFZbFGSC9FXMX"
    }
  ],
  "scrapedAt": "2026-05-05T12:00:00.000Z"
}
Search for tracks on Spotify.
GET /api/v1/spotify/search/tracks
q
string
required
Track name or search query.
curl "https://drain.lat/api/v1/spotify/search/tracks?q=god%27s+plan" \
  -H "x-api-key: YOUR_API_KEY"
query
string
The search query used.
tracks
array
Response
{
  "query": "god's plan",
  "tracks": [
    {
      "id": "6DCZcSspjsKoFjzjrWoCdn",
      "name": "God's Plan",
      "artists": [{ "id": "3TVXtAsR1Inumwj472S9r4", "name": "Drake" }],
      "album": "Scorpion",
      "albumArt": "https://...",
      "durationMs": 198973,
      "popularity": 88,
      "previewUrl": "https://...",
      "explicit": true,
      "spotifyUrl": "https://open.spotify.com/track/6DCZcSspjsKoFjzjrWoCdn"
    }
  ],
  "scrapedAt": "2026-05-08T10:00:00.000Z"
}
Search for albums on Spotify.
GET /api/v1/spotify/search/albums
q
string
required
Album name or search query.
curl "https://drain.lat/api/v1/spotify/search/albums?q=scorpion" \
  -H "x-api-key: YOUR_API_KEY"
Response
{
  "query": "scorpion",
  "albums": [
    {
      "id": "1ATL5GLyefJaxhQzSPVrLX",
      "name": "Scorpion",
      "artists": [{ "id": "3TVXtAsR1Inumwj472S9r4", "name": "Drake" }],
      "releaseDate": "2018-06-29",
      "totalTracks": 25,
      "coverUrl": "https://...",
      "spotifyUrl": "https://open.spotify.com/album/1ATL5GLyefJaxhQzSPVrLX"
    }
  ],
  "scrapedAt": "2026-05-08T10:00:00.000Z"
}
Get an artist’s albums and singles.
GET /api/v1/spotify/artist/:id/albums
id
string
required
Spotify artist ID.
curl "https://drain.lat/api/v1/spotify/artist/3TVXtAsR1Inumwj472S9r4/albums" \
  -H "x-api-key: YOUR_API_KEY"
Response
{
  "artistId": "3TVXtAsR1Inumwj472S9r4",
  "albums": [
    {
      "id": "1ATL5GLyefJaxhQzSPVrLX",
      "name": "Scorpion",
      "type": "album",
      "releaseDate": "2018-06-29",
      "totalTracks": 25,
      "coverUrl": "https://...",
      "spotifyUrl": "https://open.spotify.com/album/1ATL5GLyefJaxhQzSPVrLX"
    }
  ],
  "scrapedAt": "2026-05-08T10:00:00.000Z"
}
Get info for a single Spotify track.
GET /api/v1/spotify/track/:id
id
string
required
Spotify track ID.
curl "https://drain.lat/api/v1/spotify/track/6DCZcSspjsKoFjzjrWoCdn" \
  -H "x-api-key: YOUR_API_KEY"
Response
{
  "id": "6DCZcSspjsKoFjzjrWoCdn",
  "name": "God's Plan",
  "artists": [{ "id": "3TVXtAsR1Inumwj472S9r4", "name": "Drake" }],
  "album": "Scorpion",
  "albumId": "1ATL5GLyefJaxhQzSPVrLX",
  "albumArt": "https://...",
  "releaseDate": "2018-06-29",
  "durationMs": 198973,
  "popularity": 88,
  "previewUrl": "https://...",
  "explicit": true,
  "spotifyUrl": "https://open.spotify.com/track/6DCZcSspjsKoFjzjrWoCdn",
  "scrapedAt": "2026-05-08T10:00:00.000Z"
}
Get a full album with tracklist.
GET /api/v1/spotify/album/:id
id
string
required
Spotify album ID.
curl "https://drain.lat/api/v1/spotify/album/1ATL5GLyefJaxhQzSPVrLX" \
  -H "x-api-key: YOUR_API_KEY"
id
string
Album ID.
name
string
Album name.
type
string
Album type (album, single, compilation).
artists
array
List of artists.
releaseDate
string
Release date.
totalTracks
number
Total track count.
coverUrl
string
Album cover URL.
label
string
Record label.
popularity
number
Popularity score (0-100).
tracks
array
Response
{
  "id": "1ATL5GLyefJaxhQzSPVrLX",
  "name": "Scorpion",
  "type": "album",
  "artists": [{ "id": "3TVXtAsR1Inumwj472S9r4", "name": "Drake" }],
  "releaseDate": "2018-06-29",
  "totalTracks": 25,
  "coverUrl": "https://...",
  "label": "Young Money",
  "popularity": 85,
  "tracks": [
    {
      "id": "6DCZcSspjsKoFjzjrWoCdn",
      "name": "God's Plan",
      "trackNumber": 1,
      "durationMs": 198973,
      "previewUrl": "https://...",
      "explicit": true,
      "spotifyUrl": "https://open.spotify.com/track/6DCZcSspjsKoFjzjrWoCdn"
    }
  ],
  "spotifyUrl": "https://open.spotify.com/album/1ATL5GLyefJaxhQzSPVrLX",
  "scrapedAt": "2026-05-08T10:00:00.000Z"
}