Read google custom search invalid value for more information.

Google custom search API returning 400 – invalid value

This was an error I had come across while trying to return a valid response from a Google CSE request. As I looked into it, I found two issues that could be causing the invalid value error. 
google custom search invalid valueThis info is not at all easy to find, and I found it mentioned officially in only one place on google.com. I found a single line in the Custom Search documentation that explains those errors, the value of the domain property in the JSON response will be invalid. The request failed because it contained an invalid value.

 

Build a fully customizable Search without any coding

Google CSE 400 Error cause 1 and fix

While debugging this error, I was able to fix it by changing the key(API_KEY) and/or cx(SEARCH_ENGINE_ID) params. Typos can creep in and give an invalid response. This is the first place to check.

Custom Search invalid input error cause 2 and fix

The REST API is limited to 100 results per day. So if you hit this, or attempt more than 100 results with the start index, then it can return a 400 invalid input error. This can be fixed only if you set up billing.

Searches related to google custom search invalid value

You may also like