Home › Claude API lesson 2: Web search, JSON
Claude API lesson 2: Web search, JSON
The web search tool gives Claude current web content with cited sources, and structured outputs make its reply match your JSON schema so code can use it directly.
Step by step
- Add the web search tool to the tools list of your request (for example type web_search_20250305 for basic search).
- Show users the citations included in the response.
- Use domain controls to allow or block particular sites.
- For JSON, set output_config.format with your schema.
- For tools, add strict: true to guarantee tool names and inputs match the schema.
Try it: examples
- Web search
What did our city council decide about bike lanes this month? Cite the sources.
- JSON output
Extract the company, invoice date and total from this invoice and return them as JSON: [paste text]
Good to know
- Newer web search versions add dynamic filtering, where Claude runs code to keep only relevant results.
- Structured outputs are generally available on the Claude API for current models.
Sources (official pages, read Nov 8, 2026)
Written from Anthropic's official documentation and product pages; we don't run hands-on tests. Features and limits vary by plan and country.