Controlling Search Results with Include and Exclude Domains

Last updated: March 25, 2025

Tavily allows you to refine your web search results by including or excluding specific domains. This functionality ensures that you can target the most relevant sources while filtering out unwanted content. By using the include_domains and exclude_domains parameters, you can tailor your search results to meet your specific needs.

How to Use Include and Exclude Domains

Include Domains

The include_domains parameter ensures that only results from the specified domains appear in your search. This is useful when you want to limit results to a specific set of websites or regions.

Example: Including U.S.-Based Websites

If you want to limit your search results to U.S.-based websites, you can use the following pattern:

{
  "query": "latest AI research",
  "include_domains": ["*.com"]
}

This will restrict results to websites with a .com domain, which are commonly associated with U.S.-based businesses and organizations.

Exclude Domains

The exclude_domains parameter ensures that search results do not include specific domains. This is useful when filtering out irrelevant or unwanted sources.

Example: Excluding Icelandic Websites

If you want to exclude Icelandic websites (which use the .is domain), you can apply the following filter:

{
  "query": "global economic trends",
  "exclude_domains": ["*.is"]
}

This ensures that no results from .is domains appear in your search results.

Combining Include and Exclude Domains

You can use both include_domains and exclude_domains together to fine-tune your search results.

Example: Searching Only .com Websites but Excluding Specific Sites

If you want to include only .com websites but exclude certain sources, such as example.com, you can use:

{
  "query": "AI industry news",
  "include_domains": ["*.com"],
  "exclude_domains": ["example.com"]
}

This ensures that your search remains within the .com domain while filtering out results from example.com.