Search Domain Filtering Patterns - Perplexity
Summary
The Perplexity Agent API offers a `search_domain_filter` feature, enabling users to precisely control web search results by restricting or excluding specific domains. Configured within the `tools` array, this filter accepts a list of domain strings, supporting allowlists (no prefix) to include only trusted sources like `["reuters.com", "apnews.com"]`, and denylists (`-` prefix) to exclude unwanted sources such as `["-reddit.com", "-twitter.com"]`. The API also supports path filtering, allowing users to narrow searches to specific sections like `["nature.com/articles"]`. A critical constraint is that allowlist and denylist entries cannot be mixed in a single request. The guide demonstrates practical patterns for news-only searches, government data, academic research, and competitor exclusion, often combining `search_domain_filter` with `search_recency_filter` (e.g., `day`, `week`). It also highlights common pitfalls like incorrect wildcard usage and provides best practices for effective filter management.
Key takeaway
For AI Engineers building applications with the Perplexity Agent API, implementing `search_domain_filter` is crucial for curating web search results. You should utilize allowlists for focused information retrieval (e.g., news, academic papers) and denylists to exclude noisy or irrelevant sources like social media. Always ensure you do not mix allowlist and denylist entries in a single request to avoid errors. Test your filters thoroughly and consider storing common presets for efficient, repeatable, and high-quality search experiences.
Key insights
Perplexity's Agent API enables precise web search filtering via allowlists or denylists, with path support, but prohibits mixing both types.
Principles
- Never mix allowlist and denylist entries.
- TLD filters (e.g., ".gov") match broadly.
- Store filter presets in configuration.
Method
Configure `search_domain_filter` within `tools[].filters` using domain strings. Use no prefix for allowlists, a "-" prefix for denylists. Combine with `search_recency_filter` for time-sensitive queries.
In practice
- Restrict news searches to major outlets.
- Exclude social media from content generation.
- Target academic sources for research.
Topics
- Perplexity Agent API
- Web Search Filtering
- Domain Allowlist
- Domain Denylist
- Search Recency
- Data Curation
Best for: AI Engineer, Software Engineer, Machine Learning Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by perplexity.ai via Google News.