Skip to content

Update a variable

PUT
/api/v4/projects/{id}/variables/{key}

Updates a project variable. If there are multiple variables with the same key, use filter to select the correct environment_scope.

id
required
One of:
string

The ID of a project or URL-encoded NAMESPACE/PROJECT_NAME of the project owned by the authenticated user

key
required
string

The key of a variable

Media type application/json
object
value

The value of a variable

string
nullable
protected

Whether the variable is protected

boolean
nullable
masked

Whether the variable is masked

boolean
nullable
environment_scope

The environment_scope of a variable

string
nullable
raw

Whether the variable will be expanded

boolean
nullable
variable_type

The type of the variable. Default: env_var

string
nullable
Allowed values: env_var file
filter

Available filters: [environment_scope]. Example: filter[environment_scope]=production

object
environment_scope

The environment scope of a variable

string
nullable
description

The description of the variable

string
nullable

OK

Media type application/json
object
variable_type
string
key
string
value
string
hidden
boolean
protected
boolean
masked
boolean
raw
boolean
environment_scope
string
description
string
Example
{
"variable_type": "env_var",
"key": "TEST_VARIABLE_1",
"value": "TEST_1",
"environment_scope": "*",
"description": "This variable is being used for ..."
}

Bad Request

Variable Not Found