Spotify Track Lookup
Look up a Spotify track by its id and get the record Spotify keeps for it in a chosen market: title, artists, album, duration, position on the release, and whether it can be played there.
Overview
Every recording on Spotify carries a 22-character id, the last part of its address: in
open.spotify.com/track/11dFghVXANMlKmJXsNCbNl it is 11dFghVXANMlKmJXsNCbNl. The
lookup takes that id and a market, asks Spotify's Web API for the track, and hands back the answer.
Spotify answers per country. Whether a track can be played is a property of the market rather than of the recording: a track can be playable in one country, missing in the next, and answered with a differently licensed recording of the same song in a third. The id stays the same; only the answer about it changes.
At the moment Spotify refuses the requests this site makes for the tool, so the form on the tool page is
switched off and the API answers every lookup with status 500. What follows describes the tool
as it works once that is resolved.
Web interface
Paste the id or the whole Spotify address of the track. An address, also with a language segment such as
/intl-de/ or a ?si= parameter after it, is reduced to the id before the lookup. Pick
the market from the 178 in the list; the dice in the field looks up one of six sample tracks.
The result shows the cover beside title, artist, album, release year and duration, and below that the metadata as rows. A click on a row copies its value. Play on Spotify asks before it leaves the site, and reads Not Available when the track cannot be played in the chosen market.
URL parameters
| Pattern | Example |
|---|---|
/lookup/spotify/track/{trackid} | /lookup/spotify/track/11dFghVXANMlKmJXsNCbNl |
/lookup/spotify/track/{market}/{trackid} | /lookup/spotify/track/de/11dFghVXANMlKmJXsNCbNl |
Every lookup made on the page updates the address to the second form, so a track and a market together can be linked to. While the tool is unavailable, such an address opens the page with the id filled in and looks nothing up.
API
/v1/lookup/spotify/track?trackid={trackid}&market={market}
/v1/lookup/spotify/track
Both return JSON on api.troubleshooting.tools. POST takes the same fields as a form.
| Name | Type | Default | Description |
|---|---|---|---|
| trackid | string | required | The 22-character id of a Spotify track. Everything but letters and digits is removed first. |
| market | string | US |
Two-letter country code of the market to answer for, in either case. It has to be one of the markets Spotify lists. |
$ curl -s "https://api.troubleshooting.tools/v1/lookup/spotify/track?trackid=11dFghVXANMlKmJXsNCbNl&market=DE" | jq .
# The same as a form post
$ curl -s -d trackid=11dFghVXANMlKmJXsNCbNl -d market=DE https://api.troubleshooting.tools/v1/lookup/spotify/track
No example answer is shown here, because none can be fetched while Spotify refuses the requests, and this page shows only answers it has seen. The fields below are the ones the API builds from Spotify's record.
Response fields
| Field | Type | Description |
|---|---|---|
| id | string | The track id that was looked up. |
| name | string | Title of the recording. |
| artists | array | The artists of the track, each with id, name, uri and external_urls. |
| album | object | The release, with name, album_type, artists, release_date, total_tracks and images. |
| duration_ms | integer | Length in milliseconds. |
| duration_short | string | Length as minutes and seconds, M:SS. |
| duration_readable | string | Length written out, such as 3 Min. 45 Sec. |
| track_number | integer | Position on the release. |
| disc_number | integer | Disc of the release the track is on. |
| explicit | boolean | Whether Spotify marks the track as explicit. |
| is_playable | boolean | Whether the track can be played in market. |
| restrictions | object | Why the track cannot be played, when Spotify says so; otherwise null. |
| external_ids | object | Codes such as isrc, the same across services for the same recording. |
| external_urls | object | The track's address on Spotify, under spotify. |
| popularity, preview_url, is_local, uri, href, type | Passed on from Spotify as they come. | |
| market | string | The market the answer is for. |
| release_year | string | The first four characters of album.release_date. |
Errors
A failure answers with a status code and a JSON body of the form {"error": "…"}.
| Status | Message | Meaning |
|---|---|---|
400 | trackid parameter is required. | No trackid, or one without a letter or digit in it. |
400 | Invalid trackid length. A valid Spotify Track ID is 22 characters long. | The id is not 22 characters long. |
400 | Invalid market code. Please provide a valid Spotify market. | Spotify does not list that market. |
400 | Bad request. Please check the trackid. | Spotify rejected the id. |
404 | Track not found. | No track has that id, or it was taken down. |
405 | Method not allowed. Allowed: GET, POST | Any other method. |
500 | Failed to retrieve markets: Failed to retrieve markets from Spotify. | Spotify refused the list of markets. This is the answer every lookup gets at the moment. |
500 | Failed to retrieve access token from Spotify. | Spotify refused this site's credentials. |
500 | Failed to connect to Spotify API. | Spotify could not be reached. |
Rate limits
50 requests per second per IP address, burst 100, at most 50 concurrent connections, HTTP 429
over the limit.
Every lookup is also a request to Spotify, which sets limits of its own. A request Spotify refuses comes back
through the error rows above, not as 429.
Privacy
The track id and the market are sent to this site, which asks Spotify from the server. Spotify sees the server, not you. Lookups appear in server logs for operational purposes and are not sold, shared or used to build profiles.
On the tool page the cover is the one thing your browser loads from Spotify directly, from
i.scdn.co. An API caller receives the cover addresses and decides for itself whether to load
them.