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.

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 status field on the Spotify track object. In this case, we can see the track analysis has the status FINISHED.

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

If the track hasn't been analyzed yet SpotifyTrackEnqueueSuccess object will be returned as well. The difference now is that we see the track analysis has the status PROCESSING which means it's being currently analyzed.

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

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": "AudioAnalysisV6",
"status": "finished"
}
}

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