web-search-tool changedagents-and-tools/tool-use/web-search-tool
Nearest release: v2.1.308, published 2 hours after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+7added
Lines−7removed
From line
459
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits14to this page, all time
The whole hunk
from line 459, old and new numbered
/
from line 459
459459* `type`: The type of location (must be `approximate`)
460460* `city`: The city name
461461* `region`: The region or state
462* `country`: The two-letter [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code. The API rejects unsupported country codes with a 400 error.
463* `timezone`: The [IANA time zone ID](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
462* `country`: The two-letter [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code (the API rejects an unsupported code with a 400 error)
463* `timezone`: The [IANA time zone ID](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
464464
465465On Claude Managed Agents, the `web_search` entry of the agent toolset accepts a `user_location` object with the same fields. The API rejects an unsupported `country` code with a 400 error when you create or update the agent, or when you create or update a session that supplies the setting. See the [web tool settings](https://platform.claude.com/docs/en/managed-agents/tools-web-restrictions#settings).
466466
from line 488
488488
489489Here's an example response structure:
490490
491```json Output
491```text Output
492492{
493493 "role": "assistant",
494494 "content": [
from line 583
583583
584584When the web search tool encounters an error (such as hitting rate limits), the Claude API still returns a 200 (success) response. The error is represented within the response body using the following structure:
585585
586```json Output
586```text Output wrap
587587{
588588 "type": "web_search_tool_result",
589589 "tool_use_id": "srvtoolu_a93jad",
from line 621
621621
622622With streaming enabled, you'll receive search events as part of the stream. There is a pause while the search runs:
623623
624```sse Output
624```text Output
625625event: message_start
626626data: {"type": "message_start", "message": {"id": "msg_abc123", "type": "message"}}
627627
from line 656
656656
657657Web search usage is charged in addition to token usage:
658658
659```json
659```text wrap
660660{
661661 "usage": {
662662 "input_tokens": 105,
from line 670
670670}
671671```
672672
673Web search is available on the Claude API for **$10 USD per 1,000 searches**, plus standard token costs for search-generated content. Web search results retrieved throughout a conversation are counted as input tokens, in search iterations executed during a single turn and in subsequent conversation turns.
673Web search is available on the Claude API for **$10 USD per 1,000 searches**, plus standard token costs for search-generated content. Web search results retrieved throughout a conversation are counted as input tokens, in search iterations run during a single turn and in subsequent conversation turns.
674674
675675Each web search counts as one use, regardless of the number of results returned. If an error occurs during web search, the web search will not be billed.
676676
No line in this hunk matches that.