Type in your question below and we'll check to see what answers we can find...
Loading article...
Submitting...
If you couldn't find any answers in the previous step then we need to post your question in the community and wait for someone to respond. You'll be notified when that happens.
Simply add some detail to your question and refine the title if needed, choose the relevant category, then post.
Before we can post your question we need you to quickly make an account (or sign in if you already have one).
Don't worry - it's quick and painless! Just click below, and once you're logged in we'll bring you right back here and post your question. We'll remember what you've already typed in so you won't have to do it again.
Plan: Premium
Hello, third party app developer here.
I hit a strange issue in development while searching for a very long track title.
It appears that there is a hard limit of 144 characters for the `q` query parameter in the Web API /search endpoint.
Sending a query with q >= 145 characters returns a 404, which I found to be quite surprising.
If the query parameter is too long, I would expect the endpoint to return an appropriate error rather than a 404 status with a "Not Found" error.
Here is an example query that correctly returns a 200 response:
https://api.spotify.com/v1/search?type=track&q=This%20song%20does%20not%20exist%20i%20just%20want%20...
The same query with one additional character at the end returns a 404 response:
https://api.spotify.com/v1/search?type=track&q=This%20song%20does%20not%20exist%20i%20just%20want%20...
The error is as follows:
{
"error" : {
"status" : 404,
"message" : "Not found."
}
}
Solved! Go to Solution.
The search endpoint has a character limit of 100 characters. If you have any more than that, the endpoint will throw an exception.
The search endpoint has a character limit of 100 characters. If you have any more than that, the endpoint will throw an exception.
Thank you for the response Ximzend, and for confirming there is a limit to the query length.
As far as my testing went, the limit is 144 characters rather than 100.
I guess this should be added somewhere to the documentation of the endpoint to avoid bad surprises.
More preoccupying though is the fact that the endpoint does not return an expected error informing the user that the query is invalid, but rather returns a 404 as if the /search endpoint did not exist.
I've tried it this week and it seems to have been increased to 250 characters, send in a query of 251 characters and it returns a 400 error, 250 characters works fine though.
Hey there you, Yeah, you! 😁 Welcome - we're glad you joined the Spotify Community! While you here, let's have a fun game and get…