Answer: Environment variables are set in `.env` format, one `KEY=value` pair per line. Plain values don't need quotes, but quote a value that spans multiple lines or contains a `#`. Status: Confirmed Entry: tool/claude-code/settings/set-cloud-environment-variables Revision: 1 Digest: sha256:c4621b69d7f0ab7d (changes whenever the content changes) Timeline: Created: 2026-11-13T03:03:40Z Last changed: 2026-11-13T03:03:40Z Last verified: 2026-11-20T12:19:12Z Next check: 2026-11-21T12:19:12Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of format | .env | [1] | 2026-11-20 quoting rule | Quote a value that spans multiple lines or contains a `#` | [1] | 2026-11-20 example variable | NODE_ENV=development | [1] | 2026-11-20 excluded variables | OTEL_* | [1] | 2026-11-20 overridden key | CLAUDE_AUTOCOMPACT_PCT_OVERRIDE | [1] | 2026-11-20 Sources: [1] Anthropic. "Configure cloud environments". https://code.claude.com/docs/en/cloud-environments.md Role: primary. Accessed: 2026-11-20T12:19:12Z Quote: "Environment variables use `.env` format, one `KEY=value` pair per line." (Supports: format) Quote: "Quote a value that spans multiple lines or contains a `#`" (Supports: quoting rule) Quote: "NODE_ENV=development" (Supports: example variable) Quote: "except `OTEL_*` variables" (Supports: excluded variables) Quote: "For [`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`](https://code.claude.com/docs/en/claude-code-on-the-web#manage-context), the value the session sets overrides one you add here, so adding that key here has no effect." (Supports: overridden key) Published: 2026-11-20T02:53:36Z Snapshot SHA-256: 3bea3a9e79b860d53eb6752f68b31e69df8e82f5ae85be928fe2795349203368 (captured 2026-11-20T12:19:12Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. Cross-check: not-available at 2026-11-20T12:19:12Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:19:12Z Last attempt: 2026-11-20T12:19:12Z Notes and limitations: Extracted automatically from a single official source (section "Set environment variables"). Related: https://latestn.com/tool/claude-code/settings/set-environment-variables How do I set environment variables for Claude Code in my shell or in a settings file? https://latestn.com/tool/claude-code/settings/set-environment-variables-sdk How do I set environment variables for a Claude Code Agent SDK session? https://latestn.com/tool/claude-code/settings/set-up-status-line How do I set up a custom status line in Claude Code? https://latestn.com/tool/claude-code/settings/reserved-marketplace-names What are the reserved marketplace names in Claude Code? https://latestn.com/tool/claude-code/settings/self-hosted-env-var-only-settings Which settings for Claude Code self-hosted environments can only be configured via environment variables? https://latestn.com/tool/claude-code/settings/session-identity-env-vars Which environment variables are related to Claude Code self-hosted session identity verification? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-18T12:14:49Z | recovered | Check succeeded again | — 2026-11-17T12:23:54Z | check-failed | Extraction did not pass verification: answer contains ` or spanning multiple lines quoted. A session reads the environment's values into ordinary environment variables that any command Claude runs can read, except `, which does not appear in the source | — 2026-11-13T03:03:40Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-code/settings/set-cloud-environment-variables/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-code/settings/set-cloud-environment-variables POST: https://latestn.com/dispute/tool/claude-code/settings/set-cloud-environment-variables with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-code/settings/set-cloud-environment-variables?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I set environment variables for a Claude Code cloud environment? Revision 1, last verified 2026-11-20T12:19:12Z. https://latestn.com/tool/claude-code/settings/set-cloud-environment-variables (accessed 2026-11-21T09:53:27Z). @misc{LatestN_tool_claude_code_settings_set_cloud_environment_variables_r1, title = {How do I set environment variables for a Claude Code cloud environment?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-code/settings/set-cloud-environment-variables}}, note = {Revision 1; digest sha256:c4621b69d7f0ab7d; last verified 2026-11-20T12:19:12Z; accessed 2026-11-21T09:53:27Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-code/settings/set-cloud-environment-variables