Description
n8n-nodes-websearch
Smart web search node for n8n with multiple provider fallback. Automatically tries different search APIs until it gets good results.
Features
- Smart Fallback: Automatically tries providers in sequence until good results are found
- 7 Search Providers: Tavily, Serper.dev, Exa, Google CSE, Brave Search, SerpApi, DuckDuckGo
- Dual Validation: Checks both result count AND quality before accepting results
- Three Modes: Auto (smart fallback), Specific provider, or Custom priority order
- Tool Ready: Can be used as a tool in AI agent workflows (
usableAsTool: true) - Pure Node.js: No Python or external dependencies required
- Modular: Easy to add/remove providers
Installation
From npm
npm install n8n-nodes-websearch
In n8n
- Go to Settings > Community Nodes
- Enter
n8n-nodes-websearch - Click Install
Provider Priority (Default Order)
| Priority | Provider | Free Tier | Best For |
|---|---|---|---|
| 1 | Tavily | 1,000/month | AI-native, LLM-ready results |
| 2 | Serper.dev | 2,500/month | Google SERPs, very fast |
| 3 | Exa | Free tier | Neural/semantic search |
| 4 | Google CSE | 100/day | Reliable, traditional |
| 5 | Brave Search | Free tier | Privacy-first |
| 6 | SerpApi | 100/month | Multi-engine fallback |
| 7 | DuckDuckGo | Unlimited | No API key needed |
Credentials Setup
Add your API keys in n8n credentials. You only need to configure the providers you want to use:
| Provider | Required Fields | Get API Key |
|---|---|---|
| Tavily | API Key | tavily.com |
| Serper.dev | API Key | serper.dev |
| Exa | API Key | exa.ai |
| Google CSE | API Key + Search Engine ID | Google Cloud Console |
| Brave Search | API Key | brave.com/search/api |
| SerpApi | API Key | serpapi.com |
| DuckDuckGo | Enable toggle | No API key needed! |
Usage
Auto Mode (Recommended)
The node automatically tries providers in sequence until it finds good results:
- Checks if each provider is configured (has API key)
- Tries the search
- Validates results (minimum count + quality)
- If not satisfied, tries next provider
- Returns best results found
Specific Provider Mode
Force use of a specific provider (useful for testing or when you want specific results).
Custom Priority
Override the default sequence with your own order:
serper,tavily,brave,duckduckgo
Node Options
| Option | Default | Description |
|---|---|---|
| Max Results | 10 | Maximum results to return |
| Min Results | 3 | Minimum results before trying next provider |
| Region | us | Region code (us, uk, de, fr, in, etc.) |
| Language | en | Language code |
| Safe Search | true | Enable safe search filtering |
| Time Range | all | Filter by time (day, week, month, year, all) |
Output Format
{
"query": "example search",
"success": true,
"results": [
{
"title": "Result Title",
"url": "https://example.com",
"snippet": "Description of the result...",
"source": "example.com"
}
],
"provider": "tavily",
"meta": {
"totalResults": 10,
"searchTime": 234,
"attemptedProviders": [
{ "provider": "tavily", "success": true, "resultCount": 10 }
],
"mode": "auto"
}
}
Adding New Providers
The node is designed to be modular. To add a new provider:
- Add entry in
nodes/WebSearch/config/providers.ts - Create provider file in
nodes/WebSearch/providers/ - Register in
nodes/WebSearch/providers/index.ts - Add credential fields in
credentials/WebSearchApi.credentials.ts
License
MIT