Google Custom Search

Perform Google Custom Search operations

Overview

This node performs Google Custom Search operations, specifically enabling users to execute search queries using Google's Custom Search API. It is useful for scenarios where you want to programmatically retrieve web or image search results based on specific queries and parameters. For example, it can be used to automate content discovery, gather research data, or integrate search capabilities into workflows without manual browsing.

Properties

Name Meaning
Query The search query string to look up.
Country Code (GL) Two-letter country code representing the geolocation of the end user, influencing search results.
Return Only Items Boolean flag indicating whether to return only the array of search result items instead of full response.
Additional Options A collection of optional parameters to refine the search:
- Number of Results Number of search results to return (1-10).
- Start Index The index of the first result to return (pagination).
- Safe Search Search safety level; options are "Off" or "Active".
- Search Type Type of search to perform; options are "Web" or "Image".
- Site Search Restrict results to a specific site by providing its domain.
- File Type Restrict results to a specific file type (e.g., pdf, doc).
- Date Restrict Restrict results by date using formats like d[number], w[number], m[number].

Output

The node outputs JSON data structured as follows:

  • If Return Only Items is set to false (default), the output JSON contains the full response from the Google Custom Search API, including metadata and the list of items.
  • If Return Only Items is true, the output consists of individual items from the search results array, each as a separate JSON object.
  • If no items are found, a message indicating "No items found in response" is returned.
  • The output does not include binary data.

Dependencies

  • Requires an API key credential for Google Custom Search API.
  • Requires a Custom Search Engine ID (cx).
  • The node makes HTTP GET requests to https://www.googleapis.com/customsearch/v1.
  • Proper configuration of credentials with valid API key and Custom Search Engine ID is necessary.

Troubleshooting

  • No credentials found!: This error occurs if the required API key and Custom Search Engine ID credentials are missing. Ensure that valid credentials are configured in n8n before running the node.
  • Empty or no items in response: If the search query returns no results, the node outputs a message indicating no items were found. Verify the query and additional options for correctness.
  • API quota limits or errors: Google Custom Search API has usage limits. Exceeding these may cause errors. Monitor your API usage and ensure your API key has sufficient quota.
  • Invalid parameter values: Parameters like number of results must be within allowed ranges (e.g., 1-10). Providing invalid values may cause API errors.

Links and References

Discussion