Can Grok web search combine allowed and excluded domain lists?

The Citead team, updated

In short. Grok Web Search accepts either an allowed domain list or an excluded domain list in a request, with a maximum of 5 domains in the selected list.

Definition: No. xAI documents allowed_domains and excluded_domains as alternative filters for its Web Search tool. The first restricts search to listed domains, while the second excludes listed domains, and xAI says they cannot be set together in the same request.

Key facts

  • xAI describes Web Search as a tool that lets Grok search the web in real time, browse pages and extract information for answers in its Web Search documentation.
  • The parameter table gives allowed_domains and excluded_domains a maximum of 5 domains each in the same documentation.
  • allowed_domains limits search and browsing to pages in the specified domains, according to xAI's Web Search documentation.
  • excluded_domains prevents the model from including the specified domains in Web Search tool invocations.
  • xAI's OpenAPI schema describes domain values without a protocol specification or subdomains and gives each filter a maximum of 5 websites.

Why are the filters mutually exclusive?

The two parameters select different search scopes. allowed_domains acts as a whitelist: the OpenAPI schema says that only the specified sites are considered. excluded_domains removes specified sites from the result set. The Web Search documentation states that allowed_domains cannot be set together with excluded_domains in the same request. The schema repeats the same constraint in both parameter descriptions.

The restriction concerns the request configuration for the Web Search tool. It is not a rule about whether a domain can appear in both lists across separate requests. xAI's documentation gives no combined mode that would first allow a list and then subtract domains from it.

How should a request be configured?

Choose one filter key for a request. In the Responses API shape documented by xAI, an allow-list appears under the filters object of the web_search tool:

{
  "type": "web_search",
  "filters": {
    "allowed_domains": ["example.com"]
  }
}

The same documentation shows excluded_domains in that position when the purpose is to omit specified domains. The xAI SDK example exposes the corresponding option as allowed_domains or excluded_domains, while the Vercel AI SDK uses allowedDomains in its Web Search helper. The API field names and SDK option names therefore depend on the interface used.

What limits apply to each list?

The OpenAPI schema says that domain values omit the protocol specification and subdomains. Its examples use example.com, rather than a URL with https:// or a host such as www.example.com. Each list accepts a maximum of 5 websites. The Web Search parameter table expresses the same limit for both filters.

The allow-list has one documented result effect: if no relevant information is found on the allowed websites, the number of results returned might be smaller than max_search_results in SearchParameters. The schema describes the exclusion list as a way to prevent results from unwanted sites. The pages do not describe a separate combined limit because the two parameters cannot be used together.

FAQ

Can I allow several domains and exclude one of them in the same call?

No. The Web Search documentation says the two parameters cannot be set together in the same request. Use a single filter mode for that call.

Is the limit 5 domains total across both parameters?

The documentation assigns a maximum of 5 websites to each parameter. Since the parameters are mutually exclusive, a request uses one list with that per-parameter limit.

Should domain values include https://?

No. xAI's OpenAPI schema specifies domain values without a protocol specification or subdomains, with example.com as its example.

Sources

  1. xAI, "Web Search", October 10, 2026
  2. xAI, "OpenAPI specification", undated

Check how a page reads to answer engines. Open the GEO score analyzer

Test a page and see what to fix first

The analysis usually takes less than 10 seconds and needs no account.

400,000+ pages scored in the public benchmark