---
title: "Edit a variable"
method: PUT
path: "/variable/{variableId}"
tags: ["Variable Main Calls"]
---

# Edit a variable

`PUT /variable/{variableId}`

## Request

- Base URL: `https://api.qovery.com`
- URL: `https://api.qovery.com/variable/{variableId}`
- Auth: one of:
  - API key in header `Authorization`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/qovery/apis/qovery-api/docs/variable/:variableId/put.ts> (a function with typed inputs; its response is checked against the schema)

- You can't edit a BUILT_IN variable
- For an override, you can't edit the key
- For an alias, you can't edit the value

## Path parameters

- `variableId` string, uuid, required

## Request body

- VariableEditRequest
  - `key` string, required: the key of the environment variable
  - `value` string, nullable: the value of the environment variable
  - `description` string, nullable: optional variable description (255 characters maximum)
  - `enable_interpolation_in_file` boolean, nullable

## Response `200`

Edited variable value

- VariableResponse
  - `id` string, uuid, required
  - `created_at` string, date-time, required
  - `updated_at` string, date-time
  - `key` string, required
  - `value` string, nullable, required
  - `mount_path` string, nullable
  - `overridden_variable` VariableOverride
    - `id` string, uuid, required: The id of the overriden variable
    - `key` string, required: The key of the overriden variable
    - `value` string, nullable: The value of the overriden variable
    - `mount_path` string, required: The mounth path of the overriden variable (only if environment variable type is 'file')
    - `scope` 'APPLICATION' | 'BUILT_IN' | 'ENVIRONMENT' | 'PROJECT' | 'CONTAINER' | 'JOB' | 'HELM' | 'TERRAFORM', required
    - `variable_type` 'VALUE' | 'ALIAS' | 'OVERRIDE' | 'BUILT_IN' | 'FILE', required: type of the environment variable (VALUE, FILE, ALIAS, OVERRIDE or BUIT_IN)
  - `aliased_variable` VariableAlias
    - `id` string, uuid, required
    - `key` string, required
    - `value` string, nullable
    - `mount_path` string, required
    - `scope` 'APPLICATION' | 'BUILT_IN' | 'ENVIRONMENT' | 'PROJECT' | 'CONTAINER' | 'JOB' | 'HELM' | 'TERRAFORM', required
    - `variable_type` 'VALUE' | 'ALIAS' | 'OVERRIDE' | 'BUILT_IN' | 'FILE', required: type of the environment variable (VALUE, FILE, ALIAS, OVERRIDE or BUIT_IN)
  - `scope` 'APPLICATION' | 'BUILT_IN' | 'ENVIRONMENT' | 'PROJECT' | 'CONTAINER' | 'JOB' | 'HELM' | 'TERRAFORM', required
  - `variable_type` 'VALUE' | 'ALIAS' | 'OVERRIDE' | 'BUILT_IN' | 'FILE', required: type of the environment variable (VALUE, FILE, ALIAS, OVERRIDE or BUIT_IN)
  - `service_id` string, uuid: The id of the service referenced by this variable.
  - `service_name` string: The name of the service referenced by this variable.
  - `service_type` 'APPLICATION' | 'CONTAINER' | 'DATABASE' | 'JOB' | 'HELM' | 'TERRAFORM': type of the service (application, database, job, gateway...)
  - `owned_by` string: Entity that created/own the variable (i.e: Qovery, Doppler)
  - `is_secret` boolean, required
  - `description` string
  - `enable_interpolation_in_file` boolean

## Other responses

- `400`: Bad request
- `401`: Access token is missing or invalid
- `403`: Access forbidden
- `404`: Resource not found

---

[API](https://skmtc.dev/qovery/apis/qovery-api.md) - [All operations](https://skmtc.dev/qovery/apis/qovery-api/llms.txt) - [OpenAPI document](https://skmtc.dev/qovery/apis/qovery-api/revisions/93c4960a44ba?raw)
