Actions2
Overview
This node performs web and image searches using the Google Custom Search API. It allows users to query Google for either general web pages or images, returning relevant search results based on the input query and options.
Common scenarios where this node is beneficial include:
- Automatically retrieving images related to a topic for content creation or social media posts.
- Gathering web page links and snippets for research, monitoring, or data aggregation.
- Filtering search results by language or domain to focus on specific regions or websites.
For example, a user can input a query like "n8n automation" with image search enabled to get thumbnails and links of related images, or perform a web search limited to a particular site such as "example.com" to gather targeted information.
Properties
| Name | Meaning |
|---|---|
| Query | The search query string to look up on Google. |
| Return All | Whether to return all available results (up to 10) or limit the number of results returned. |
| Limit | Maximum number of results to return when not returning all (1 to 10). |
| Options | Additional search options: |
| - Safe Search | Level of safe search filtering: Off, Medium, or High. |
| - Site Search | Restrict results to a specific domain (e.g., "example.com"). |
| - Language | Language restriction for search results: English, Italian, French, German, or Spanish. |
Output
The node outputs an array of JSON objects, each representing a search result item. Each item contains:
title: Title of the search result.link: URL of the result.snippet: A short description or snippet from the page.displayLink: Display-friendly version of the link.image(only for image search): An object with thumbnail URL, height, and width of the image.
If no results are found for a query, the output includes a message indicating no results were found.
If errors occur and the node is configured to continue on failure, error messages are included in the output JSON.
The node does not output binary data.
Dependencies
- Requires a valid Google Custom Search API key and a Custom Search Engine ID.
- The node uses the Google Custom Search REST API endpoint (
https://www.googleapis.com/customsearch/v1). - Users must configure credentials in n8n with their API key and Custom Search Engine ID.
- No additional external dependencies beyond the HTTP client library bundled with n8n.
Troubleshooting
- Empty Query Error: If the search query is empty or whitespace, the node throws an error "Search query cannot be empty". Ensure the query parameter is properly set.
- API Credential Issues: Errors related to missing or invalid API key or Custom Search Engine ID will cause connection failures. Verify that credentials are correctly configured.
- API Rate Limits: The node tracks daily query counts but Google enforces its own quota limits. Exceeding these may result in API errors.
- No Results Found: When no search results match the query, the node returns a message indicating no results rather than failing.
- Error Messages from API: If the Google API returns an error, the node surfaces the error message. Common causes include invalid parameters or quota exceeded.
- To handle errors gracefully, enable "Continue On Fail" in the node settings to capture errors in output instead of stopping execution.