Skip to main content

Analyze Spotify tracks

Although our library of analyzed Spotify tracks is constantly growing, it can happen that a specific track you are looking for has not been analyzed yet. In this case, you may want to manually enqueue it in order to be able to query similar Spotify tracks for this track or get it returned in the search results.

Spotify track analysis

The analysis of Spotify tracks is primarily intended to support Spotify as input for our Similarity Search. Tagging for the analyzed Spotify tracks may not be available.

Below you can see different results for the operation:

In case the track was already analyzed, SpotifyTrackEnqueueSuccess object will be returned. To get more information we query the audioAnalysisV7 field on the Spotify track object. In this case, we can see the track analysis is finished, because __typename is AudioAnalysisV7Finished.

{
"data": {
"spotifyTrackEnqueue": {
"__typename": "SpotifyTrackEnqueueSuccess",
"enqueuedSpotifyTrack": {
"id": "4cOdK2wGLETKBW3PvgPWqT",
"audioAnalysisV7": {
"__typename": "AudioAnalysisV7Finished"
}
}
}
}
}

If the track hasn't been analyzed yet SpotifyTrackEnqueueSuccess object will be returned as well. The difference now is that we see the __typename of audioAnalysisV7 is AudioAnalysisV7Processing.

{
"data": {
"spotifyTrackEnqueue": {
"__typename": "SpotifyTrackEnqueueSuccess",
"enqueuedSpotifyTrack": {
"id": "4cOdK2wGLETKBW3PvgPWqT",
"audioAnalysisV7": {
"__typename": "AudioAnalysisV7Processing"
}
}
}
}
}

If there is no Spotify preview available for the track or the enqueuing will fail any other reason, the result will contain SpotifyTrackEnqueueError type:

{
"data": {
"spotifyTrackEnqueue": {
"__typename": "SpotifyTrackEnqueueError"
}
}
}

If you set up your webhook properly, you should also be notified when the enqueued track analysis is finished. You will receive a webhook with the following body:

{
"version": "2",
"resource": {
"type": "SpotifyTrack",
"id": "4cOdK2wGLETKBW3PvgPWqT"
},
"event": {
"type": "AudioAnalysisV7",
"status": "finished"
}
}

The status might be finished or failed depending on the success of the analysis.