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. Added in v2.1.301 and still present in v2.1.332. It is not in the official reference.
| Status | Present in v2.1.332 |
|---|---|
| Added | Added 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_EMIT_USER_PROMPT_SUBMIT_HOOK_EVENTS: When set, enables emitting start and end hook events for user prompt submission; the value is read once and then cleared.CLAUDE_CODE_USER_EMAIL: Pre-configured user email.CLAUDE_CODE_FORWARD_USER_INTENTCLAUDE_CODE_I_ACCEPT_CROSS_ORG_DATA_RISKCLAUDE_TEST_USER_SETTINGSANTHROPIC_BETAS: Comma-separated beta feature headers.ANTHROPIC_CUSTOM_HEADERS: Custom HTTP headers (newline-separated Key: Value).
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?
Added in v2.1.301 and still present in v2.1.332.
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.