Overview
This node performs image searches using the DuckDuckGo search engine. It allows users to find images on the web based on specified search terms and various filtering options. The node is useful for automating workflows that require retrieving relevant images, such as content creation, marketing automation, or data enrichment.
Typical use cases include:
- Automatically fetching images related to a topic or keyword.
- Integrating image search results into content management systems.
- Gathering visual references or media assets for projects.
For example, you can input a query like "sunset beach" and receive a list of image URLs and metadata matching that description, optionally filtered by region, safe search level, and maximum number of results.
Properties
| Name | Meaning |
|---|---|
| Locale | Specify the language/region locale for the search. Options include English (US), Spanish (Spain), French (France), German (Germany), Japanese (Japan), Russian (Russia), Chinese (China), and others. |
| Use API Key | Whether to authenticate requests with an API key credential for DuckDuckGo API access. |
| Image Search Query | The search terms to find images for. Must be a non-empty string. |
| Image Search Options | Collection of options: - Maximum Results: Number between 1 and 100 specifying max images returned. - Region: Target region for image search (e.g., United States, Germany, Brazil). - Safe Search: Content filtering level with options Strict (filter explicit), Moderate (default), Off (no filtering). - Return Raw Results: Boolean to return raw API response instead of processed results. |
| Error Handling | How errors are handled during execution: - Break on Error: Stop execution on error. - Continue on Error: Proceed even if errors occur. |
| Debug Mode | When enabled, includes detailed request and response logs for troubleshooting purposes. |
| Cache Settings | Collection of cache-related settings: - Enable Cache: Whether to cache search results. - Cache TTL: Time in seconds to keep cached results (60 to 86400). |
| Enable Telemetry | Whether to send anonymous usage data to help improve the node (no personal data collected). |
Output
The node outputs JSON objects containing the results of the image search. The structure includes:
success: Boolean indicating if the search was successful.query: The original search query string.count: Number of results returned (0 if none).results: An array of image result objects when processed output is returned. Each result typically contains image URL, title, source, and other metadata.- If "Return Raw Results" is enabled or debug mode is active, the full raw API response is included under
result. - Additional fields when debug mode is enabled:
requestOptions(parameters used) andfromCache(boolean indicating if results came from cache). - On failure,
errorcontains a descriptive message, and optionallyerrorDetailswith stack trace or additional info.
The node does not output binary data; it only returns JSON metadata about images.
Dependencies
- Uses the external
duck-duck-scrapelibrary to perform DuckDuckGo searches. - Optionally requires an API key credential if "Use API Key" is enabled.
- Supports caching internally to improve performance for repeated queries.
- Telemetry reporting is integrated but optional and anonymous.
- No special environment variables are required beyond standard n8n credentials setup if API key authentication is used.
Troubleshooting
Common Issues
- Missing API Key: If "Use API Key" is enabled but no API key credential is provided, the node will throw an error requiring the API key.
- No Results Found: Queries may return zero results if the search terms are too specific, misspelled, or filtered out by safe search settings.
- Rate Limiting or API Errors: External API calls might fail due to rate limits or network issues, resulting in error messages.
- Cache Staleness: Cached results may become outdated depending on the TTL setting; adjust cache TTL as needed.
Error Messages and Resolutions
"API key is required when 'Use API Key' is enabled!": Provide a valid API key credential in n8n.- Errors including
"search_failed"events indicate issues during the search operation; enabling debug mode will provide detailed logs to diagnose. "The operation ... is not supported!": Indicates an invalid operation parameter; ensure "Image Search" operation is selected.- Network or parsing errors are logged with details when debug mode is enabled; check connectivity and input parameters.
Links and References
- DuckDuckGo Search Engine
- duck-duck-scrape npm package (used internally)
- n8n Documentation on Creating Custom Nodes