```yaml
product: AlterLab
title: Search API Reference
category: api
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
source_url: https://alterlab.io/docs/api/generated/search
```

# Search API Reference

Auto-generated API reference for search endpoints, built from the OpenAPI spec.

## GET /api/v1/search

List search history
Cursor-paged history of the organization's searches, newest first. Pass the returned next_cursor back as `cursor`. Works with a session or an API key.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `limit` | query | `integer` | no |  |
| `cursor` | query | `string` | no |  |
| `q` | query | `string` | no | Query substring |
| `status` | query | `string` | no |  |
| `kind` | query | `"single" \| "multi"` | no |  |
| `since` | query | `string` | no |  |
| `until` | query | `string` | no |  |
| `X-Organization-Id` | header | `string` | no |  |

## POST /api/v1/search

Search the web
Find relevant pages by query. Optionally scrape result pages for content. engine='auto' runs the vendor-neutral unified metasearch on this route (one request schema, auth, rate limit and billing seam; documented in devdocs/search/metasearch-evidence.md) and returns UnifiedSearchResponse. Pass `queries` (1-5) instead of `query` to run several queries in one request billed as one unit; the response (MultiSearchResponse) carries per-query results and status.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `tag` | body | `string` | no |  |
| `query` | body | `string` | no |  |
| `queries` | body | `string[]` | no |  |
| `engine` | body | `"duckduckgo" \| "google" \| "bing" \| "yahoo" \| "auto"` | no | 'auto' runs the unified metasearch: sources are queried in parallel, fused and deduplicated, one flat price, no engine attribution in the response (#38611). Search engine to use. 'duckduckgo' (default) is fast and cheap ($0.001/query). 'google' and 'bing' use browser-tier rendering ($0.004/query) for richer results including featured snippets, knowledge panels, and People Also Ask. Deprecated for the public playground surface, which no longer exposes engine selection to end users (#32419) — this field remains fully supported for direct API callers and is not scheduled for removal. |
| `domain` | body | `string` | no |  |
| `num_results` | body | `integer` | no | Number of results to return (1-30). `page` is a window of this many results, so page * num_results must not exceed the engine cap: duckduckgo 30, google 100, bing 100. |
| `page` | body | `integer` | no | Result page number (1-indexed): page N returns results (N-1)*num_results+1 to N*num_results. Requests whose window exceeds the engine cap (duckduckgo 30, google 100, bing 100 results) are rejected with 422. |
| `country` | body | `string` | no |  |
| `city` | body | `string` | no |  |
| `coordinates` | body | `object` | no | Explicit point to localize results to, with a search radius. |
| `uule` | body | `string` | no |  |
| `device` | body | `"desktop" \| "mobile" \| "tablet"` | no |  |
| `language` | body | `string` | no |  |
| `time_range` | body | `"hour" \| "day" \| "week" \| "month" \| "year"` | no |  |
| `safe_search` | body | `boolean` | no | Enable safe search filtering (default: true). When false, disables DDG Lite's adult content filter (sends p=-1 instead of p=-2). |
| `include_ai_overview` | body | `boolean` | no | Google only. Keeps a Google search on the rendered tier so the AI Overview body is available in `ai_overview`. No extra charge beyond the normal engine cost. Ignored for other engines. |
| `no_cache` | body | `boolean` | no | Skip the SERP cache and fetch fresh. Billed at the full price (cached results are free). |
| `zero_trace` | body | `boolean` | no | Zero data retention for this request: the result is not cached and no raw page or result row is persisted. |
| `output` | body | `"json" \| "html"` | no | 'html' also returns the fetched SERP page as `raw_html` (exit IPs redacted). Always a fresh fetch, billed at the full price. |
| `fields` | body | `string[]` | no |  |
| `scrape_results` | body | `boolean` | no | If true, scrape each result page and include content in response |
| `formats` | body | `string[]` | no |  |
| `preset` | body | `string` | no |  |
| `max_chars_per_result` | body | `integer` | no |  |
| `max_total_chars` | body | `integer` | no |  |
| `sync` | body | `boolean` | no | With scrape_results=true, wait up to a bounded budget (about 30s) for the scrapes and return 200 with content in one call. If the budget runs out the response is the usual 202 plus next_action (poll GET /v1/search/{search_id}). |
| `extraction_schema` | body | `object` | no |  |
| `wait` | body | `integer` | no |  |
| `mode` | body | `"fast" \| "standard" \| "deep"` | no |  |
| `live` | body | `boolean` | no | scrape_results=true: true (default) fetches every result page live. false allows cached page content; each result reports `fetched_at` either way. |
| `category` | body | `"web" \| "news" \| "images" \| "code" \| "academic" \| "discussions" \| "pdf" \| "gov" \| "research" \| "developer"` | no |  |
| `sources` | body | `string[]` | no |  |
| `source_limits` | body | `object` | no | Unified search only: results per source, keyed by source name. Sources without an entry use `num_results`. |
| `freshness` | body | `"day" \| "week" \| "month" \| "year"` | no |  |
| `date_from` | body | `string` | no |  |
| `date_to` | body | `string` | no |  |
| `temporal_bias` | body | `"RECENT" \| "OLD" \| "NONE"` | no |  |
| `include_domains` | body | `string[]` | no | Include Domains |
| `exclude_domains` | body | `string[]` | no | Exclude Domains |
| `include_keywords` | body | `string[]` | no | Include Keywords |
| `exclude_keywords` | body | `string[]` | no | Exclude Keywords |
| `require_terms` | body | `string[]` | no | Require Terms |
| `exclude_terms` | body | `string[]` | no | Exclude Terms |
| `promote_terms` | body | `string[]` | no | Promote Terms |
| `max_per_domain` | body | `integer` | no | Unified search only: domain diversity cap. |
| `domain_rules` | body | `object[]` | no | Domain Rules |
| `rerank_rules` | body | `object[]` | no | Rerank Rules |
| `extra_snippets` | body | `boolean` | no | Unified search only: include up to 5 extra snippets. |
| `timeout_ms` | body | `integer` | no |  |
| `zero_data_retention` | body | `boolean` | no |  |

## POST /api/v1/search/batch

Submit a batch of search queries
Submit up to 100 queries for async parallel SERP processing. Requires Growth+ balance tier ($50+). Poll GET /v1/search/batch/{batch_id} for results. Optionally receive results via webhook when all queries complete.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `tag` | body | `string` | no |  |
| `queries` | body | `string[]` | yes | Search queries to execute (1-100 queries, each max 500 characters) |
| `engine` | body | `"duckduckgo" \| "google" \| "bing"` | no | Search engine to use for all queries in this batch. 'duckduckgo' (default) is fast and cheap ($0.001/query). 'google' and 'bing' use browser-tier rendering ($0.004/query). Deprecated for the public playground surface, which no longer exposes engine selection to end users (#32419). This field remains fully supported for direct API callers and is not scheduled for removal. |
| `num_results` | body | `integer` | no | Number of results per query (1-30) |
| `country` | body | `string` | no |  |
| `city` | body | `string` | no |  |
| `coordinates` | body | `object` | no | Explicit point to localize results to, with a search radius. |
| `uule` | body | `string` | no |  |
| `device` | body | `"desktop" \| "mobile" \| "tablet"` | no |  |
| `language` | body | `string` | no |  |
| `time_range` | body | `"hour" \| "day" \| "week" \| "month" \| "year"` | no |  |
| `safe_search` | body | `boolean` | no | Enable safe search filtering (default: true). When false, disables DDG Lite's adult content filter (sends p=-1 instead of p=-2). Applied to all queries. |
| `no_cache` | body | `boolean` | no | Skip the SERP cache and fetch fresh. Billed at the full price (cached results are free). |
| `zero_trace` | body | `boolean` | no | Zero data retention for this request: the result is not cached and no raw page or result row is persisted. |
| `scrape_results` | body | `boolean` | no | If true, scrape each result page for content. Per-page tier costs are debited as scrapes complete. |
| `formats` | body | `string[]` | no |  |
| `preset` | body | `string` | no |  |
| `max_chars_per_result` | body | `integer` | no |  |
| `max_total_chars` | body | `integer` | no |  |
| `zero_data_retention` | body | `boolean` | no |  |
| `webhook_url` | body | `string` | no |  |
| `webhook_secret` | body | `string` | no |  |

## GET /api/v1/search/batch/{batch_id}

Poll batch search status
Poll the status of a batch search submitted via POST /v1/search/batch. Returns per-query results as they complete. When all queries are done and a webhook_url was provided, fires a webhook.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `batch_id` | path | `string` | yes |  |

## POST /api/v1/search/demo

Run one demo query
Runs one demo query for the public search demo, serving cached or precomputed results where available and a live search only when the shared budget, per-client limits and any Turnstile challenge allow it. Public; no API key is needed and it is not billed to an account. Rate-limited or queued requests return 429 or 202, and other failures fall back to a cached response instead of a 5xx.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `query` | body | `string` | yes | Query |
| `freshness` | body | `string` | no |  |
| `turnstile_token` | body | `string` | no |  |

## GET /api/v1/search/demo/cached

Cached demo results only; never triggers a live run
Returns previously cached demo results for a query and never starts a live search; the response carries a notice when nothing is cached. Public; no authentication is required.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `query` | query | `string` | yes |  |
| `freshness` | query | `string` | no |  |

## GET /api/v1/search/demo/queries

One-click query set: events from the last hour
Returns the fixed set of one-click demo queries for events from the last hour. Public; no authentication is required.

Authentication: `X-API-Key: <your key>`

## POST /api/v1/search/keyless

Keyless search trial: unified search, 10 results, no content
Runs a keyless trial of unified search for a given category and optional freshness, returning up to 10 results without page content. Public; no API key is needed, but it is rate limited per client (429 with Retry-After) and falls back to cached results when the shared trial budget or live search is unavailable. Live runs are recorded against the free- grant meter, not an account balance.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `query` | body | `string` | yes | Query |
| `category` | body | `string` | no | Category |
| `freshness` | body | `string` | no |  |

## GET /api/v1/search/saved-queries

List saved search queries
Lists the caller's saved search queries, newest first, with limit and offset pagination. Requires the read scope.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `limit` | query | `integer` | no |  |
| `offset` | query | `integer` | no |  |

## POST /api/v1/search/saved-queries

Save a search query
Saves a named search query with its options for the authenticated user. Requires the write scope; returns 403 when the per-user saved-query limit is reached and 409 when the name is already used (case-insensitive).

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `X-Organization-Id` | header | `string` | no |  |
| `name` | body | `string` | yes | Name |
| `query` | body | `string` | yes | Query |
| `options` | body | `object` | no | Search options a saved query may carry: the D8 deep-link fields plus the unified set. |

## DELETE /api/v1/search/saved-queries/{saved_id}

Delete a saved search query
Soft-deletes a saved search query owned by the caller and returns 204. Requires the write scope; returns 404 when not found or not owned.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `saved_id` | path | `string` | yes |  |

## GET /api/v1/search/saved-queries/{saved_id}

Get a saved search query
Returns one saved search query owned by the caller. Requires the read scope; returns 404 when the query does not exist or belongs to another user.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `saved_id` | path | `string` | yes |  |

## PATCH /api/v1/search/saved-queries/{saved_id}

Update a saved search query
Updates the name, query text or options of a saved search query; omitted fields are left unchanged. Requires the write scope; returns 404 when not found or not owned and 409 when the new name is already used.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `saved_id` | path | `string` | yes |  |
| `name` | body | `string` | no |  |
| `query` | body | `string` | no |  |
| `options` | body | `object` | no | Search options a saved query may carry: the D8 deep-link fields plus the unified set. |

## GET /api/v1/search/{search_id}

Get search status
Poll for search+scrape progress when scrape_results was true, or for the late result of a plain search whose POST returned 503 search_timeout with a search_id. status is pending (Retry-After set), completed (credits_used=0: the 503 already refunded the search, so the late result is free) or failed (failure_reason set).

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `search_id` | path | `string` | yes |  |
