---
title: "Update an environment variable"
method: PUT
path: "/v1/variables/{key}"
tags: ["Environment variables"]
---

# Update an environment variable

`PUT /v1/variables/{key}`

Updates an environment variable. Uses the "key" field as the ID for updating. Only updates value, locked, and secret properties. Once a value is set to secret, it cannot be unset.

## Path parameters

- `key` string, required

## Headers

- `x-checkly-account` string — Your Checkly account ID, you can find it at https://app.checklyhq.com/settings/account/general

## Request body

- EnvironmentVariableUpdate
  - `key` string — The key of the environment variable (this value cannot be changed).
  - `value` string, required — The value of the environment variable.
  - `locked` boolean — Used only in the UI to hide the value like a password.
  - `secret` boolean — Set an environment variable as secret. Once set, its value cannot be unlocked.

## Response `200`

Successful

- EnvironmentVariable
  - `key` string, required — The key of the environment variable (this value cannot be changed).
  - `value` string, required
  - `locked` boolean — Used only in the UI to hide the value like a password.
  - `secret` boolean — Set an environment variable as secret. Once set, its value cannot be unlocked.

## Other responses

- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `429` — Too Many Requests

---

[API](https://skmtc.net/checklyhq/apis/checkly-public-api.md) · [All operations](https://skmtc.net/checklyhq/apis/checkly-public-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/checklyhq/checkly-public-api/revisions/9e903da4f3da/schema)
