> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cube.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Set env variables

Upserts deployment environment variables by name; variables not included keep their existing values. Passing the `[ENCRYPTED]` placeholder (the masked read value) is rejected — omit variables you do not intend to change.


## OpenAPI

````yaml /api-reference/api.yaml put /v1/deployments/{deploymentId}/env-vars
openapi: 3.1.0
info:
  title: Cube Cloud REST API
  version: 1.0.0
  description: >-
    Programmatically manage Cube Cloud: deployments and everything scoped to
    them

    (environments, folders, reports, workbooks, notifications, workspace, and
    agents),

    plus account-level users, groups, policies, embedding, and AI settings.
servers:
  - url: https://{tenant}.cubecloud.dev/api
    description: >-
      Cube Cloud API base URL. Replace the whole host if you use a custom
      domain.
    variables:
      tenant:
        default: your-tenant
        description: Your Cube Cloud tenant subdomain
security:
  - bearerAuth: []
tags:
  - name: Deployments
  - name: Environments
  - name: Folders
  - name: Reports
  - name: Workbooks
  - name: Notifications
  - name: Workspace
  - name: User Attributes
  - name: App Theme
  - name: Embed
  - name: Embed Tenants
  - name: Dbt Sync
  - name: Env Variables
  - name: OAuth Integrations
  - name: OIDC Token Configs
  - name: Regions
  - name: Tenant Settings
  - name: User Attribute Values
  - name: User OAuth Tokens
  - name: Users Admin
paths:
  /v1/deployments/{deploymentId}/env-vars:
    put:
      tags:
        - Env Variables
      summary: Set env variables
      operationId: setEnvVariables
      parameters:
        - in: path
          name: deploymentId
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetEnvVariablesInput'
        description: SetEnvVariablesInput
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvVariablesListResponse'
          description: ''
components:
  schemas:
    SetEnvVariablesInput:
      properties:
        env_variables:
          items:
            $ref: '#/components/schemas/EnvVariableDto'
          type: array
      required:
        - env_variables
      type: object
    EnvVariablesListResponse:
      properties:
        data:
          items:
            $ref: '#/components/schemas/EnvVariableDto'
          type: array
      required:
        - data
      type: object
    EnvVariableDto:
      properties:
        name:
          type: string
        value:
          type: string
      required:
        - name
        - value
      type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Token authentication. Send `Authorization: Bearer <YOUR_TOKEN>`.'

````