> SpecStream is the live web data engine for teams and agents. This is the Markdown copy of https://specstream.ai/docs/web-search. Every page, with what SpecStream does and costs: https://specstream.ai/llms.txt

# Web Search API: GET and POST /v1/web-search

Reference for `GET /v1/web-search` and `POST /v1/web-search` on both `speed="fast"` ($1 per 1,000 searches, 937 ms median) and `speed="default"` ($5 per 1,000 searches), including live domain boosting and filtering with `boost_domains`, `include_domains`, and `exclude_domains`.

## Endpoints and speed tiers

Send `GET https://api.specstream.ai/v1/web-search` with query parameters or `POST https://api.specstream.ai/v1/web-search` with a JSON body using the exact same parameter names. Use `POST` to keep queries and domain lists out of URL logs. Create a key under [Agents & API](https://specstream.ai/workspace/keys); new accounts get $2 of credit, no card (2,000 fast searches or 400 default searches). SpecStream ranks first on WideSearch (60.93 low-cost, ahead of every search API) and scores 99 on SimpleQA Verified ([full benchmark tables](https://specstream.ai/benchmarks.md)).

Already calling Exa, Tavily, Perplexity, Firecrawl, Google Custom Search, Brave, or Serper? [Browse all 70+ drop-in API migration guides](https://specstream.ai/migrate.md) or generate a 1-line swap in the [Drop-in API converter](https://specstream.ai/tools/drop-in-api-converter.md). See the overview in [Search API docs](https://specstream.ai/docs/search-api.md) or the live OpenAPI schema at [api.specstream.ai/openapi.json](https://api.specstream.ai/openapi.json).

## Domain boosting and filtering

Three parameters control which sites appear in `GET` and `POST /v1/web-search` responses. Each parameter accepts up to 20 domains (`nrk.no`), subdomains (`news.nrk.no`), or TLDs (`.no`), sent as a JSON array, a single comma-separated string, or repeated query parameters. Optional path prefixes such as `example.com/docs` are supported, and leading schemes, `www.`, or `*.` are stripped automatically.

| Parameter | Type | Behavior |
| --- | --- | --- |
| `boost_domains` | `string[] \| string` | Rank results from these sites first, followed by results from the rest of the web. Accepts up to 20 domains (nrk.no), subdomains (news.nrk.no), or TLDs (.no) as a JSON array or comma-separated string (or repeated GET query parameters). SpecStream also asks for the top boosted sites by name so their pages surface when a plain query returns none. Works with speed fast and default; cannot be combined with include\_domains, news, or images (HTTP 422). |
| `include_domains` | `string[] \| string` | Return only results from these sites. Accepts up to 20 domains (apple.com), subdomains (news.nrk.no), or TLDs (.no) as a JSON array or comma-separated string. Optional path prefixes such as example.com/docs are supported; leading scheme, www., and \*. are normalized automatically. Cannot be combined with boost\_domains (HTTP 422). |
| `exclude_domains` | `string[] \| string` | Remove results from these sites. Accepts up to 20 domains, subdomains, or TLDs (.no) as a JSON array or comma-separated string. Works alongside either include\_domains or boost\_domains, and across web, news, and image searches. |

**Combination rules:** `exclude_domains` works with both `include_domains` and `boost_domains`. Combining `include_domains` and `boost_domains` in the same request returns `422`, because `include_domains` already restricts the result set to those sites. Sending `boost_domains` with `news=true` or `images=true` also returns `422`.

Calling through the You.com drop-in route (`/you/v1/search`)? `boost_domains`, `include_domains`, and `exclude_domains` pass straight through to the same live ranking layer ([You.com migration guide](https://specstream.ai/migrate/you.md)).

## cURL, Python, and JavaScript examples

### cURL: POST /v1/web-search with boost\_domains and exclude\_domains (speed: "fast")

Terminal

```bash
curl -X POST https://api.specstream.ai/v1/web-search \
  -H "Authorization: Bearer $SPECSTREAM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "q": "electric vehicle grid tariff updates",
    "speed": "fast",
    "num": 10,
    "boost_domains": ["nrk.no", "regjeringen.no", ".no"],
    "exclude_domains": ["pinterest.com", "reddit.com"]
  }'
```

### cURL: GET /v1/web-search with include\_domains and exclude\_domains (speed: "default")

Terminal

```bash
curl -G https://api.specstream.ai/v1/web-search \
  -H "Authorization: Bearer $SPECSTREAM_API_KEY" \
  --data-urlencode "q=EU AI Act GPAI enforcement timeline" \
  -d "speed=default" \
  -d "include_domains=europa.eu,eur-lex.europa.eu" \
  -d "exclude_domains=blog.example.com"
```

### Python: fast boost\_domains and default include\_domains

Python

```python
import os
import requests

API_KEY = os.environ["SPECSTREAM_API_KEY"]
HEADERS = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}

# 1. Fast search ($1/1,000): prioritize preferred domains and TLDs, keep rest of web after
fast_res = requests.post(
    "https://api.specstream.ai/v1/web-search",
    headers=HEADERS,
    json={
        "q": "offshore wind tender award",
        "speed": "fast",
        "num": 10,
        "boost_domains": ["nrk.no", "news.nrk.no", ".no"],
        "exclude_domains": ["pinterest.com"],
    },
    timeout=30,
)
fast_res.raise_for_status()
for src in fast_res.json()["data"]["sources"]:
    print(src["url"], src["title"])

# 2. Default search ($5/1,000): strict domain allowlist with extracted answer and rows
default_res = requests.post(
    "https://api.specstream.ai/v1/web-search",
    headers=HEADERS,
    json={
        "q": "FDA 510(k) AI medical device guidance",
        "speed": "default",
        "include_domains": ["fda.gov", "federalregister.gov"],
        "exclude_domains": ["accessdata.fda.gov"],
    },
    timeout=30,
)
default_res.raise_for_status()
data = default_res.json()["data"]
print(data.get("answer"), len(data.get("sources", [])))
```

### JavaScript / TypeScript: POST /v1/web-search

typescript

```typescript
const API_KEY = process.env.SPECSTREAM_API_KEY!

// Fast tier ($1/1,000) with boost_domains + exclude_domains
const boosted = await fetch("https://api.specstream.ai/v1/web-search", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    q: "european sovereign cloud compliance",
    speed: "fast",
    num: 10,
    boost_domains: ["europa.eu", "bsi.bund.de", ".eu"],
    exclude_domains: ["medium.com"],
  }),
}).then((r) => r.json())

console.log(boosted.data.sources.map((s: { url: string }) => s.url))

// Default tier ($5/1,000) with strict include_domains
const scoped = await fetch("https://api.specstream.ai/v1/web-search", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    q: "NIS2 reporting deadline",
    speed: "default",
    include_domains: ["enisa.europa.eu", "eur-lex.europa.eu"],
  }),
}).then((r) => r.json())

console.log(scoped.data.answer)
```

## All request parameters

| Parameter | Type | Behavior |
| --- | --- | --- |
| `q` | `string (required)` | Query in everyday words in any language, 1 to 2,000 characters. Supports site:, -site:, -word, -"phrase", filetype:, after:, and before: operators. Optional only when like is sent. |
| `speed` | `"default" \| "fast"` | fast ($1 per 1,000 searches, 937 ms median) returns ranked results and snippets without model reading. default ($5 per 1,000 searches) also reads results to return answer and rows. |
| `num` | `integer (1 to 100)` | Number of sources to return (default 10; up to 200 with images=true). Each started block of 10 additional results adds $0.0012 on fast or $0.006 on default. |
| `page` | `integer (1 to 10)` | Result page index (default 1) continuing the same ranked list. |
| `passages` | `boolean` | Reads top result pages and returns evidence highlights per source plus top passages across sources. Cannot be combined with compact, news, or images. |
| `compact` | `boolean` | Returns compact sources only (title, url, dates, and one best-matching snippet capped at source\_max\_chars, default 4,000) to reduce agent token overhead. |
| `pages_wait_ms` | `integer (0 to 3500)` | Milliseconds to wait for page text when passages=true or compact=true. |
| `like, unlike` | `string[] (max 20 each)` | Search from example URLs: pages similar to like come first, excluding unlike and named URLs. Web search only. |
| `language, country, safe` | `string` | Two-letter language code (de), two-letter country code (DE), and safe search level (off, moderate, or strict). |
| `news, images` | `boolean` | Switch to news items or image results at the fast-tier price ($1 per 1,000). Not compatible with boost\_domains or passages. |
| `engines, engines_asked` | `string, boolean` | Narrow engines for one call (for example engines=-CN) and set engines\_asked=true to inspect which engines answered. |

## Response shape

Every successful call returns `{"data": {...}}`. With `speed="fast"`, `data.sources` returns ranked results in about a second without model reading. With `speed="default"`, `data.answer` and `data.rows` are included alongside `data.sources`:

JSON

```json
{
  "data": {
    "kind": "fact",
    "query": "Who is the CEO of Stripe",
    "answer": {
      "value": "Patrick Collison",
      "page": "https://en.wikipedia.org/wiki/Patrick_Collison",
      "seen_at": "2026-11-05T01:06:52+00:00"
    },
    "rows": [
      {
        "name": "Patrick Collison",
        "page": "https://en.wikipedia.org/wiki/Patrick_Collison",
        "probability": 0.64
      }
    ],
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Patrick_Collison",
        "title": "Patrick Collison - Wikipedia",
        "site": "en.wikipedia.org",
        "cited": true
      },
      {
        "url": "https://www.forbes.com/profile/patrick-collison/",
        "title": "Patrick Collison - Forbes",
        "site": "forbes.com",
        "cited": false
      }
    ],
    "took_ms": 2404,
    "price_usd": 0.005
  }
}
```

## Status codes

| Status | What happened |
| --- | --- |
| `401` | missing\_api\_key or invalid\_token: send Authorization: Bearer <key>. |
| `402` | insufficient\_balance: add credit in Workspace Settings, Usage and billing, or pay per call with x402 or Stripe MPP. |
| `403` | Key lacks finds:spend scope or would exceed its spend\_cap\_cents limit. |
| `409` | Idempotency-Key was already answered. Send a new key for a fresh call. |
| `422` | Validation error: q out of range, more than 20 sites in a domain parameter, invalid site syntax, include\_domains combined with boost\_domains, or boost\_domains sent with news or images. |
| `503` | Rate limit reached or search busy. Wait the seconds in Retry-After and retry. |

## Frequently asked questions

### What is the difference between boost\_domains and include\_domains?

include\_domains restricts the reply strictly to the listed domains, subdomains, or TLDs. boost\_domains places matching sites first and runs bounded recall searches for the top boosted sites by name so their pages appear even when a plain query returns none, then appends results from the rest of the web. Sending both together returns HTTP 422.

### How many domains can I send in boost\_domains, include\_domains, or exclude\_domains?

Each parameter accepts up to 20 domains (apple.com), subdomains (news.nrk.no), or TLDs (.no), sent either as a JSON array or as one comma-separated string in POST, or repeated or comma-separated query parameters in GET. Sending more than 20 returns HTTP 422.

### Does boost\_domains work with both speed fast and speed default?

Yes. boost\_domains, include\_domains, and exclude\_domains all work on both speed="fast" ($1 per 1,000 searches, 937 ms median) and speed="default" ($5 per 1,000 searches). boost\_domains applies to web searches only and returns HTTP 422 when combined with news=true or images=true.

### Can I pass TLDs like .no or .gov in boost\_domains, include\_domains, and exclude\_domains?

Yes. Country and generic endings such as .no, .de, .eu, or .gov work in all three parameters. For country endings in boost\_domains, SpecStream also targets that country during recall searches.

### How much does /v1/web-search cost and how do I start?

New accounts start with $2 of free credit with no card required, which covers 2,000 fast searches ($1 per 1,000) or 400 default searches ($5 per 1,000) of up to 10 results each. SpecStream ranks first on WideSearch (60.93 low-cost, ahead of every search API) and scores 99 on SimpleQA Verified.
