Announcements

Help Wizard

Step 1

NEXT STEP

Search API returns 400 (Bad Request) - undocumented max length of query

Solved!

Search API returns 400 (Bad Request) - undocumented max length of query

I get a 400 (Bad Request) response when I query the search API for this particular query. The error is likely to be because the query is too long as it works when I shorten it, no matter whether I delete some at the beginning or some at the end or some in the middle, and I get a 200 response with a successful match..

 

Is there a max length of query? Because none is documented in https://developer.spotify.com/documentation/web-api/reference/search

 

The query is

https://api.spotify.com/v1/search?q=track:Der%20fur%20die%20Sunden%20der%20Welt%20gemarterte%20und%20sterbende%20Jesus%2C%20TWV%205%3A1%2C%20%22Brockes%20Passion%22%3A%20Recitative%3A%20Drauf%20sagten%20sie%20(Evangelist)%20-%20Accompagnato%3A%20Ihr%20werdet%20all'%20(Jesus)%20-%20Chorus%3A%20Wir%20wollen%20%E2%80%A6%20-%20Accompagnato%3A%20Es%20ist%20%E2%80%A6%20(Jesus)+artist:Georg%20Philipp%20Telemann&type=track&limit=10

 

Reply

Accepted Solutions
Marked as solution

The (decoded) character limit is 100. A decoded %20 is a space, and counts as 1 character, etc.

I often use this page to decode urls: https://meyerweb.com/eric/tools/dencoder/

(You don't have to decode it to use the url; only to determine the query length)

View solution in original post

2 Replies
Marked as solution

The (decoded) character limit is 100. A decoded %20 is a space, and counts as 1 character, etc.

I often use this page to decode urls: https://meyerweb.com/eric/tools/dencoder/

(You don't have to decode it to use the url; only to determine the query length)

For a long time there was a limit of 100 characters, but since October 2022 the limit has been expanded to 250 characters

 

Suggested posts