Web Search in n8n: HTTP Request, AI Agent or Community Node
The quickest way to add web search to an n8n workflow is the built-in HTTP Request node. It calls any search API with a REST endpoint, needs nothing installed, and works on n8n Cloud as well as self-hosted. Attach the same node to an AI Agent as a tool and the model fills in the query itself with $fromAI(). If you're self-hosting and want fewer settings to manage, a community node such as n8n-nodes-serpex does the same job with a form instead of a raw request.
This post walks through all three with Serpex as the example API. The HTTP Request steps work the same way for any other search API: swap the URL, the auth header and the body.
1. The HTTP Request node
Add an HTTP Request node after your trigger and set it up like this:
| Setting | Value |
|---|---|
| Method | POST |
| URL | https://api.serpex.dev/api/search |
| Authentication | Generic Credential Type, then Header Auth |
| Header Auth credential | Name Authorization, value Bearer sk_your_api_key |
| Send Body | On, Body Content Type JSON |
| Body | Using Fields Below: name q, value {{ $json.query }} |
Keep the API key in a credential rather than typing it into a header field, so you can reuse it across workflows.
You can also skip the form. The node has an Import cURL button, and the cURL example in our Search API reference pastes straight in:
curl -X POST https://api.serpex.dev/api/search \-H "Authorization: Bearer sk_your_api_key" \-H "Content-Type: application/json" \-d '{"q": "best JavaScript frameworks 2025"}'
n8n fills the method, URL, headers and body for you. Then replace the hard-coded query with an expression such as {{ $json.query }}, and move the key into a Header Auth credential.
Getting page content, not just snippets
A plain search returns titles, URLs and snippets. If the next step is an LLM that has to read the pages, ask for the page text in the same request with include_content. This needs a boolean and a number, and n8n's docs say that to keep numbers and booleans in their original types you should switch from Using Fields Below to Using JSON:
{"q": {{ JSON.stringify($json.query) }},"include_content": true,"content_results": 5}
JSON.stringify puts the quotes around the query for you, so a query that contains quotation marks doesn't break the JSON. content_results must be exactly 5 or 10.
Turning the response into items
The node returns one item holding the whole response: a results array plus a metadata object. To get one n8n item per result, add a Split Out node and split on results. Each item then has title, url, snippet and position, and content or content_error if you asked for page text. A result only ever carries one of those two.
Staying under the rate limit
If 500 rows come in from a spreadsheet, the HTTP Request node sends 500 requests. Its Batching option sets how many items go per batch and how long to wait between batches. Serpex allows 5, 25 or 50 requests a second depending on your plan (rate limits), so on the smallest plan a batch of 5 with a 1,000 ms interval keeps you under it. A 429 response comes back with a Retry-After header if you do go over.
2. Web search as an AI Agent tool
The HTTP Request node can also sit under an AI Agent node as a tool. The agent decides when to search, and fills the query in for you.
- Open the AI Agent node's Tool connector and add HTTP Request.
- Configure it exactly as above: POST, the same URL and the same Header Auth credential.
- For the body, use Fields Below with name
qand this value:
{{ $fromAI('query', 'The web search query to run', 'string') }}
$fromAI() tells n8n that the model should supply this value. The first argument is the key, and the description is the hint the model reads when it decides what to put there. It only works in tools connected to the AI Agent node.
Search responses can be long, and everything the tool returns goes into the model's context. The HTTP Request node has a tool-only option for this, Optimize Response. Choose JSON, set Field Containing Data to results, and under Include Fields pick Selected with title,url,snippet. The agent then gets a compact list instead of the whole response, which costs fewer tokens.
If your agent needs to read pages rather than skim them, give it a second HTTP Request tool with include_content on, and make the difference clear in its $fromAI() description, for example "a query whose top pages must be read in full". A content search costs 3 or 6 credits instead of 1, so it's worth keeping the plain search as the default.
3. The Serpex community node
n8n-nodes-serpex wraps the same API in a regular n8n node. Version 1.1.0 was published to npm on 1 October 2026.
| Operation | What it does |
|---|---|
| Search | Runs a web search. Include Content adds page markdown for the top 5 or 10 results |
| Extract | Turns 1 to 10 known URLs into markdown or HTML |
| Usage | Returns request counts and your credit balance, free |
To install it, go to Settings > Community Nodes, select Install, enter n8n-nodes-serpex, accept the risk notice and select Install. Then create a Serpex API credential with your key. Testing the credential calls the free usage endpoint, so it doesn't spend a credit.
Two limits to know:
- Self-hosted only. n8n's docs say unverified community nodes "aren't available on n8n cloud and require self-hosting n8n". On a self-hosted instance only Owner and Admin users can install them.
- The node can be an agent tool too. Version 1.1.0 marks it as usable as a tool, so you can attach it to the AI Agent's Tool connector in place of the HTTP Request setup.
If you have workflows saved with an older version of the node, they still load. The old Engine, Time Range, Number of Results, Location and Language fields show as deprecated and are no longer sent, because the API ignores them.
Which one should you use?
| Your situation | Use |
|---|---|
| You're on n8n Cloud | HTTP Request node |
| You might switch search providers later | HTTP Request node, so only the URL, header and body change |
| You're self-hosting and want the fewest settings | The community node |
| You also need to extract known URLs | The community node, or a second HTTP Request to /api/crawl |
| An AI Agent should decide when to search | Either one, attached to the agent's Tool connector |
What it costs
| Request | Credits |
|---|---|
| Plain search | 1 |
| Search with page content, 1 to 5 pages delivered | 3 |
| Search with page content, 6 to 10 pages delivered | 6 |
| Same request again from your organization within 5 minutes | 0 |
| Errors | 0 |
Credits are pay as you go with no subscription: $0.80 per 1,000 searches on Starter, $0.65 on Standard and $0.50 on Scale, checked on our pricing page on 3 October 2026. New accounts get 200 free credits with no card, enough to build and test a workflow. The free repeat within 5 minutes is handy while you're clicking Execute step over and over.
If you're comparing APIs to put behind the HTTP Request node, the per-1,000 prices for a dozen of them are in Search API Pricing in 2026.
FAQ
Does web search work on n8n Cloud?
Yes, through the HTTP Request node, which is built in. Unverified community nodes, including the Serpex node, need a self-hosted instance.
Can I use another search API with the same setup?
Yes. The HTTP Request node works with any REST API. Change the URL, the auth header and the body fields to match that API's docs, or paste its cURL example into Import cURL.
Why does the agent get too much text back?
Turn on Optimize Response on the HTTP Request tool and keep only title, url and snippet. Use page content only in a separate tool the agent calls when it needs the full page.
Can the agent search and then read a specific page?
Yes. Give it a search tool and an extract tool. With the community node, that's the Search and Extract operations. With HTTP Request, it's a second node calling POST https://api.serpex.dev/api/crawl with a urls array, described in the Extract API reference.