Spotify track API
A Spotify track with artists, album, duration, explicit flag and its all-time play count.
GET /v1/spotify/tracks/{id}1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/spotify/tracks/11dFghVXANMlKmJXsNCbNl",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "track": { "id": "11dFghVXANMlKmJXsNCbNl", "name": "Cut To The Feeling", "type": "track", "uri": "spotify:track:11dFghVXANMlKmJXsNCbNl", "external_urls": { "spotify": "https://open.spotify.com/track/11dFghVXANMlKmJXsNCbNl" }, "duration_ms": 207959, "explicit": false, "disc_number": null, "track_number": 1, "is_playable": true, "artists": [ { "id": "6sFIWsNpZYqfjUpaCgueju", "name": "Carly Rae Jepsen", "type": "artist", "uri": "spotify:artist:6sFIWsNpZYqfjUpaCgueju", "external_urls": { "spotify": "https://open.spotify.com/artist/6sFIWsNpZYqfjUpaCgueju" }, "images": [ { "url": "https://i.scdn.co/image/ab6761610000e5eb55e3a8d4fe7f0053fffca258", "height": 640, "width": 640 }, { "url": "https://i.scdn.co/image/ab6761610000517455e3a8d4fe7f0053fffca258", "height": 320, "width": 320 }, "… 1 more" ] } ], "album": { "id": "0tGPJ0bkWOUmH7MEOR77qc", "uri": "spotify:album:0tGPJ0bkWOUmH7MEOR77qc", "type": "album", "external_urls": { "spotify": "https://open.spotify.com/album/0tGPJ0bkWOUmH7MEOR77qc" }, "name": "Cut To The Feeling", "album_type": "single", "images": [ { "url": "https://i.scdn.co/image/ab67616d0000b2737359994525d219f64872d3b1", "height": 640, "width": 640 }, { "url": "https://i.scdn.co/image/ab67616d00001e027359994525d219f64872d3b1", "height": 300, "width": 300 }, "… 1 more" ], "release_date": "2017-05-26", "release_date_precision": "day" }, "playcount": 176965896 }}Parameters
| Name | Type | Description |
|---|---|---|
idpath · required | string | A Spotify track id, spotify:track: URI, or open.spotify.com/track/ link (URL-encoded). Example: 11dFghVXANMlKmJXsNCbNl. |
Response fields
200 with a SpotifyTrackResponse, in the shape of the Spotify Web API’s own objects.
| Field | Type | Description |
|---|---|---|
track | SpotifyTrack |
Status codes
| Status | Meaning |
|---|---|
200 | The track. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | No Spotify object by that id, or it is not public. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | Spotify is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
Questions
Can I get the audio?
No, metadata only.
Spotify is a trademark of Spotify AB. We are not affiliated with or endorsed by Spotify.