Claude Code Telemetry and Data Privacy
What Claude Code sends to Anthropic, whether it trains on it, how long it is kept, and the environment variables that turn telemetry off. Checked 2026-11-10.
- On Free, Pro, Max and Ultra, your data trains future models only while the training setting is on. Under commercial terms (Team, Enterprise, API, third-party platforms), Anthropic does not train on Claude Code code or prompts unless the customer opts in.
- Anthropic's operational telemetry is usage metrics and error reports. DISABLE_TELEMETRY=1 and DISABLE_ERROR_REPORTING=1 turn them off one at a time; CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC turns off all non-essential traffic.
- On Amazon Bedrock, Google Cloud's Agent Platform, Microsoft Foundry and Claude Platform on AWS, telemetry, error reporting and /feedback reports are off by default. Session quality surveys and the WebFetch domain check still run.
Claude Code sends your prompts and the model’s outputs to the model provider, and by default it also sends Anthropic usage metrics and, on some sign-ins, error reports. Whether that data trains models and how long it is kept depends on whether your account is consumer (Free, Pro, Max, Ultra) or commercial (Team, Enterprise, API, third-party platforms). This article sorts out what the official docs say about each, lists the environment variables that turn telemetry off, and ends with a checklist for rolling Claude Code out to a team.
Everything below comes from the official docs as checked on 2026-11-10, when the latest Claude Code on npm was 2.1.322. We did not run any of the commands or settings shown here for this article. This is not legal advice; for contract questions, read the terms themselves or ask your legal team.
What leaves your machine
Claude Code runs locally, but to talk to the model it sends data over the network: all user prompts and model outputs, encrypted in transit with TLS 1.2 or later. The docs say it works with most popular VPNs and LLM proxies.
Encryption at rest depends on the provider:
| Provider | Encryption at rest |
|---|---|
| Anthropic API | Infrastructure-level disk encryption (AES-256). Zero Data Retention means no server-side persistence |
| Amazon Bedrock | AES-256 with AWS-managed keys; customer-managed keys via AWS KMS |
| Google Cloud’s Agent Platform | Google-managed keys; CMEK available |
| Microsoft Foundry | Depends on the hosting option. Hosted on Azure keeps prompts and completions within Azure; Hosted on Anthropic routes to Anthropic infrastructure with AES-256 |
Cloud sessions are different. They run in Anthropic-managed VMs by default: your repository is cloned into the VM, and Anthropic stores the session transcript so you can come back to it.
(source: https://code.claude.com/docs/en/data-usage, checked 2026-11-10)
Is it used for training?
The data-usage page splits accounts in two:
- Consumer (Free, Pro, Max, Ultra): you choose whether your data may improve future models. When the setting is on, Anthropic trains new models on data from these accounts, including Claude Code use.
- Commercial (Team, Enterprise, API, third-party platforms, Claude Gov): Anthropic does not train generative models on code or prompts sent to Claude Code under commercial terms, unless the customer chose to provide data, for example through the Development Partner Program.
An organization admin can opt in to the Development Partner Program. The docs say it is available only on the Anthropic first-party API, not for Amazon Bedrock or Google Cloud’s Agent Platform users.
Two feedback paths are separate from this setting. Transcripts sent with /feedback (and /bug and /share, which use the same path) are kept for 5 years. After a session quality survey, you may be asked whether Anthropic can look at the transcript. Choosing Yes uploads it, with known API key and token patterns redacted, and keeps it for up to 6 months. The docs say survey responses cannot be used to train models.
(source: https://code.claude.com/docs/en/data-usage, checked 2026-11-10)
How long it is kept
| Account | Retention |
|---|---|
| Consumer, model improvement on | 5 years |
| Consumer, model improvement off | 30 days |
| Commercial (Team, Enterprise, API), standard | 30 days |
| Commercial, Zero Data Retention | For qualified Claude for Enterprise accounts. Not in the standard Enterprise plan; enabled per organization by the account team |
| Local transcripts on your machine | Plaintext under ~/.claude/projects/, 30 days by default. Change with cleanupPeriodDays |
Consumer users can change the privacy setting at any time at claude.ai/settings/data-privacy-controls. Cloud sessions can be deleted one at a time, which permanently removes the session’s event data.
(source: https://code.claude.com/docs/en/data-usage, checked 2026-11-10)
Anthropic’s telemetry and how to turn it off
The docs describe two kinds of operational telemetry:
- Metrics: latency, reliability and usage patterns, sent to Anthropic and to third-party logging infrastructure. They never include your code, prompts or file paths.
- Error reports: error messages and stack traces from Claude Code’s own internals, sent to a third-party error tracking service. Known patterns of secrets, file paths, email addresses and other personal information are redacted before anything leaves your machine. Error reporting is on only if you sign in with Pro, Max or Ultra, run v2.1.198 or later, connect directly to the Claude API, and your organization has no zero data retention or HIPAA agreement.
| Variable | What it turns off |
|---|---|
DISABLE_TELEMETRY=1 | Usage metrics. Also disables feature-flag fetching |
DO_NOT_TRACK=1 | Same effect as DISABLE_TELEMETRY |
DISABLE_ERROR_REPORTING=1 | Error reports |
DISABLE_FEEDBACK_COMMAND=1 | /feedback, /bug, /share and Claude-drafted feedback |
CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY=1 | Session quality surveys |
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 | All non-essential traffic: auto-updates, telemetry, error reporting, /feedback, release notes, surveys and more |
Two details are easy to miss. For DISABLE_TELEMETRY, DISABLE_ERROR_REPORTING and CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC, the env-vars page says setting 0 or false still opts out; you unset the variable to turn the feature back on. DO_NOT_TRACK is read as a normal boolean, so 0 leaves telemetry on. Second, turning off feature flags (through DISABLE_TELEMETRY or the non-essential traffic switch) can make Remote Control unavailable.
The WebFetch domain safety check is not covered by any of these. Before fetching a URL, WebFetch sends only the hostname to api.anthropic.com to check a blocklist. It runs on every provider. To turn it off, set skipWebFetchPreflight: true in settings; the docs suggest pairing that with WebFetch permission rules.
(source: https://code.claude.com/docs/en/data-usage, checked 2026-11-10) (source: https://code.claude.com/docs/en/env-vars, checked 2026-11-10)
Bedrock, Agent Platform and Foundry
On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry and Claude Platform on AWS, error reporting, telemetry and bug reporting are off by default. Session quality surveys and the WebFetch domain check are the exceptions; they run regardless of provider.
| Service | Claude API | Bedrock / Agent Platform / Foundry / Claude Platform on AWS |
|---|---|---|
| Metrics | On by default | Off by default |
| Error reports | On for Pro, Max and Ultra sign-ins on v2.1.198+ | Off by default |
/feedback reports | On by default | Off by default |
| Session quality surveys | On by default | On by default |
| WebFetch domain check | On by default | On by default |
On a third-party provider, /feedback and a Yes on the transcript follow-up write the report to a local archive under ~/.claude/feedback-bundles/ instead of uploading it. Nothing leaves the machine until you send that file yourself. If a host platform sets CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST, metrics default to on for these providers.
Contracts follow the same split. The legal page says that whether you use the Claude API directly or through Amazon Bedrock or Google Cloud’s Agent Platform, your existing commercial agreement applies to Claude Code unless agreed otherwise.
(source: https://code.claude.com/docs/en/data-usage, checked 2026-11-10) (source: https://code.claude.com/docs/en/legal-and-compliance, checked 2026-11-10)
Your own monitoring with OpenTelemetry
Separately from Anthropic’s telemetry, Claude Code can export metrics, events and (in beta) traces to your own collector over OpenTelemetry. It is opt-in. The quick start on the monitoring page:
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
claude
The docs say a working metrics setup shows claude_code.session.count in your backend. Other metrics include tokens, cost in USD, lines of code modified, commits, pull requests and active time.
Points that matter when a team turns this on:
- Set it in managed settings. Administrators can push the same variables through the managed settings file. Claude Code ignores the OpenTelemetry exporter variables in a repository’s
.claude/settings.jsonand.claude/settings.local.json, so a repository cannot turn telemetry on or redirect it. - Managed settings lock the destination. When managed settings set
OTEL_EXPORTER_OTLP_ENDPOINT, Claude Code removes developer-set per-signal endpoints at startup. Exporter selectors such asOTEL_LOGS_EXPORTERfollow normal precedence, so set them in managed settings too if they must not change. - Content is off by default. Prompt text, response text and tool arguments are not logged unless you set
OTEL_LOG_USER_PROMPTS,OTEL_LOG_ASSISTANT_RESPONSESorOTEL_LOG_TOOL_DETAILS. Raw file contents and code snippets are not in metrics or events. Trace content (OTEL_LOG_TOOL_CONTENT) and raw API bodies (OTEL_LOG_RAW_API_BODIES) are separate switches that include much more. - Email is included. When users sign in with OAuth,
user.emailis in the telemetry attributes. It goes only to your endpoint, never to Anthropic; filter it in your backend if that is a concern. - Subprocesses don’t inherit it. Claude Code does not pass
OTEL_*variables to the Bash tool, hooks, MCP servers or language servers.
(source: https://code.claude.com/docs/en/monitoring-usage, checked 2026-11-10) (source: https://code.claude.com/docs/en/env-vars, checked 2026-11-10)
Team rollout checklist
Built only from the pages above. Your contract and policies decide the actual answers.
- Decide which account type the team uses: consumer plans, Team or Enterprise, the API, or a cloud provider. Training and retention follow that choice.
- If anyone uses a consumer plan, check the model-improvement setting at claude.ai/settings/data-privacy-controls.
- Decide whether you need zero data retention, and ask the account team whether your organization qualifies.
- Decide which of
DISABLE_TELEMETRY,DISABLE_ERROR_REPORTING,DISABLE_FEEDBACK_COMMANDandCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFICto set. Setting0does not turnDISABLE_TELEMETRY,DISABLE_ERROR_REPORTINGorCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFICback on. - If your network blocks
api.anthropic.com, plan for the WebFetch domain check: allowlist the domain, or setskipWebFetchPreflightwith WebFetch permission rules. - If you run your own OpenTelemetry, set the variables and endpoint in managed settings, leave the content switches off unless you need them, and decide how to handle
user.email. - Decide how long local transcripts may stay under
~/.claude/projects/and setcleanupPeriodDaysto match. - Tell the team that
/feedbacksends conversation history, including code, and that a Yes on the transcript follow-up uploads the session.
Related reading
- Claude Code Env Vars Not Working: where an environment variable has to be set to take effect.
- Keep Secrets Away from Claude Code: keeping keys out of the agent’s reach.
- Claude Code Permissions and settings.json: A Cheat Sheet: settings files and permission rules.
- Claude Code on Bedrock, Vertex and Foundry: Setup Guide: switching Claude Code to a cloud provider.
- Claude Code Setup and Daily Operations: our hub for configuration and daily use.
- Claude Code Ignore Files: keeping specific files out of what Claude Code can read.
Summary
- Prompts and outputs go to the model provider over TLS 1.2+. Encryption at rest depends on the provider.
- Consumer accounts train only with the model-improvement setting on. Commercial terms do not train on Claude Code code or prompts unless the customer opts in.
- Retention: 5 years or 30 days on consumer accounts, 30 days on commercial accounts, zero data retention for qualified Enterprise accounts. Local transcripts stay 30 days by default.
DISABLE_TELEMETRY,DISABLE_ERROR_REPORTINGandCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFICopt out even when set to0. Unset them to turn the feature back on.- On Bedrock, Agent Platform, Foundry and Claude Platform on AWS, telemetry, error reports and
/feedbackreports are off by default. Surveys and the WebFetch check still run. - Your own OpenTelemetry is opt-in, best set in managed settings, and leaves prompt and tool content out unless you turn it on.
- Checked against the official docs on 2026-11-10. We did not run these commands for this article, and this is not legal advice.
FAQ
- Does Claude Code use my code to train models?
- It depends on the account. On Free, Pro, Max and Ultra, Anthropic trains on your data when the model-improvement setting is on. Under commercial terms (Team, Enterprise, API, third-party platforms), it does not train on code or prompts sent to Claude Code unless the customer opts in, for example through the Development Partner Program.
- How do I turn off Claude Code telemetry?
- Set DISABLE_TELEMETRY=1 for usage metrics and DISABLE_ERROR_REPORTING=1 for error reports. CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC turns off all non-essential traffic at once, including surveys. For these three, the docs say 0 or false still opts out; unset the variable to turn it back on.
- How long does Anthropic keep Claude Code data?
- Consumer accounts: 5 years with the model-improvement setting on, 30 days with it off. Commercial accounts: 30 days by default, with zero data retention available to qualified Claude for Enterprise accounts. Locally, transcripts stay under ~/.claude/projects/ for 30 days by default.
- Is telemetry different on Amazon Bedrock or Google Cloud?
- Yes. Metrics, error reports and /feedback reports are off by default on Amazon Bedrock, Google Cloud's Agent Platform, Microsoft Foundry and Claude Platform on AWS. Session quality surveys and the WebFetch domain safety check run on every provider.
- Do OpenTelemetry logs include prompts and code?
- Not by default. Prompt content, response text and tool arguments are off unless you set OTEL_LOG_USER_PROMPTS, OTEL_LOG_ASSISTANT_RESPONSES or OTEL_LOG_TOOL_DETAILS. When signed in with OAuth, user.email is included, sent only to the endpoint you configure.