---
title: "Search"
method: POST
path: "/v1/search"
---

# Search

`POST /v1/search`

## Request

- Base URL: `https://api.llmgateway.io`
- URL: `https://api.llmgateway.io/v1/search`
- Auth: HTTP bearer

Search the web and return ranked results with extracted page content. Perplexity Search API-compatible.

## Request body

- object
  - `model` string: ID of the search model to use, or "auto" for the cheapest active search model (matching search_type when set). Defaults to perplexity/perplexity-search, or perplexity/perplexity-search-fast when search_type is fast.
  - `query` union, required: Search query, or up to 5 related queries that are searched independently and billed as one request.
    - string
    - string[]
  - `search_type` 'web' | 'fast' | 'people': Perplexity search type. "web" and "fast" select perplexity-search and perplexity-search-fast; "people" is not supported yet.
  - `max_results` integer: Maximum number of results to return. Defaults to 10.
  - `max_tokens` integer: Maximum total tokens of extracted content across all results.
  - `max_tokens_per_page` integer: Maximum tokens of extracted content per result.
  - `search_context_size` 'low' | 'medium' | 'high': How much page content to extract per result.
  - `country` string: ISO 3166-1 alpha-2 country code for regional results.
  - `search_language_filter` string[]: ISO 639-1 language codes to restrict results to.
  - `search_domain_filter` string[]: Domains to restrict results to, or to exclude with a "-" prefix.
  - `search_recency_filter` 'hour' | 'day' | 'week' | 'month' | 'year': Only return results published within this period.
  - `search_after_date_filter` string
  - `search_before_date_filter` string
  - `last_updated_after_filter` string
  - `last_updated_before_filter` string

## Response `200`

Search response with ranked web results.

- object: Perplexity-compatible search response payload.
  - `id` string
  - `model` string, required
  - `results` object[], required
    - `title` string, required
    - `url` string, required
    - `snippet` string
    - `date` string, nullable
    - `last_updated` string, nullable
  - `server_time` string, nullable

## Other responses

- `400`: Invalid request body or parameters.
- `401`: Missing or invalid API key.
- `402`: Insufficient credits or plan limits reached.
- `403`: Forbidden request or upstream response.
- `404`: Unknown model or upstream not-found response.
- `408`: Request timeout.
- `410`: Archived or unavailable project.
- `413`: Request too large.
- `415`: Unsupported media type.
- `429`: Rate limited. Response headers describe only LLMGateway-enforced limits; upstream provider headers are not forwarded. Honor Retry-After when present.
- `500`: Internal server error.
- `502`: Failed to connect to the upstream provider.
- `503`: Service unavailable upstream response.
- `504`: Upstream provider timeout.
- `529`: Gateway overloaded.

## Changes

- **2026-09-28** `5ad8eb37f61a`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/llmgateway/apis/llmgateway-api/changes/v1/search/post.md)

---

[API](https://skmtc.dev/llmgateway/apis/llmgateway-api.md) - [All operations](https://skmtc.dev/llmgateway/apis/llmgateway-api/llms.txt) - [OpenAPI document](https://skmtc.dev/llmgateway/apis/llmgateway-api/revisions/ded707bdf4a1?raw)
