Searxng icon

Searxng

Perform web searches using Searxng

Overview

The Searxng node enables n8n workflows to perform web searches using a Searxng metasearch engine instance. It allows users to specify search queries, select categories (such as images, news, videos, etc.), and fine-tune results with additional options like language, time range, safe search level, and output format. This node is useful for automating information retrieval tasks, content aggregation, or integrating search capabilities into larger automation pipelines.

Practical examples:

  • Automatically gather the latest news articles on a topic.
  • Search for images or files related to a project.
  • Retrieve scientific articles or social media mentions for monitoring purposes.

Properties

Name Type Meaning
Query string The search query to perform. Can be provided directly or via AI agent input.
Categories multiOptions Categories to search in (e.g., General, Images, News, Videos, Files, IT, Maps, etc.).
Return Single Response boolean If enabled, returns only the content from the first search result as a string.
Additional Fields collection Optional settings to refine the search:
— Language options Language of the search results (English, German, French, Spanish, Italian, All Languages).
— Time Range options Time range for the search results (Any Time, Day, Week, Month, Year).
— Safe Search options Safe search level (Off, Moderate, Strict).
— Page Number number Page number of results (minimum value: 1).
— Format options Output format of the search results (HTML, JSON, RSS).

Output

  • If Return Single Response is enabled and results are found:
    {
      "success": true,
      "query": "<your query>",
      "answer": "<content of the first search result>"
    }
    
  • Otherwise, for each search:
    {
      "success": true,
      "query": "<your query>",
      "results": [
        {
          "title": "<result title>",
          "url": "<result URL>",
          "content": "<main content>",
          "snippet": "<short snippet or content>"
        },
        ...
      ],
      "metadata": {
        "total": <number of results>,
        "time": <search time>,
        "engine": "<search engine name>"
      },
      "raw": { ...full API response... }
    }
    
  • On error (if "Continue On Fail" is enabled):
    {
      "success": false,
      "error": "<error message>",
      "query": "<your query>"
    }
    

Dependencies

  • External Service: Requires access to a Searxng instance with API support.
  • Credentials: Needs an n8n credential named searxngApi containing:
    • apiUrl: Base URL of the Searxng instance.
    • apiKey: API key for authentication.
  • n8n Configuration: Ensure the Searxng credential is set up in n8n.

Troubleshooting

  • Missing Credentials:
    Error: "No credentials got returned!"
    Resolution: Make sure the Searxng API credentials are configured correctly in n8n.

  • API Errors:
    If the Searxng instance returns an error (e.g., invalid API key, network issues), the node will either throw the error or, if "Continue On Fail" is enabled, output a JSON object with success: false and the error message.

  • Empty Results:
    If no results are found, the results array will be empty. Check your query and category selections.

  • Invalid Parameters:
    Providing unsupported values (e.g., wrong format for page number) may cause errors. Ensure all fields are filled according to their expected types and ranges.

Links and References

Discussion