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 containsserver_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⊆ projectallowed_domains. A request asking for a domain outside the project list returns400. - Block: project
blocked_domains∪ requestblocked_domains(union — both apply).
Multi-turn caveat
Replaying assistant messages that containserver_tool_use or web_search_tool_result blocks back into a new request can return 422. Strip those blocks before replaying.