Country
United States
Operating System
Windows 10
My Question or Issue
When using the '/v1/search' API endpoint, it returns a total amount of search results relating to the query. However, when attempting to change the offset, this total amount of results changes when it is not supposed to.
Example query 1:
'https://api.spotify.com/v1/search?q=tame%2520impala&type=track&limit=20'
Response to query 1:
{
"tracks": {
"href": "https://api.spotify.com/v1/search?query=tame%2520impala&type=track&locale=en-US%2Cen%3Bq%3D0.9&offset=0&limit=20",
"limit": 20,
"next": "https://api.spotify.com/v1/search?query=tame%2520impala&type=track&locale=en-US%2Cen%3Bq%3D0.9&offset=20&limit=20",
"offset": 0,
"previous": null,
"total": 870,
"items": [...]
}
In this first response, the total results is 870
Example query 2:
'https://api.spotify.com/v1/search?q=tame%2520impala&type=track&limit=20&offset=80'
Only the offset parameter changes
Example response 2:
{
"tracks": {
"href": "https://api.spotify.com/v1/search?query=tame%2520impala&type=track&locale=en-US%2Cen%3Bq%3D0.9&offset=80&limit=20",
"limit": 20,
"next": "https://api.spotify.com/v1/search?query=tame%2520impala&type=track&locale=en-US%2Cen%3Bq%3D0.9&offset=100&limit=20",
"offset": 80,
"previous": "https://api.spotify.com/v1/search?query=tame%2520impala&type=track&locale=en-US%2Cen%3Bq%3D0.9&offset=60&limit=20",
"total": 868,
"items": [...]
}
The total has changed to 868 for an unknown reason.
This happens across many different queries, this is just one example. Is this a bug in the API? or is this the proper functionality?
Is there a way to make sure the total returned in the response is consistent? I have used the track tag, which seemed to work, but it limited the search results too much and I'd rather not use it.