> ## Documentation Index
> Fetch the complete documentation index at: https://docs.querying.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Web search API for agents

> Search the web and get each result with the passages of the page that answer the query, in the same call.

`POST /v1/search` answers a query with web results an agent can read at once: each result's address, title and snippet, a relevance score, and the passages of the page that answer the query. It holds the request open and returns the results in the same call. One endpoint serves both kinds of search; `type` chooses between them.

| | |
| - | - |
| Endpoint | `POST /v1/search` |
| `taskType` | `task.taskType` answers `SEARCH`. Capabilities, key scopes and usage list it as `WEB_SEARCH`, and a key scope takes either name. `POST /v1/async/task` refuses both with `400 USE_DEDICATED_ENDPOINT`. |
| Input | `query` (required); `type`, `numResults`, `contents`, `userLocation`, `source`, `includeDomains`, `excludeDomains` |
| Credits | 0.5 per search, 2 per pro search |
| Country | Optional. Leave `userLocation` out for the fastest answer; `source: "naver"` is `KR`. |

## Request

```bash theme={"theme":"css-variables"}
curl -X POST https://api.querying.ai/v1/search \
  -H "Authorization: Bearer $QUERYING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "query": "how do heat pumps work in cold climates", "type": "pro", "numResults": 5 }'
```

The endpoint takes the fields below at the top level, beside `idempotencyKey`, `priority` and `webhook`, and refuses any other field with `400 VALIDATION_ERROR`. It answers with the task as [`GET /v1/async/task/:id`](https://docs.querying.ai/concepts/async-tasks) does: `task`, `credits` and `response`, or `error` when the search failed. A search still running after 30 seconds is answered with its `task` alone; read it from `GET /v1/async/task/:id`.

## Parameters

| Field | Required | Description |
| - | - | - |
| `query` | Yes | The search, up to 400 characters. It may carry operators: `site:example.com` and `-site:example.com` add to `includeDomains` and `excludeDomains`, `site:example.com/docs` keeps the results to the site and asks the engines for pages under that address, and `after:2026-04-25` and `before:2026-07-24` keep the results to pages published between those days (a page whose date is unknown is kept). The response's `query` is the query as it was sent. |
| `type` | No | `standard` reads the pages behind the search engines' results and ranks them by how well their text answers the query, in about two seconds. `pro` also searches the query in other wordings a language model writes and has the model choose the passages, in about four seconds. Defaults to `standard`. |
| `numResults` | No | How many results to return, 1 to 10. Defaults to 5. |
| `contents` | No | `{ "text": { "maxCharacters": 4000 } }` sets the most characters of page text one result carries in `text`, 200 to 10,000. Defaults to 2,000. `{ "text": true }` keeps the default. |
| `userLocation` | No | The market the results are for, a two-letter country code. Leave it out unless the results must be one country's: a search without it answers fastest, in the query's language. `google` defaults to `US`; `naver` takes `KR` only. |
| `source` | No | The search engine: `bing`, `google` or `naver`. A search that names none answers `source: "all"` and asks several engines: Bing, Brave and Google, and for a pro search also Naver when the query is in Korean. A search that names a source asks that engine alone, in the caller's wording. `naver` searches the Korean web, blogs, cafes and news included. |
| `includeDomains` | No | Up to 20 host names. Only results on these sites, subdomains included, are returned. |
| `excludeDomains` | No | Up to 20 host names. Results on these sites are left out. |

Values out of range return `422`.

## Response

```json theme={"theme":"css-variables"}
{
  "query": "how do heat pumps work in cold climates",
  "source": "all",
  "type": "standard",
  "results": [
    {
      "url": "https://www.example.com/heat-pumps-cold-climates",
      "title": "...",
      "snippet": "...",
      "text": "## How cold-climate heat pumps work\n\n...",
      "score": 0.93,
      "publishedDate": "2026-09-12T07:36:36Z",
      "siteName": "..."
    }
  ]
}
```

| Field | Description |
| - | - |
| `results` | Sorted by `score`, results that carry `text` first. Empty when the search engine found nothing. |
| `url`, `title`, `snippet` | As the search engine's results page shows them. |
| `text` | Passages of the page in page order, up to `contents.text.maxCharacters`. Plain text with headings as `#` lines, list items as `-` lines and table rows with cells joined by `\|`. Absent when the page was not read in time or gives no text to a plain request; the result then carries its `snippet` alone. |
| `score` | 0 to 1, how well the result answers the query beside the other results. Comparable within one response only. |
| `publishedDate` | The page's date as ISO 8601, a time when the page or the results page gives one and a day (`2026-09-12`) otherwise. Absent when neither declares a date. |
| `siteName` | Present when the page declares it. |

## Limits and errors

* Search does not open a browser, so a page that needs script to show its text returns its snippet. Pass its `url` to [Scrape](https://docs.querying.ai/engines/web-scrape.md) to read it in full.
* A PDF is read for its text. A scanned PDF with no text, an encrypted one and one over 32 MiB return their snippet.
* A search answers as long as one engine does. A search no engine could serve fails the task with that engine's error, such as `BING_HTTP_429`.
* An account can send 5 searches per second, 1 on the free plan, sub-accounts counted together. A search over the rate returns `429 RATE_LIMITED` with `Retry-After` and is not charged. Searches take no concurrency slot. See [Credits and limits](https://docs.querying.ai/concepts/credits-and-limits.md#request-rate-and-backpressure).
* Other request errors are listed in [Errors](https://docs.querying.ai/concepts/errors.md).

## Related

* [Scrape](https://docs.querying.ai/engines/web-scrape.md) to read one result's whole page, script-drawn pages included.
* [Google Search](https://docs.querying.ai/engines/google-serp.md) for the results page with its ads and blocks.
* [API reference](https://docs.querying.ai/api-reference/search.md) for the full request and response schema.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.