Overview
This node performs a Google Custom Search, allowing users to query Google's search engine programmatically within an n8n workflow. It is useful for automating the retrieval of search results based on specific queries and filtering criteria.
Common scenarios include:
- Automatically gathering web or image search results for data analysis or monitoring.
- Integrating search capabilities into workflows that require dynamic content discovery.
- Filtering search results by file type, image attributes, or site restrictions.
For example, you could use this node to fetch the top 50 images related to "electric cars" filtered by dominant color and size, or to retrieve all web pages mentioning a particular product with exact terms included or excluded.
Properties
| Name | Meaning |
|---|---|
| Search Query | The main search string or keywords to query Google Custom Search. |
| Return All | Whether to return all available results or limit the number of results returned. Options: true (return all), false (limit results). |
| Limit | Maximum number of results to return when "Return All" is false. Minimum value is 1. Default is 50. |
| Additional Fields | A collection of optional parameters to refine the search: |
| - Exact Terms | Words that must appear exactly in the search results. |
| - Exclude Terms | Words to exclude from the search results. |
| - File Type | Restrict results to a specific file type (e.g., pdf, doc). |
| - Filter | Enable or disable duplicate content filtering. Options: Off (0), On (1). Default is On. |
| - HQ | Additional query terms to boost relevance. |
| - Image Color Type | Filter images by color type. Options: Color, Gray, Black and White, Transparent Background. Default is Color. |
| - Image Dominant Color | Filter images by dominant color. Options include Black, Blue, Brown, Gray, Green, Orange, Pink, Purple, Red, Teal, White, Yellow. Default is Black. |
| - Image Size | Filter images by size. Options: Huge, Icon, Large, Medium, Small, XL, XXL. Default is Medium. |
| - Image Type | Filter images by type. Options: Animated, Clipart, Face, Line Art, Photo, Stock. Default is Photo. |
| - Link Site | Restrict results to a specific website or domain. |
| - Or Terms | Additional terms where any can appear in results (logical OR). |
| - Rights | Filter images by usage rights. Options: Attribution, Non Commercial, Non Derived, Public Domain, Share Alike. |
| - Search Safety Level | Enable or disable safe search filtering. Options: Active, Off. Default is Off. |
| - Search Type | Type of search to perform. Currently supports only Image search. Default is Image. |
| - Simplified and Traditional Chinese Search | Enable or disable simplified/traditional Chinese search. Options: Disabled (1), Enabled (0). Default is Enabled. |
| - Site Search | Restrict search to a specific site. |
| - Site Search Filter | Include or exclude the specified site in the search. Options: Exclude, Include. Default is Include. |
Output
The node outputs an array of JSON objects representing individual search results. Each item corresponds to one search result entry as returned by the Google Custom Search API.
The structure of each output item includes fields such as:
title: Title of the search result.link: URL of the result.snippet: A brief description or snippet from the page.- Other metadata depending on the search type (e.g., image properties if searching images).
If the node is configured to return all results, it paginates through the API responses until all are collected or the limit is reached.
No binary data output is produced by this node.
Dependencies
- Requires an API key credential for Google Custom Search API access.
- The node uses the Google Custom Search REST API endpoint at
https://www.googleapis.com/customsearch/v1. - Proper configuration of the API key with permissions for Custom Search is necessary.
- No additional external dependencies beyond the API and credentials.
Troubleshooting
Common issues:
- Invalid or missing API key credential will cause authentication errors.
- Exceeding the Google Custom Search API quota limits may result in rate limiting errors.
- Incorrect parameter values (e.g., invalid file types or unsupported options) may cause the API to reject requests.
- If no results are returned, verify the search query and filters for correctness.
Error messages:
- Authentication errors typically indicate problems with the API key setup.
- Quota exceeded errors mean the daily or per-second request limits have been reached; consider increasing quota or reducing request frequency.
- Parameter validation errors suggest incorrect input values; review property settings carefully.