Spotify Track Lookup

This tool is currently unavailable.

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.

PatternExample
/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

GET /v1/lookup/spotify/track?trackid={trackid}&market={market}
POST /v1/lookup/spotify/track

Both return JSON on api.troubleshooting.tools. POST takes the same fields as a form.

NameTypeDefaultDescription
trackidstringrequired The 22-character id of a Spotify track. Everything but letters and digits is removed first.
marketstringUS Two-letter country code of the market to answer for, in either case. It has to be one of the markets Spotify lists.
shell
$ 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

FieldTypeDescription
idstringThe track id that was looked up.
namestringTitle of the recording.
artistsarrayThe artists of the track, each with id, name, uri and external_urls.
albumobjectThe release, with name, album_type, artists, release_date, total_tracks and images.
duration_msintegerLength in milliseconds.
duration_shortstringLength as minutes and seconds, M:SS.
duration_readablestringLength written out, such as 3 Min. 45 Sec.
track_numberintegerPosition on the release.
disc_numberintegerDisc of the release the track is on.
explicitbooleanWhether Spotify marks the track as explicit.
is_playablebooleanWhether the track can be played in market.
restrictionsobjectWhy the track cannot be played, when Spotify says so; otherwise null.
external_idsobjectCodes such as isrc, the same across services for the same recording.
external_urlsobjectThe track's address on Spotify, under spotify.
popularity, preview_url, is_local, uri, href, typePassed on from Spotify as they come.
marketstringThe market the answer is for.
release_yearstringThe first four characters of album.release_date.

Errors

A failure answers with a status code and a JSON body of the form {"error": "…"}.

StatusMessageMeaning
400trackid parameter is required.No trackid, or one without a letter or digit in it.
400Invalid trackid length. A valid Spotify Track ID is 22 characters long.The id is not 22 characters long.
400Invalid market code. Please provide a valid Spotify market.Spotify does not list that market.
400Bad request. Please check the trackid.Spotify rejected the id.
404Track not found.No track has that id, or it was taken down.
405Method not allowed. Allowed: GET, POSTAny other method.
500Failed 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.
500Failed to retrieve access token from Spotify.Spotify refused this site's credentials.
500Failed 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.