Overview
The Search API returns ranked web results as JSON for your own code to filter, store, or pass to a model. Each result has the page title, URL, text extracted from the page that is relevant to your query, and dates. There is no generated answer: for an answer with citations, use the Agent API.
Search is billed per successful request, with no token charges. See Search API pricing.
Authentication
Create an API key in the API Console and set it as an environment variable. Both libraries readPERPLEXITY_API_KEY automatically, and direct HTTP requests send it as Authorization: Bearer $PERPLEXITY_API_KEY.
- macOS/Linux
- Windows
- macOS/Linux
- Windows
Installation
Make a request
Send aquery and the number of results you want in max_results (1 to 20, default 10):
Response
Response
Response fields
Every result has
title, url, and snippet. Read date with a fallback, for example result.date or "unknown" in Python.
Next Steps
How Search Works
Multiple queries in one request, search types, request controls, and limits.
Filters
Restrict results by date, language, and domain.
Use Search in Your Agent
Call Search as a tool from the OpenAI, Anthropic, or Gemini SDK.
API Reference
Every request parameter, the response schema, and error responses.