Skip to main content

Overview

This guide covers essential best practices for getting the most out of Perplexity’s Search API, including query optimization techniques and efficient async usage patterns for high-performance applications.

Query Optimization

1

Write specific queries

Use highly specific queries for more targeted results. For example, instead of searching for “AI”, use a detailed query like “artificial intelligence machine learning healthcare applications 2024”.
Specific queries with context, time frames, and precise terminology yield more relevant and actionable results.
2

Use multi-query for comprehensive research

Break your main topic into related sub-queries to cover all aspects of your research. Use the multi-query search feature to run multiple related queries in a single request for more comprehensive and relevant information.
You can include up to 5 queries in a single multi-query request for efficient batch processing.
3

Handle rate limits efficiently

Implement exponential backoff for rate limit errors and use appropriate batching strategies.
4

Process concurrent searches efficiently

Use async for concurrent requests while respecting rate limits.

Async Usage

For high-performance applications requiring concurrent requests, use the async client:

Advanced Async Patterns

Rate-Limited Concurrent Processing

For large-scale applications, implement controlled concurrency with rate limiting:

Error Handling in Async Operations

Implement robust error handling for async search operations:

Performance Optimization Tips

1

Optimize result count

Request only the number of results you actually need. More results = longer response times.
2

Cache frequently used searches

Implement caching for queries that don’t need real-time results.

Quickstart

Get started with basic search functionality

Perplexity SDK

Explore the full SDK capabilities for enhanced performance

API Reference

Complete Search API documentation