Skip to main content
POST /v1/messages Web search is a tool entry in the tools array. allowed_domains and blocked_domains live at the top level of the tool definition (not nested under filters).

Request

With allow and block lists (Anthropic native shape)

Fields

All optional fields on the tool entry: Of the three API surfaces, Anthropic Messages is the only one with a native per-request block list.

Response shape

The model’s reply contains server_tool_use and web_search_tool_result blocks alongside the usual text blocks — search-result URLs are returned structurally:

Project-level enforcement

Project-level allow/block lists configured via Policy Gateway cap the request:
  • Allow: request allowed_domains ⊆ project allowed_domains. A request asking for a domain outside the project list returns 400.
  • Block: project blocked_domains ∪ request blocked_domains (union — both apply).
If the project has neither list configured, per-request filters pass through unchanged.

Multi-turn caveat

Replaying assistant messages that contain server_tool_use or web_search_tool_result blocks back into a new request can return 422. Strip those blocks before replaying.
Last modified on April 21, 2026