# Web Search API for AI Agents — Multi-Engine SERP API (`agentxpro/web-search-api`) Actor

Web search API for AI agents and RAG — multi-engine search across 34 sources returning clean JSON: web, images, videos, news, maps, science and files, plus full page text. A pay-per-result SERP API and a simple alternative to Tavily, Exa and Serper. No API key; batch up to 1,000 queries per run.

- **URL**: https://apify.com/agentxpro/web-search-api.md
- **Developed by:** [Agent X](https://apify.com/agentxpro) (community)
- **Categories:** AI, Developer tools, SEO tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 search results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Web Search API for AI Agents — Multi-Engine Search

**Cheap, fast, multi-engine web search for AI agents, SEO tools and RAG pipelines.** One run can carry up to 1,000 queries. No API key, no LLM inside — just clean JSON results merged from 34 keyless sources (Bing, DuckDuckGo, Brave, Wikipedia, GitHub, arXiv and more), powered by an open-source metasearch engine. Think of it as a SERP API for programs: queries in, ranked JSON results out.

**For:** AI-agent builders, RAG pipelines, SEO researchers, and anyone who needs search results in JSON without paying per-engine API prices or managing keys.

### Quick start

1. Add your queries to the `queries` list (batch them — one run with 100 queries is far cheaper than 100 runs with 1 query).
2. Pick a `mode`: `search`, `images`, `videos`, `news`, `maps`, `science`, `files`, or `read_page` (fetch full page text for `urls`).
3. Run it and read the Dataset. Every item is one result, charged once.

**Example input**

```json
{
  "queries": ["tokio runtime documentation", "open source metasearch engines compared", "best open source search for AI agents"],
  "mode": "search",
  "maxResults": 5,
  "language": "en",
  "includeRawContent": false,
  "safeSearch": 1
}
```

**Example output (one Dataset item)**

```json
{
  "query": "tokio runtime documentation",
  "mode": "search",
  "title": "Tokio — Asynchronous Rust",
  "url": "https://tokio.rs/",
  "snippet": "Tokio is a runtime for writing reliable asynchronous applications with Rust...",
  "engine": "bing",
  "engines": ["bing", "duckduckgo"],
  "category": "general",
  "language": "en",
  "position": 1,
  "searchedAt": "2026-11-19T10:30:00.000Z",
  "actor": "web-search-api",
  "actorVersion": "0.1.0"
}
```

### Modes

| Mode | What you get |
|---|---|
| `search` | General web results merged and ranked across engines |
| `images` | Image results with `imageUrl` + `thumbnail` |
| `videos` | Video results with thumbnails |
| `news` | News results (combine with `timeRange`: `day` / `week` / `month` / `year`) |
| `maps` | Places / map results |
| `science` | Scholarly results (arXiv, Semantic Scholar, PubMed where available) |
| `files` | File / document results |
| `read_page` | Full page content for the `urls[]` you pass (billed per successful read) — as plain text, Markdown, or raw HTML |

Useful filters: `engines` (allow-list), `includeDomains` / `excludeDomains`, `language`, `timeRange`, `safeSearch` (0–2), `includeRawContent` (attach full page text to each result), `strictEngines` (fail a query on unknown engine names instead of falling back).

### Options

| Option | What it does |
|---|---|
| `maxResults` | Results per query, **1–100** (default 5). Values above 10 walk further result pages automatically — positions stay continuous (1, 2, 3, …) and duplicates are removed before billing |
| `groupByQuery` | Return **one dataset item per query** whose `results` field holds all of that query's results (plus `resultCount`). Charges stay per result — only the shape changes. Ideal for LLM/RAG pipelines that process one query at a time |
| `site` | Only results from one site (e.g. `docs.python.org`), applied to every query — enforced at engine level, so it holds on every source |
| `exactPhrase` | Only results containing this exact phrase, applied to every query |
| `excludeWords` | Space-separated words to exclude from every query |
| `intitle` / `inurl` / `filetype` | Only results with the word/phrase in the title / in the URL / of this file type, applied to every query |
| `pageFormat` | `read_page` output format: `text` (default), `markdown` (best for AI/RAG), or `html` (raw page HTML) |
| `chunkSize` | `read_page`: also split the returned content into `chunks` of this many characters (with `chunkCount`) — ready to embed |
| `maxConcurrency` | Queries processed in parallel inside the run (default 8, max 16). Results are always pushed in input order |
| `agentContext` | Add an `agentContext` object to every delivered result (see *For AI agents* below). Never changes charges |

**Deep results, grouped for an agent:**

```json
{ "queries": ["vector databases compared"], "maxResults": 25, "groupByQuery": true }
```

**Read pages as Markdown, chunked for RAG:**

```json
{ "mode": "read_page", "urls": ["https://tokio.rs/"], "pageFormat": "markdown", "chunkSize": 1000 }
```

**Site-scoped research:**

```json
{ "queries": ["getting started", "routing"], "site": "docs.python.org", "maxResults": 10 }
```

### For AI agents

Turn on `agentContext` and every delivered result also carries an
`agentContext` object, shaped the way AI-agent context APIs answer:
the content cleaned and ready to paste straight into an LLM prompt,
where it came from, and how big it is.

```json
{
  "agentContext": {
    "text": "Example Domain\n\nThis domain is for use in documentation examples…",
    "source": { "type": "search", "url": "https://example.com/", "title": "Example Domain" },
    "citation": "\"Example Domain\" — https://example.com/",
    "tokens": 21,
    "retrievedAt": "2026-11-22T10:15:30.123Z",
    "rank": 1
  }
}
```

- `text` — the result's content as clean text: the full page content
  when raw content is included, otherwise the title plus snippet. In
  `read_page` mode it is the page text (Markdown when
  `pageFormat: "markdown"`).
- `source` — `{type, url, title}`: where this result came from.
- `citation` — a ready-to-paste citation line (with the result's
  date when the source provides one).
- `tokens` — estimated token count of `text` (≈4 characters per
  token), so an agent can budget its context window.
- `retrievedAt` — ISO 8601 UTC time the result was retrieved.
- `rank` — the result's position for the query (search modes).

With `groupByQuery`, each result inside `results` carries its own
`agentContext`, and the grouped row carries one too, holding all of
that query's result texts joined together. `agentContext` is off by
default, adds no rows, and never changes charges — it rides on the
rows you already pay for.

### Pricing (Pay-Per-Event)

| Event | Price | When |
|---|---|---|
| Actor start | $0.0001 | Once per run |
| Search result | $0.0015 — **$1.50 per 1,000 results** | Once per result pushed to the Dataset |
| Page read | $0.0020 — **$2.00 per 1,000 reads** | Only when a page fetch succeeds (`includeRawContent=true` or `mode=read_page`) |

Failed searches, empty results and retries are **never** charged. The prices above are the FREE-plan prices; Apify automatically applies plan discounts (BRONZE / SILVER / GOLD / PLATINUM / DIAMOND pay less).

#### What does $5 of Free credit actually buy? (honest math)

Compute on Apify is billed as CU = memory GB × hours, at $0.20/CU on Free/Starter. This Actor runs at **128 MB**, so one second of runtime costs 0.125 × (1/3600) × $0.20 ≈ **$0.0000069**.

- 100,000 batched searches at ~1 s each ≈ **$0.69 of compute**; at ~2 s each ≈ **$1.39**; at ~5 s each ≈ **$3.47**.
- $5 = 25 CU = **200 hours** at 128 MB. So $5 covers the *compute* for roughly 360k–720k fast batched searches.

**But the per-result fee dominates, and we will not pretend otherwise:** at $1.50 per 1,000 *results*, a search returning 5 results costs $0.0075 in event fees. 100,000 searches × 5 results = 500,000 results = **$750** in event fees — $5 does *not* cover that. **$5 of Free credit is a trial for ~3,300 results at $1.50/1k.** For 100k searches, batch 100–1,000 queries per run, keep `maxResults=5` and `includeRawContent=false`, and use a paid Apify plan for the volume discount. There is no way to make 100k searches both free for the user and profitable for the developer at $1.50/1k results — any Actor claiming that is hiding the fee somewhere.

### Use it from code (API)

```bash
curl -X POST "https://api.apify.com/v2/acts/agentxpro~web-search-api/run-sync-get-dataset-items?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "queries": ["open source metasearch"], "maxResults": 10 }'
```

```python
from apify_client import ApifyClient
client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("agentxpro/web-search-api").call(run_input={
    "queries": ["open source metasearch"], "maxResults": 10,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["position"], item["title"], item["url"])
```

### MCP

This Actor is Pay-Per-Event, so it is MCP-compatible: connect your MCP client (Claude, ChatGPT, Cursor) to Apify's official MCP server (https://mcp.apify.com) with your Apify token, add this actor (`agentxpro/web-search-api`) to the tool list, and the agent can search the web and read pages through it in plain language.

### Limits (v1)

- One engine profile only (34 keyless sources). No Google HTML scraping, no login/paywall bypass.
- No JavaScript rendering — pages that need a browser return snippets only.
- No PDF text extraction in v1; no login/paywall pages.
- Results are ranked snippets from many engines, **not** AI-written answers (there is no LLM in this Actor).
- Upstream engines can rate-limit or go down; the Actor retries, logs the engine, and continues with the others. A query with no results is logged and charged $0.
- `maxResults` goes up to 100 per query; very deep pulls depend on how much the upstream sources hold for that query, and duplicates across pages are removed before billing.

### FAQ

**Do I need an API key or a subscription?**
No API key and no monthly subscription — you run it with your Apify account and pay per result. Failed and empty searches are never charged.

**How is this different from Tavily, Exa, Serper or the Brave Search API?**
Those are single-provider APIs with their own keys and plans. This actor merges results from 34 sources into one ranked JSON feed, bills per result instead of per search, and needs no key management. If you already pay for one of them, this is a cheap second opinion; if you don't, it's the simplest way to give an agent web search.

**Can AI agents call it directly?**
Yes — it is MCP-compatible (see the MCP section above), and it can also be called from any code through the Apify API or wired into Make, Zapier and n8n.

**Which kinds of search are supported?**
Web, images, videos, news, maps and places, science and scholarly, and file/document search — plus `read_page` mode, which fetches the full text of specific URLs.

**How many queries can one run carry?**
Up to 1,000 queries per run. Batching is the cheapest way to use it: one run of 100 queries costs far less compute than 100 separate runs.

**How many results can one query return?**
Up to 100 (`maxResults`). Above 10 the actor walks further result pages and merges them, removing duplicates before billing.

**Can I get one item per query instead of one per result?**
Yes — `groupByQuery` returns one item per query with a `results` array inside. Same charges, friendlier shape for agents.

**Can read_page return Markdown or chunks?**
Yes — `pageFormat: "markdown"` returns Markdown, and `chunkSize` adds ready-to-embed `chunks` to the same item.

**Where do the results come from?**
From 34 public search sources, merged and de-duplicated. Every result names the source it came from in its `engine` / `engines` fields, so you can audit where an answer came from.

### Legal / compliance

- Built on open-source components; all license texts are included in the package.
- Only documented public APIs and feeds are used. Provider terms are respected; `robots.txt` is honoured for page reads; private/localhost URLs are rejected.
- A code license does not grant rights over provider data — you are responsible for how you use the results.

### Support

- Actor issues: use the **Issues** tab on this Actor's Apify page.
- Platform issues: [Apify Discord](https://discord.com/invite/jyEM2PRvMU).

# Actor input Schema

## `category` (type: `string`):

Alias for mode. If both mode and category are set, mode wins.

## `chunkSize` (type: `integer`):

read_page mode: also split the returned page text into chunks of this many characters (a chunks array plus chunkCount on the same item) — ready to embed for RAG pipelines. 0 = no chunking.

## `debug` (type: `boolean`):

If true, each output item includes a debug object with upstream engines tried, timings and raw content status.

## `engines` (type: `array`):

Optional source allow-list, e.g. wikipedia, github, arxiv, bing, duckduckgo. Empty = all available sources.

## `exactPhrase` (type: `string`):

Only results containing this exact phrase (applied to every query in the run).

## `excludeDomains` (type: `array`):

Never return results from these domains.

## `excludeWords` (type: `string`):

Words to exclude from every query in the run, separated by spaces (each becomes a -word operator).

## `filetype` (type: `string`):

Only results of this file type for every query in the run, for example pdf, docx or csv (files mode).

## `groupByQuery` (type: `boolean`):

Return ONE dataset item per query whose results field holds all of that query’s results, instead of one item per result. Charges stay per result — only the shape changes. Convenient for LLM and RAG pipelines that process one query at a time.

## `includeDomains` (type: `array`):

Only return results from these domains.

## `includeRawContent` (type: `boolean`):

Fetch the full text of each result page. Slower and billed per successful page read (page-read event).

## `intitle` (type: `string`):

Only results with this word or phrase in the page title (applied to every query in the run).

## `inurl` (type: `string`):

Only results with this word or phrase in the URL (applied to every query in the run).

## `language` (type: `string`):

Result language, e.g. en, ja, ko, de, fr, es, zh-CN.

## `maxChars` (type: `integer`):

For read_page mode and raw content. 500–20000.

## `maxConcurrency` (type: `integer`):

How many queries to process in parallel inside the run. Higher is faster on big batches; results are always pushed in input order. Default 8.

## `maxResults` (type: `integer`):

1–100 results per query. Default 5 keeps runs cheap and fast; higher values walk more result pages automatically.

## `mode` (type: `string`):

Search type: search (web results), images, videos, news, maps, science, files, or read_page (fetch full page text for the urls\[] instead; ignores queries).

## `pageFormat` (type: `string`):

read_page mode: the format of the returned page content — text (plain extracted text, default), markdown (Markdown, best for AI/RAG), or html (the raw page HTML).

## `proxyConfiguration` (type: `object`):

Apify proxy configuration. Default in v1 is no proxy (direct); enable Apify datacenter proxies only if upstreams block direct requests.

## `queries` (type: `array`):

1–1000 search queries per run. Batch many queries in one run — it is far cheaper than one run per query. Each query 1–500 chars; duplicates are removed (case-insensitive).

## `region` (type: `string`):

Region hint, e.g. us, gb, de, jp, in. Passed through when the upstream supports it.

## `safeSearch` (type: `integer`):

0 = off, 1 = moderate, 2 = strict.

## `site` (type: `string`):

Only results from this site for every query in the run, for example docs.python.org (a site: filter).

## `strictEngines` (type: `boolean`):

If true, an unknown engine name fails that query with an error instead of silently falling back to all engines.

## `timeRange` (type: `string`):

Limit results by age. Empty = any time.

## `urls` (type: `array`):

Up to 100 public http/https URLs to fetch page text from when mode=read_page.

## `agentContext` (type: `boolean`):

Add an agentContext object to every delivered result: the result's content as clean text ready to paste into an LLM prompt (the full page content when raw content is included, otherwise title + snippet), a source block (type, URL, title), a ready-to-paste citation, the result's rank, an estimated token count and the retrieval time. Modelled on the response style AI-agent APIs use. Off by default; never changes charges.

## Actor input object example

```json
{
  "category": "general",
  "chunkSize": 0,
  "debug": false,
  "groupByQuery": false,
  "includeRawContent": false,
  "language": "en",
  "maxChars": 4000,
  "maxConcurrency": 8,
  "maxResults": 5,
  "mode": "search",
  "proxyConfiguration": {
    "useApifyProxy": false
  },
  "region": "us",
  "safeSearch": 1,
  "strictEngines": false,
  "timeRange": "",
  "agentContext": false
}
```

# Actor output Schema

## `results` (type: `string`):

One row per result delivered by the run: search results (web, images, videos, news, maps, science, files) or extracted page text in read_page mode. Failed queries appear as error rows and are never charged.

## `summary` (type: `string`):

Small JSON record in the default key-value store under the SUMMARY key: queries processed, results pushed, page reads, errors and elapsed seconds for the run.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("agentxpro/web-search-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("agentxpro/web-search-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call agentxpro/web-search-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,agentxpro/web-search-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/mVXVdY5gyCd6Qanio/builds/Eci0Igty1QTatCkv6/openapi.json
