/v1/deployments/{uid}/env-varsCreates the variable, or replaces its value if a variable with the same key exists. The
value is stored encrypted. Every variable is available both at build time and at runtime.
Changes are staged: the running app keeps its old environment until the next deploy, and
Get a deployment reports env_changes_pending: true
until then. Apply them with Deploy a deployment.
Requires a workspace role that can manage secrets.
Authentication
Send your API key as Authorization: Bearer <token>. The request is scoped to the workspace in X-Workspace-Slug.
Path parameters
uidstringRequiredThe deployment's uid.
Headers
X-Workspace-SlugstringRequiredSlug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.
Request body
keystringRequiredVariable name. Starts with a letter or underscore, then letters, digits and underscores, up to 128 characters.
valuestringRequiredVariable value. Must not be empty. Trailing newlines are removed (surrounding whitespace is trimmed for env_vars on create).
scopestringKept for older clients. Every variable is available at build time and at runtime whatever you send, and it is stored as build.
One ofbuildruntimeboth
is_secretbooleanMarks the value as secret.
Default true
Response
The saved variable, without its value.
successbooleanRequiredtrue when the request succeeded.
messagestringRequiredHuman-readable status message.
dataobjectShow attributesHide attributes
uidstringRequiredUnique identifier of the variable.
keystringRequiredVariable name.
scopestringRequiredAlways build. Every variable is available at build time and at runtime.
is_secretbooleanRequiredWhether the value is marked secret.
masked_valuestringRequiredAlways ••••••••. The value is never returned here.
created_atstring (date-time)RequiredWhen the variable was created.
updated_atstring (date-time)RequiredWhen it was last changed.
Errors
| Status | Meaning |
|---|---|
400 | invalid request (missing key or value), key must start with a letter or underscore and contain only letters, numbers, and underscores, scope must be runtime or build, or value is required. |
401 | The API key is missing, invalid, expired or revoked. |
403 | You cannot access the workspace, your role does not allow this action, or the account is suspended. |
404 | The resource does not exist or you cannot access it. |
Errors use the standard error format.