openapi: 3.1.0 info: title: Perplexity AI Agent Search API description: Perplexity AI API version: 1.0.0 servers: - url: https://api.perplexity.ai description: Perplexity AI API tags: - name: Search paths: /search: post: summary: Search the Web operationId: search_search_post security: - HTTPBearer: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ApiSearchRequest' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/ApiSearchResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' description: Search the web and retrieve relevant web page contents. tags: - Search components: schemas: HTTPValidationError: properties: detail: items: $ref: '#/components/schemas/ValidationError' type: array title: Detail type: object title: HTTPValidationError ValidationError: properties: loc: items: anyOf: - type: string - type: integer type: array title: Location msg: type: string title: Message type: type: string title: Error Type type: object required: - loc - msg - type title: ValidationError ApiSearchPage: description: A single page from search results properties: title: type: string title: Title description: Title of the page url: type: string title: Url description: URL of the page snippet: type: string title: Snippet description: Content snippet extracted from the page date: anyOf: - type: string - type: 'null' title: Date description: Publication date of the page last_updated: anyOf: - type: string - type: 'null' title: Last Updated description: Date the page was last updated type: object required: - title - url - snippet title: ApiSearchPage ApiSearchRequest: allOf: - properties: country: description: ISO 3166-1 alpha-2 country code maxLength: 2 minLength: 2 type: string max_results: default: 10 description: Maximum number of results to return maximum: 20 minimum: 1 type: integer max_tokens: default: 10000 description: Maximum tokens for context maximum: 1000000 minimum: 1 type: integer max_tokens_per_page: default: 4096 description: Maximum tokens per page maximum: 1000000 minimum: 1 type: integer query: anyOf: - type: string - items: type: string type: array title: Query description: Search query (required) search_language_filter: description: ISO 639-1 language codes (2-character max) items: maxLength: 2 minLength: 2 type: string maxItems: 20 type: array required: - query type: object - $ref: '#/components/schemas/SearchDomainFilter' - $ref: '#/components/schemas/DateFilters' type: object title: ApiSearchRequest Date: description: 'Input: MM/DD/YYYY, Output: YYYY-MM-DD' type: string title: Date ApiSearchResponse: properties: results: items: $ref: '#/components/schemas/ApiSearchPage' type: array title: Results id: type: string title: Id server_time: anyOf: - type: string - type: 'null' title: Server Time type: object required: - results - id title: ApiSearchResponse SearchRecencyFilter: description: Time-based recency filter for search results enum: - hour - day - week - month - year type: string title: SearchRecencyFilter SearchDomainFilter: properties: search_domain_filter: description: Limit search results to specific domains (max 20) items: maxLength: 253 type: string maxItems: 20 type: array type: object title: SearchDomainFilter DateFilters: properties: last_updated_after_filter: $ref: '#/components/schemas/Date' description: Return results updated after this date (MM/DD/YYYY) last_updated_before_filter: $ref: '#/components/schemas/Date' description: Return results updated before this date (MM/DD/YYYY) search_after_date_filter: $ref: '#/components/schemas/Date' description: Return results published after this date (MM/DD/YYYY) search_before_date_filter: $ref: '#/components/schemas/Date' description: Return results published before this date (MM/DD/YYYY) search_recency_filter: $ref: '#/components/schemas/SearchRecencyFilter' description: Filter by publication recency (hour/day/week/month/year) type: object title: DateFilters securitySchemes: HTTPBearer: type: http scheme: bearer