Claude Code
If you run a docs site, the first thing to know is that Claude Code reaches the web through two built-in tools, and they work very differently. WebFetch runs on the developer’s own machine: it first asks Anthropic whether the hostname is allowed, then sends one plain GET from the developer’s IP as Claude-User, converts the HTML to Markdown without running JavaScript, and, on almost every site, hands that Markdown to a small model that answers the main model’s question in a few sentences. WebSearch never touches your site at all, because it runs a nested API call against a search index that Anthropic doesn’t name (the evidence points to Brave), and the main model gets back only titles, URLs and a summary. So what you see as a site owner is a single Claude-User request from a residential or office IP, usually seconds after a search you never see. Everything below was read from the 2.1.328 binary (build 2026-11-18) and checked against our Dec 2026 lab run.
At a glance
Section titled “At a glance”| Claude Code 2.1.328 | |
|---|---|
| Fetch tool | WebFetch(url, prompt) verified in code |
| Search tool | WebSearch(query), a nested Messages API call with the web_search_20250305 server tool verified in code |
| Who issues the request | Developer’s machine (local CLI and Desktop); Anthropic’s fetch proxy in cloud sessions verified in code |
| User-Agent | Claude-User (claude-code/2.1.328; +https://support.anthropic.com/) measured in our lab |
| Accept header | text/markdown, text/html, */* measured in our lab |
| JS rendering | None; one GET, no assets verified in code |
| Content conversion | Turndown (HTML to Markdown), then a Haiku-tier summary on non-preapproved domains verified in code |
| Size & truncation | 10 MiB body, first 1 MiB of HTML converted, 100,000 Markdown chars to the summariser verified in code |
| Caching | 15 minutes per URL on the client; cloud proxy may serve stored copies verified in code |
| robots.txt | Not checked locally; enforced by the cloud proxy verified in code |
| Permission model | Anthropic domain_info blocklist, then a user prompt per new domain unless preapproved or allowed by a WebFetch(domain:…) rule verified in code |
- WebFetch → domain_info check
can_fetch? - WebFetch → docs.example.com
GET from dev IP - Nested web_search → Brave Search
query - Bash curl / gh → docs.example.com
raw HTML - Cloud fetch proxy → docs.example.com
GET from Anthropic IP
How fetching works
Section titled “How fetching works”I find it easiest to think of WebFetch as a five-stage pipeline (preflight, fetch, convert, summarise, return), where each stage drops or reshapes some part of your page.
Claude Code WebFetch on a non-preapproved domain
- Main model→Claude Code CLI
tool_use WebFetch(url, prompt) - Claude Code CLI→domain_info
GET ?domain=hosthostname only, 10 s timeout
- domain_info→Claude Code CLI
can_fetch: trueallow cached 5 min
- Claude Code CLI→Your site
GET https://… (one request)UA Claude-User, markdown first
- Your site→Claude Code CLI
200 text/html, ≤ 10 MiB - Claude Code CLI
Turndown on first 1 MiBscript/style/iframe removed
- Claude Code CLI→Haiku-tier model
page (≤ 100k chars) + prompt125-char quote cap
- Haiku-tier model→Claude Code CLI
concise answer - Claude Code CLI→Main model
tool_result: summary only
1. Domain preflight
Section titled “1. Domain preflight”Before any request reaches your server, Claude Code sends GET https://api.anthropic.com/api/web/domain_info?domain=<hostname> with the UA claude-code/2.1.328, and it only proceeds on a 200 response containing can_fetch: true verified in code. Anthropic gets just the hostname, while the page itself is requested from the user’s IP. Anthropic’s data usage page describes this “WebFetch domain safety check”, says it runs on Bedrock and Vertex too, and notes that CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC doesn’t turn it off documented. Allowed results are cached for five minutes in a 128-entry LRU, while blocked and failed results aren’t cached at all.
The blocklist turns out to be broader than a malware list. When we queried the endpoint on 2026-12-02, it returned can_fetch: false for nytimes.com, reddit.com, stackoverflow.com, bbc.com, wsj.com and theguardian.com, and can_fetch: true for example.com, github.com, linkedin.com, cnn.com, en.wikipedia.org, medium.com, x.com, facebook.com, quora.com and amazon.com measured in our lab. Several of the blocked domains are publishers that have litigated against AI crawlers, which suggests the list reflects publisher opt-outs as well as safety inferred. For a blocked domain, Claude Code sends nothing to the site, so you get no log line, and the model is simply told “Claude Code is unable to fetch from” the host.
2. The request
Section titled “2. The request”The local fetch is a single axios GET with two explicit headers, User-Agent: Claude-User (claude-code/2.1.328; +https://support.anthropic.com/) and Accept: text/markdown, text/html, */*, and Claude Code doesn’t send cookies, a Referer or Accept-Language verified in code. Our lab endpoint received exactly those headers from the developer’s residential IP, and Netlify’s own bot classifier labelled the request ai-agent; coding measured in our lab.
Claude Code also rewrites http: to https: before fetching, on both the local and proxy paths, so a site without working HTTPS is unreachable and port 80 is never contacted verified in code. URLs over 2,000 characters, URLs with credentials, and dot-less hosts such as localhost are rejected outright.
Redirects are handled by hand, with maxRedirects: 0 and a ten-hop limit. Claude Code follows a 301, 302, 303, 307 or 308 automatically only when the protocol, port and hostname match (a leading www. is ignored), so example.com to www.example.com works within one call verified in code. Any cross-host redirect, say example.com to example.io or docs.foo.com to foo.dev/docs, comes back to the model as a REDIRECT DETECTED message asking it to call WebFetch again, and that costs a round trip, a fresh preflight on the new host and possibly a permission prompt.
3. Conversion and truncation
Section titled “3. Conversion and truncation”Claude Code accepts bodies up to 10 MiB, but it only converts the first 1 MiB of decoded HTML with Turndown, after stripping out style, script, noscript and iframe elements verified in code. Only responses whose content-type includes text/html get converted, while text/markdown, text/plain and JSON pass through as UTF-8. The resulting Markdown is then cut at 100,000 characters with the marker [Content truncated due to length...] before the summariser sees it, although the model can read further with an offset parameter.
WebFetch doesn’t render JavaScript. A client-rendered single-page app delivers its empty shell, and anything inserted by script (including tabbed code samples that load lazily) simply doesn’t exist for Claude Code verified in code. If you want to see how this compares with other agents, anatomy of an agent fetch lays it out side by side.
4. The secondary-model summary
Section titled “4. The secondary-model summary”This is the step that matters most for your docs, I think. On the default path, the Markdown and the main model’s prompt go to a one-shot call to the “small, fast model”, which resolves to ANTHROPIC_SMALL_FAST_MODEL or the Haiku tier, with an empty system prompt, no tools and thinking disabled verified in code. The 2.1.328 model registry lists claude-haiku-4-5 and claude-haiku-5-5, and Zapier observed claude-haiku-4-5-20251001 in its traffic. The prompt template itself is short:
Web page content:---{markdown}---
{model's prompt}
{guidelines}What the summariser is told depends on whether the URL is on Anthropic’s preapproved list. For preapproved domains it’s told to “Include relevant details, code examples, and documentation excerpts as needed.” For every other domain it’s told to answer “based only on the content above”, to quote at most 125 characters at a time, to use quotation marks for exact wording, never to comment on legality and never to reproduce song lyrics, and the result is labelled as coming “from a non-preapproved source” verified in code.
There are two exceptions that skip the summary. A preapproved domain that returns text/markdown under 100,000 characters goes to the main model verbatim (the raw_markdown path), and the built-in web-fetch sub-agent gets about 48,000 characters of raw page text plus a summary of up to 8,000 characters covering the rest verified in code.
Full preapproved domain list in Claude Code 2.1.328
Hostnames match exactly, so www. matters: tailwindcss.com is listed but www.tailwindcss.com is not. Path-prefixed entries match only that path. On github.com and raw.githubusercontent.com, only the anthropics and anthropic-experimental organisations qualify (and only refs/heads/main/ on raw), and any %2f, %5c or %2e in the path disqualifies the URL.
platform.claude.com code.claude.com claude.dev www.claude.dev claude.com/docs modelcontextprotocol.iogithub.com/anthropics github.com/anthropic-experimental raw.githubusercontent.com/anthropicsraw.githubusercontent.com/anthropic-experimental agentskills.iodocs.python.org en.cppreference.com docs.oracle.com learn.microsoft.com developer.mozilla.orggo.dev/doc go.dev/ref www.php.net docs.swift.org kotlinlang.org ruby-doc.org doc.rust-lang.orgwww.typescriptlang.org react.dev angular.io vuejs.org nextjs.org expressjs.com nodejs.org bun.shjquery.com getbootstrap.com tailwindcss.com d3js.org threejs.org redux.js.org webpack.js.org jestjs.ioreactrouter.com docs.djangoproject.com flask.palletsprojects.com fastapi.tiangolo.com pandas.pydata.orgnumpy.org www.tensorflow.org pytorch.org scikit-learn.org matplotlib.org requests.readthedocs.iojupyter.org laravel.com symfony.com wordpress.org/documentation docs.spring.io hibernate.orgtomcat.apache.org gradle.org maven.apache.org asp.net dotnet.microsoft.com blazor.net reactnative.devdocs.flutter.dev developer.apple.com developer.android.com keras.io spark.apache.org huggingface.co/docswww.kaggle.com/docs www.mongodb.com redis.io www.postgresql.org dev.mysql.com www.sqlite.org graphql.orgprisma.io docs.getdbt.com docs.aws.amazon.com cloud.google.com kubernetes.io www.docker.comwww.terraform.io www.ansible.com vercel.com/docs docs.stripe.com docs.netlify.com devcenter.heroku.comdev.wix.com/docs cypress.io selenium.dev docs.unity.com docs.unrealengine.com git-scm.com nginx.orghttpd.apache.orgPreapproved domains also skip the per-domain permission prompt. For everyone else, the first fetch to a new host asks the developer for approval, and the tool text tells the model to fetch only URLs that “already appear in this conversation”, warning that URLs recalled from memory “may need the person’s approval or be rejected” verified in code. In practice that makes search results, not URLs the model remembers from training, the main way into a non-preapproved site inferred.
5. Caching and repeat fetches
Section titled “5. Caching and repeat fetches”Claude Code caches each URL for 15 minutes (you can override this with CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS), and within one conversation a repeat call with the same URL and prompt returns “Already fetched … with the same prompt” without touching the network verified in code.
Cloud sessions take a different path
Section titled “Cloud sessions take a different path”Cloud sessions are a different story. In Claude Code on the web and other cloud sessions, the client doesn’t fetch at all: it POSTs the URL to the session’s web-fetch route, and Anthropic’s proxy returns already-extracted text with content_type, destination_url and retrieved_at verified in code. The proxy enforces robots.txt server-side and returns error types including robots_disallowed, site_blocked and rate_limit_exceeded, with robots_disallowed treated as permanent. When the returned copy is more than an hour old, the model is told it’s “a stored copy of the page”, which implies Anthropic keeps a server-side page cache and that some cloud reads never produce a request to your origin inferred. The requests that do arrive should come from Anthropic’s published ranges in claude.com/crawling/bots.json, not from a residential IP.
How searching works
Section titled “How searching works”WebSearch is a client tool wrapped around a server tool. When the main model calls WebSearch(query), Claude Code makes a second Messages API call with the server tool {type: "web_search_20250305", name: "web_search", max_uses: 8}, optional allowed_domains or blocked_domains, and a forced tool_choice verified in code. The nested model gets the system prompt “You run a web search for another Claude model, which is waiting on the result and can search again. Search once, then reply with a brief summary of the results,” and the user message Perform a web search for the query: followed by the query. That nested model is the main-loop model, or Haiku when a feature flag is set.
Claude Code WebSearch: a nested API call that never touches your site
- Main model→Claude Code CLI
tool_use WebSearch(query) - Claude Code CLI→Nested API call
web_search_20250305max_uses 8, forced tool_choice
- Nested API call→Brave index
query (may be rephrased) - Brave index→Nested API call
~10 results per search - Nested API call
nested model summarises - Nested API call→Claude Code CLI
titles, URLs, summaryencrypted_content dropped
- Claude Code CLI→Main model
tool_result + "cite sources" - Main model→Claude Code CLI
tool_use WebFetch(result URL) - Claude Code CLI→Your site
GET (first hit on your site)
What comes back to the main model is a plain-text block that starts with Web search results for query:, lists Links: as a JSON array of title and URL pairs, appends the nested model’s prose summary, and ends with a reminder that it “MUST include the sources above in your response” verified in code. The API’s encrypted_content and page_age fields are thrown away, so the main model judges results by title, URL and whatever the nested summary said. In practice, a title that names the library, the version and the task is the main thing you control at this stage.
Anthropic doesn’t name the backend in Claude Code, but it added Brave Search as a subprocessor on 2025-03-19, and Simon Willison found a BraveSearchParams field and citations matching Brave’s top ten documented. Claude Code’s own tool text says search is “US-only” verified in code. The web search tool docs list newer versions (web_search_20260209, web_search_20260318), but 2.1.328 still pins 20250305. Because the results come from a pre-built index, being absent from Brave means being absent from Claude Code search, and search backends goes into that in more detail.
How the model writes queries
Section titled “How the model writes queries”Claude Code’s WebSearch description tells the model to put the current date into its queries. In the full description, the month is substituted from new Date() in the form “December 2026” verified in code:
IMPORTANT - Use the correct year in search queries: The current month is ${Y}.You MUST use this year when searching for recent information …If the user asks for "latest React docs", search for "React documentation"with the current year, NOT last year.In the lean variant of the description, the placeholder stays in the schema and the date arrives through the conversation context instead, which keeps the tool schema cache-stable inferred. Either way, you should expect a large share of queries shaped like prisma migrations 2026 or next.js app router caching December 2026, and the nested model can issue up to eight sub-queries per call. WebFetch, by the way, has no query step of its own: the main model writes a free-text prompt describing what to extract, and that prompt is what the summariser answers. There’s more on this in how agents write queries.
Other paths to your content
Section titled “Other paths to your content”WebFetch and WebSearch are only two of the ways Claude Code reaches a page, and the tool descriptions actively push the model elsewhere: “If an MCP-provided web fetch tool is available, prefer using that tool instead of this one,” and “For GitHub URLs, prefer using the gh CLI” verified in code.
| Path | Origin | What your server sees | Notes |
|---|---|---|---|
Bash curl / wget | Developer IP | curl/8.7.1, Accept: */* measured in our lab | No preflight, no summary, full raw HTML. Often follows a failed WebFetch or targets localhost. |
gh CLI |
Developer IP to api.github.com | GitHub CLI/x.y |
Recommended for GitHub URLs; your site sees nothing. |
| MCP servers | Whatever the server does | Firecrawl, Context7 or Brave MCP send from their own infrastructure with their own UA | Preferred over WebFetch when installed. See doc MCPs. |
| Desktop Browser pane, Claude in Chrome | Developer IP, embedded Chromium or the user’s own Chrome | A normal Chrome UA, JS runs, assets load, cookies in Chrome | Indistinguishable from a person; analytics fire inferred. |
| Anthropic-hosted browsers | Anthropic IPs | Chrome UA plus a Claude-Agent token (support) documented | IPs at claude.com/.well-known/sail. |
| Cloud session Bash | Anthropic VM behind an egress allowlist proxy | curl UA from cloud IPs | Blocked hosts return 403 blocked-by-allowlist verified in code. |
| Cloud session WebFetch | Anthropic fetch proxy | Claude-User from Anthropic ranges inferred | robots.txt enforced; stored copies possible. |
Claude Code also reads llms.txt often enough to show up in aggregate data. Ahrefs’ June 2026 log study of 137,210 domains found that 97% of hosted llms.txt files got no requests at all, yet Claude Code was the third-largest AI fetcher of the files that were requested, ahead of every retrieval and assistant bot (Ahrefs) documented. To be fair to the data, Ahrefs notes that a fetch doesn’t prove the file was used.
What shows up in your logs
Section titled “What shows up in your logs”| Scenario | Signature | Evidence |
|---|---|---|
| Local WebFetch, allowed domain | One GET from a residential or office IP, UA Claude-User (claude-code/2.1.328; …), Accept: text/markdown, text/html, */*; no /robots.txt, no CSS, JS or images, no cookies | measured in our lab |
| Repeat fetch within 15 minutes | Nothing | verified in code |
| Domain on the blocklist | Nothing ever arrives | verified in code |
| Cross-host redirect | A single hit returning the 3xx; the target host is hit only if the model calls again | verified in code |
http:// link | Request arrives on 443; port 80 is never contacted | verified in code |
| WebSearch only | Nothing on your origin; discovery depends on Brave and Claude-SearchBot | inferred |
| Search then fetch | A Claude-User hit seconds after a likely <topic> 2026 query, from the same IP as any follow-up curl | inferred |
| Bash fallback | curl/8.7.1 from the developer IP, often right after a failed WebFetch | measured in our lab |
| Cloud session WebFetch | Anthropic IP ranges, robots.txt checked, or no hit when a stored copy is served | inferred |
| Browser pane or Claude in Chrome | Full browser traffic with JS, assets and analytics beacons | inferred |
Netlify now labels Claude Code WebFetch traffic ai-agent; coding in its netlify-agent-category header, and curl traffic tooling; custom-code measured in our lab. You’ll find more patterns in log signatures.
What this means for discoverability
Section titled “What this means for discoverability”Serving Markdown via Accept helps less than it looks. Claude Code asks for text/markdown first, so content negotiation does reach it, but the verbatim pass-through only applies to preapproved domains. On any other domain your Markdown still goes through the summariser, and the gain is a cleaner input with no navigation noise and less chance of hitting the 1 MiB HTML or 100,000-character cut inferred.
Write pages so a summariser keeps the facts. Because the main model sees a Haiku-tier answer to its own question, I’d put the answer near the top of the page in plain sentences that name the API, the version and the constraint. Keep critical code samples short, since a 40-line sample can’t survive a 125-character quote cap intact, and state defaults, limits and breaking changes as explicit sentences instead of leaving them implicit in examples inferred.
Keep content server-rendered, on HTTPS, on one host. Script-rendered content doesn’t exist for WebFetch, plain HTTP gets upgraded and fails without TLS, and a cross-host redirect from an old docs domain depends on the model choosing to retry. A www. to apex redirect is fine, but a move to a new domain isn’t free.
Blocked domains push answers elsewhere. Stack Overflow and Reddit can’t be read through WebFetch at all, so when a developer’s question would normally land on a Stack Overflow thread, Claude Code has to answer from memory, from search snippets, or from another source it can fetch. That gives official docs, GitHub issues and blog posts that cover common errors a larger share of these answers than they get in Google inferred.
Rank in Brave, and title for the model. Claude Code’s search only sees what Brave has indexed, and the main model picks among titles and URLs. So make sure Brave and Claude-SearchBot can crawl you, put the year in the titles of pages about current versions, and write titles that state what the page answers.
Tests to run against this agent
Section titled “Tests to run against this agent”If you want to check any of this against your own site, these are the tests I’d run.
- Header capture. Set up a page that logs request headers and IPs. Prompt
claude -p "Fetch https://yoursite/probe/abc and tell me the phrase on it". Expect one GET with the Claude-User UA and markdown-first Accept from your own IP, and no robots.txt request. - Blocklist status. Run
curl -A claude-code/2.1.328 "https://api.anthropic.com/api/web/domain_info?domain=yoursite.com". Expectcan_fetch: true; anything else means Claude Code cannot read you locally. - robots.txt and the blocklist. Add
User-agent: Claude-User/Disallow: /on a test domain, wait a week, and re-run tests 1 and 2. A change incan_fetchwould show whether Anthropic syncs robots rules into the list. - Summariser loss. Publish a page with a unique token at the top, another at 50,000 characters, and a third at 150,000 characters, then ask Claude Code for each. Expect the first to survive, the second to depend on the prompt, and the third to require an
offsetread. - Markdown negotiation. Serve
text/markdownwhen Accept prefers it and compare answer fidelity on a long code sample against the HTML version. Expect cleaner extraction but the same 125-character quote limit. - Redirect handling. Point
old.yoursite.com/xatnewsite.com/xwith a 301. Expect a single hit on the old host, then a second fetch and permission prompt only if the model follows. - Search attribution. Publish an unlinked page, submit it only to Brave, and ask Claude Code a question only that page answers. Expect a Claude-User fetch only after Brave indexes it.
- Cloud path. Repeat test 1 from Claude Code on the web. Expect Anthropic IPs, a robots.txt request, and no hit on a repeat within the proxy’s cache window.
Open questions
Section titled “Open questions”- Whether the
domain_infoblocklist incorporates site robots.txt rules forClaude-User, and how often it updates. Test 3 settles it. - Which Haiku version summarises today, and whether
ANTHROPIC_SMALL_FAST_MODELis overridden for enterprise users; the binary lists bothclaude-haiku-4-5andclaude-haiku-5-5. - Whether every WebSearch query goes to Brave, or whether the “search service” and cloud proxy backends use another index or Claude-SearchBot’s own crawl.
- How long the cloud fetch proxy keeps stored copies, and whether it shares them across users.
Further reading
Section titled “Further reading”- Anthropic: Does Anthropic crawl data from the web, and how can site owners block the crawler?
- Anthropic: Claude Code data usage, including the WebFetch domain safety check
- Anthropic: Web search tool API reference
- Mikhail Shilkov: Inside Claude Code’s web tools: WebFetch vs WebSearch
- Zapier: What we learned watching Claude read Zapier
- Simon Willison: Anthropic appear to be using Brave to power web search
- Ahrefs: llms.txt log study of 137K sites
- Cloudflare Radar: Claude-User bot directory entry
Last reviewed 2026-12-02 against Claude Code 2.1.328. This site is re-reviewed monthly; see maintenance.