> ## Documentation Index
> Fetch the complete documentation index at: https://docs.naga.ac/llms.txt
> Use this file to discover all available pages before exploring further.

# Web Search

> Enable Anthropic-style server web search on the Messages compatibility surface.

`Messages API` enables search through a versioned server tool entry in `tools[]`.

Use this when you need Anthropic-compatible request format and only a minimal public search tool shape.

## Request Shape

The supported public shape on this endpoint is:

```json theme={null}
{
  "type": "web_search_20250305",
  "name": "web_search"
}
```

Use it in a normal request like this:

<CodeGroup>
  ```python Python theme={null}
  from anthropic import Anthropic

  client = Anthropic(
      base_url="https://api.naga.ac",
      api_key="YOUR_API_KEY",
  )

  message = client.messages.create(
      model="claude-sonnet-4.5",
      max_tokens=256,
      messages=[
          {
              "role": "user",
              "content": "Find the latest Reuters coverage about AI regulation in the UK and cite your sources.",
          }
      ],
      tools=[
          {
              "type": "web_search_20250305",
              "name": "web_search",
          }
      ],
  )

  print(message.content)
  ```

  ```javascript Node.js theme={null}
  import Anthropic from '@anthropic-ai/sdk';

  const client = new Anthropic({
    baseURL: 'https://api.naga.ac',
    apiKey: 'YOUR_API_KEY',
  });

  const message = await client.messages.create({
    model: 'claude-sonnet-4.5',
    max_tokens: 256,
    messages: [
      {
        role: 'user',
        content: 'Find the latest Reuters coverage about AI regulation in the UK and cite your sources.',
      },
    ],
    tools: [
      {
        type: 'web_search_20250305',
        name: 'web_search',
      },
    ],
  });

  console.log(message.content);
  ```

  ```bash cURL theme={null}
  curl https://api.naga.ac/v1/messages \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "claude-sonnet-4.5",
      "max_tokens": 256,
      "messages": [
        {
          "role": "user",
          "content": "Find the latest Reuters coverage about AI regulation in the UK and cite your sources."
        }
      ],
      "tools": [
        {
          "type": "web_search_20250305",
          "name": "web_search"
        }
      ]
    }'
  ```
</CodeGroup>

## What This Surface Supports

On `Messages`, the public request schema only accepts the minimal versioned tool identifier. It does not expose richer search configuration on this endpoint.

If you need a configurable search object with filters or user location, use:

* [Responses Web Search](/api/responses/web-search)
* [Chat Completions Web Search](/api/chat-completions/web-search)

## Common mistakes

* trying to pass `web_search_options` or Responses-style search tools on this surface
* expecting filters or location controls in the public Messages request shape
* using Messages search for new work when Responses would be the simpler teaching path

## Caveats

* the currently documented version here is `web_search_20250305`
* this surface is for Anthropic protocol compatibility, not the primary search teaching path
* search configuration is intentionally narrower here than on `Responses` or `Chat Completions`

## Related Docs

* [Capability-level Web Search](/build/web-search)
* [Messages API](/api/messages)
* [Messages Tool Use](/api/messages/tool-use)
