Subject: Google Custom Search API integration issue on n8n - Error 403 or 400

Hello everyone,

I’m having an issue with the Google Custom Search API integration on n8n. The request works fine when I test it directly in the browser, but as soon as I use it in the n8n HTTP node, I get intermittent errors, including 403 (Forbidden) or 400 (Bad Request).

Integration Background:
API Key and CX:

I generated an API key and a custom search engine via the Google Cloud Console. Testing with the URL in the browser works perfectly.

Request parameters:

Method: GET

URL: https://www.googleapis.com/customsearch/v1?q=test&key=YOUR_API_KEY&cx=YOUR_CX

Request sent in n8n:

Correct URL in n8n: https://www.googleapis.com/customsearch/v1

Parameters: q=test, key=YOUR_API_KEY, cx=YOUR_CX

When I test the URL in the browser with the same parameters, it works without issue.

Error encountered in n8n:

403: “Forbidden” — This indicates there is a problem with the credentials.

400: “Bad Request” — This suggests something in the request structure is malformed or missing.

Configuration in n8n:
HTTP Request Node: I’m using the HTTP node in n8n to send a GET request to the Custom Search API.

Request Structure: The URL is correct (https://www.googleapis.com/customsearch/v1), and the parameters (API key, CX, and q) are correctly added in the appropriate section.

What I’ve tried so far:
Verified the information (API key and CX): it’s correct, as shown by the browser test.

Configuration of the GET request in n8n: GET method and correct URL.

I’ve also tested the URL in several forms, but without success.

Questions:
Have you encountered this type of integration issue between the Google Custom Search API and n8n?

Are there any additional configurations in n8n that I should consider for this API?

Should I use additional headers or another form of authentication for the API in n8n?

Thanks in advance for your help and suggestions!

Hi @ivri Welcome to the community!

Your request parameters look good to me!

Fortunately, I have it working in one of my workflows.

Here’s a working workflow:

Please test it on your end and let me know if you still encounter any issues