Update Environment Variables
PUT {{base_url}}/api/v3/accounts/{{account_id}}/projects/{{project_id}}/environment-variables/bulk/
Note: The sample payload is for UPDATING existing environment variable values only - and not for:
- CREATING brand new environment variables.
- ASSIGNING a value to an existing environment variable for a particular environment which was previously unset (i.e. perhaps it was set on the Project level only and was left empty or unset for the Deployment environment).
See Retrieve Environment Variables for a given Project
for more information on what these {{ environment_variable_value_id }}
are.
See Create Environment Variables
for more information on how to create brand new environment variables.
Assigning a value to an environment's environment variable when it was previously unset
> In the example above, the environment Development
did not have the env var DBT_ENV_TEST
set when it was first created - thus it was left as None
.
Use a payload like this instead:
{
"env_vars": {
"Development": "bar",
"name": "DBT_ENV_TEST"
}
}
Response:
{
"status": {
"code": 200,
"is_success": true,
"user_message": "Success!",
"developer_message": ""
},
"data": {
"message": "Updated environment variable: DBT_ENV_TEST",
"new_var_ids": [
12345
]
}
}
Here, we are setting the environment variable DBT_ENV_TEST
to have the value of bar
for the environment Development
. The response includes the new {{ environment_variable_value_id }}
of 12345
- which we can use in future PUT calls to this endpoint to update it's value.
After assigning, the dbt Cloud UI reflects the changes: