---
title: "Create an environment variable"
method: POST
path: "/v1/variables"
tags: ["Environment variables"]
---

# Create an environment variable

`POST /v1/variables`

Creates a new environment variable.

## Headers

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

## Request body

- EnvironmentVariablesV1CreateRequest
  - `key` string, required — 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 `201`

Created

- EnvironmentVariablesV1MutationResponse
  - `key` string, required — The key of the environment variable (this value cannot be changed).
  - `value` string, required — The submitted value of the environment variable.
  - `locked` boolean, required — Used only in the UI to hide the value like a password.
  - `secret` boolean, required — Whether the environment variable is stored as a secret.

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `409` — Conflict
- `429` — Too Many Requests

## Changes

- **2026-08-12** `87d29dc7b4fe` — 3 breaking, 2 warning, 15 info
  - request body became required
  - for the `header` request parameter `x-checkly-account`, the type/format was changed from `string`/`` to `string`/`uuid`
  - the `key` request property's minLength was increased from `0` to `1`
  - removed the optional property `attributes` from the response with the `401` status
  - …16 more

[Change history](https://skmtc.dev/checklyhq/apis/checkly-public-api/changes/v1/variables/post.md)

---

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