Skip to main content

What you get

The Search API is one endpoint, POST https://api.perplexity.ai/search. You send a query and get back ranked web results as structured data for your own code to filter, store, or hand to a model. There is no generated answer and no token billing. Each result has: The response also carries a request id. A server_time field is present and may be null.
Here are the first four of the ten results from a recorded response to this request, with snippets shortened. The fourth result has an empty snippet.
Response

Controls

Full parameter reference: POST /search. Agent API fields such as model, effort, instructions, and tools are not part of a search request.

Use these results in your own agent

Everything your agent needs from a Search response is title, url, and snippet. Install the Perplexity Python library (pip install perplexityai, imported as perplexity) or the TypeScript SDK (npm install @perplexity-ai/perplexity_ai), set PERPLEXITY_API_KEY in the environment, and the client picks the key up. Then:
  • Cap the text you hand the model with max_tokens_per_page (per result) and max_tokens (whole response). These change what comes back, not the price.
  • Pass query as an array of up to five related queries to fan out in one request. Five is the limit, so check the length before you send. The request is billed once but uses one rate-limit unit per query. Each query is processed independently and the results come back in one results list. Dedupe by url before you hand them to the model.
  • Skip results whose snippet is empty. Keep the url so the model can cite it.
Wrap that code in a tool the model can call. Each guide has the tool definition, the handler, and the tool-call loop:
  • OpenAI SDK, Anthropic SDK, and Gemini SDK: Search as a function tool in your own agent loop.
  • Perplexity API MCP server: the perplexity_search tool for Claude Code, Cursor, VS Code, and other MCP clients, with no handler to write.
  • Perplexity CLI: pplx search web returns the same JSON from a shell, for coding agents that run commands.
  • Search SDK: a Python library that adds built-in concurrency, provenance, and checkpointing on top of the same Search results and page snippets.

Price and rate limit

Details: Search API pricing and Search API rate limits.

Search API or Agent API

Extracted text, not page reading

POST /search takes queries, not URLs. Each result’s snippet is text extracted from that page that is relevant to your query, cut to max_tokens_per_page. It is not the full page, and there is no parameter to re-fetch a page live or to control cache age. search_recency_filter, the date filters, and the date and last_updated fields on each result are how you select and check freshness. To get text from URLs you already have:
  • Perplexity CLI: pplx content snippets "<query>" <url> [<url> ...] returns query-relevant passages from up to 50 URLs you name, with total and per-page token budgets and failures reported per URL.
  • Search SDK: pplx_srch_sdk.content.snippets(query=..., urls=[...]) does the same from Python, one result per URL, each with text or an error.
  • Agent API fetch_url tool: a hosted model fetches and reads a URL during an Agent API run. It is a tool inside that run, billed with the run, not a standalone endpoint you call with a URL.

Ways to call it