Skip to main content
Perplexity

Search documentation

Type to search this documentation.

Search the Web

POST/searchSearch the Web

Search the web and retrieve relevant web page contents.

Request body

required
application/json
objectApiSearchRequest

ApiSearchRequest

allOf · 3 options
Option 1object
countrystring

ISO 3166-1 alpha-2 country code

maxLength 2 · minLength 2

max_resultsinteger

Maximum number of results. Values above 20 require search_type=people. Supports up to 20 for web search and up to 50 for people search.

default 10 · maximum 50 · minimum 1

max_tokensinteger

Maximum total webpage content tokens to return across all search results

maximum 1000000 · minimum 1

max_tokens_per_pageinteger

Maximum webpage content tokens to extract from each result page

maximum 1000000 · minimum 1

queryvaluerequired

Search query (required)

Show child attributes
anyOf · 2 options
Option 1string
Option 2array of string
search_context_sizestring

Controls how much content is extracted from result pages. - `low` — short passages most relevant to the query. - `medium` — a balanced amount of content per document. - `high` (default) — detailed content relevant to the query. Omit when using `max_tokens` or `max_tokens_per_page`.

search_language_filterarray of string

ISO 639-1 language codes (2-character max)

maxItems 20

Show child attributes

maxItems 20

search_typestring

Search type - "web" for general web search, "fast" for lower-latency, lower-cost web search, "people" for people search. max_results above 20 is only supported for people search.

one of "web", "fast", "people" · default "web"

Option 2objectSearchDomainFilter

SearchDomainFilter

search_domain_filterarray of string

Limit search results to specific domains (max 20)

maxItems 20

Show child attributes

maxItems 20

Option 3objectDateFilters

DateFilters

last_updated_after_filterstring

Input: MM/DD/YYYY, Output: YYYY-MM-DD

last_updated_before_filterstring

Input: MM/DD/YYYY, Output: YYYY-MM-DD

search_after_date_filterstring

Input: MM/DD/YYYY, Output: YYYY-MM-DD

search_before_date_filterstring

Input: MM/DD/YYYY, Output: YYYY-MM-DD

search_recency_filterstring

Time-based recency filter for search results

one of "hour", "day", "week", "month", "year"

Example request
{
  "country": "string",
  "last_updated_after_filter": "string",
  "last_updated_before_filter": "string",
  "max_results": 10,
  "max_tokens": 0,
  "max_tokens_per_page": 0,
  "query": "string",
  "search_after_date_filter": "string",
  "search_before_date_filter": "string",
  "search_context_size": "string",
  "search_domain_filter": [
    "string"
  ],
  "search_language_filter": [
    "string"
  ],
  "search_recency_filter": "day",
  "search_type": "web"
}

Responses

200Successful Responseapplication/json
objectApiSearchResponse

ApiSearchResponse

idstringrequired
resultsarray of objectrequired
Show child attributes
Show array items

A single page from search results

datevalue

Publication date of the page

Show child attributes
anyOf · 2 options
Option 1string
Option 2nullnullable
last_updatedvalue

Date the page was last updated

Show child attributes
anyOf · 2 options
Option 1string
Option 2nullnullable
snippetstringrequired

Content snippet extracted from the page

titlestringrequired

Title of the page

urlstringrequired

URL of the page

server_timevalue
Show child attributes
anyOf · 2 options
Option 1string
Option 2nullnullable
Example response
{
  "id": "string",
  "results": [
    {
      "date": null,
      "last_updated": null,
      "snippet": "string",
      "title": "string",
      "url": "string"
    }
  ],
  "server_time": null
}
422Validation Errorapplication/json
objectHTTPValidationError

HTTPValidationError

detailarray of object
Show child attributes
Show array items
locarray of valuerequired
Show child attributes
Show array items
anyOf · 2 options
Option 1string
Option 2integer
msgstringrequired
typestringrequired
Example response
{
  "detail": [
    {
      "loc": [
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}
Documentation menu