API query - get MBID from Spotify song ID

Hi all !

I am looking on how to get some artists details, from a Spotify track ID. I’ve already managed to get the Artist’s MBID from a Spotify URL though the following request :

https://musicbrainz.org/ws/2/url/?query=url:https://open.spotify.com/artist/3sPiEqLcANa5kAp5RnEHNq&targettype=artist&fmt=json

But I can’t find the right one to get the songs’s MBID from a Spotify song ID.

Any idea ?

Many thanks !
Ken

I was wondering the same thing. This pairing definitely already exists because you can get the other way around (spotify songid from mbid) at Listenbrainz API labs, and importing playlists on Listenbrainz probably also uses the same dataset, but I don’t see that exposed anywhere :frowning:

https://musicbrainz.org/ws/2/url?resource=https://open.spotify.com/artist/3sPiEqLcANa5kAp5RnEHNq&fmt=json&inc=artist-rels

See also MusicBrainz API - MusicBrainz

Sorry, I misunderstood. But for releases and recordings it would work the same way:

E.g. querying a release:

https://musicbrainz.org/ws/2/url?resource=https://open.spotify.com/album/3pr4hQdl7fbVNb5ZXO6RaI&fmt=json&inc=release-rels

For recordings it can be done in just the same way. There are just way less recordings linked to Spotify tracks directly, though. Editors usually link releases, not every single recording.

One option to obtain a MBID would be to use the ListenBrainz API endpoint /1/metadata/lookup/ to resolve a MBID by artist name and track and release title. See Metadata — ListenBrainz 0.1.0 documentation