CLAUDE_CODE_ATTACHMENTS_IN_USER_DATA
Updated by Alex Sorokoletov
CLAUDE_CODE_ATTACHMENTS_IN_USER_DATA is a Claude Code environment variable: Off unless set. In remote sessions it governs reading session attachments from a user-data uploads root, behind a retention check that withholds the path when retention is governed or cannot be confirmed. Present in v2.1.301 but not named in that release's changelog. Its release history is not tracked here. It is not in the official reference.
| Status | Present in v2.1.301 |
|---|---|
| Category | Other |
| Official docs | Not listed |
How to set it
For one session, export it in the shell that starts Claude Code:
export CLAUDE_CODE_ATTACHMENTS_IN_USER_DATA=<value>
claudeTo apply it to every session, add it to the env object of a settings file:
// ~/.claude/settings.json
{
"env": {
"CLAUDE_CODE_ATTACHMENTS_IN_USER_DATA": "<value>"
}
}Release notes that mention it
- Claude Code Version Tracker: Undocumented Env Vars, Feature Gates & Models
- claude-code-env-vars-v2-1-301
Related variables
CLAUDE_CODE_ATTACHMENTS_BY_PATH: When set, the attachment handler takes the by-path route instead of an upload mode, so attachments are referenced by their file path rather than having their contents uploaded.CLAUDE_CODE_USER_EMAIL: Pre-configured user email.CLAUDE_CODE_FORWARD_USER_INTENTANTHROPIC_BETAS: Comma-separated beta feature headers.ANTHROPIC_CUSTOM_HEADERS: Custom HTTP headers (newline-separated Key: Value).ANTHROPIC_FEDERATION_RULE_IDANTHROPIC_ORGANIZATION_IDANTHROPIC_WORKSPACE_ID
Frequently asked questions
What does CLAUDE_CODE_ATTACHMENTS_IN_USER_DATA do?
Off unless set. In remote sessions it governs reading session attachments from a user-data uploads root, behind a retention check that withholds the path when retention is governed or cannot be confirmed. Present in v2.1.301 but not named in that release's changelog.
Which Claude Code version has CLAUDE_CODE_ATTACHMENTS_IN_USER_DATA?
Its release history is not tracked here.
How do I set CLAUDE_CODE_ATTACHMENTS_IN_USER_DATA?
Export it before starting Claude Code (export CLAUDE_CODE_ATTACHMENTS_IN_USER_DATA=value), or add it to the "env" object in ~/.claude/settings.json to apply it to every session.
All variables, searchable: Claude Code environment variables.