Docs
/
/

Variables mAPI reference

Complete reference documentation for the Variables resource.

Variables

#

Variables are used to store shared attributes for your workflows and templates at the environment level.

List variables

#

Returns a list of variables. When an environment is specified, returns per-environment variables. Otherwise, returns project-scoped variables with per-environment overrides.

Endpoint

GET/v1/variables

Query parameters

environment
string

The environment slug. When omitted, the account's default environment is used for authorization while the response remains project-scoped.

branch
string

The slug of a branch to use. When environment is omitted, the branch is resolved from Development after the account default is injected. When environment is supplied, it must be "development".

type
enum(string)

Filter variables by type. Supports 'public' or 'secret'.

publicsecret
after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

limit
integer

The number of entries to fetch per-page.

Returns

PaginatedVariableResponse

A paginated list of Variable. Contains a list of entries and page information.

entries

A list of entries.

description
string

The description of the variable.

environment_values
object(any)

A map of environment slugs to their override values. Only present for project-scoped responses.

inserted_at
string(date-time)
Required

The timestamp of when the variable was created.

key
string
Required

The key of the variable.

type
enum(string)
Required

The type of the variable.

publicsecret
updated_at
string(date-time)
Required

The timestamp of when the variable was last updated.

value
string

The default value of the variable. For secret variables, this is obfuscated.

page_info

The information about a paginated result.

after
string

The cursor to fetch entries after. Will only be present if there are more entries to fetch.

before
string

The cursor to fetch entries before. Will only be present if there are more entries to fetch before the current page.

page_size
integer

The number of entries to fetch per-page.

Get a variable

#

Returns a single variable by key with per-environment value overrides.

Endpoint

GET/v1/variables/{key}

Path parameters

key
string

The key of the variable to retrieve.

Returns

An environment variable object.

description
string

The description of the variable.

environment_values
object(any)

A map of environment slugs to their override values. Only present for project-scoped responses.

inserted_at
string(date-time)

The timestamp of when the variable was created.

key
string

The key of the variable.

type
enum(string)

The type of the variable.

publicsecret
updated_at
string(date-time)

The timestamp of when the variable was last updated.

value
string

The default value of the variable. For secret variables, this is obfuscated.

Delete a variable

#

Deletes a variable and all of its environment overrides. When an environment is specified, only the override for that environment is cleared, so the default value applies there.

Endpoint

DELETE/v1/variables/{key}

Path parameters

key
string

The key of the variable to delete.

Query parameters

environment
string

The environment slug. When provided, only the variable's override for this environment is cleared. When omitted, the whole variable is deleted and the account's default environment is used for authorization.

Returns

204 No Content

Upsert a variable

#

Creates or updates a variable by key, along with its per-environment overrides. On an update, any attribute or environment that is omitted or null is left unchanged, and an empty string unsets it. The response never includes the value of a secret variable.

Endpoint

PUT/v1/variables/{key}

Path parameters

key
string

The key of the variable to upsert.

Request body

description
string

The description of the variable. When omitted or null on an update, the existing description is kept. An empty string clears it.

environment_values
object(any)

A map of root environment slugs to override values. An environment that is omitted or null is left unchanged. An empty string clears the override, so the default value applies.

type
enum(string)
Required

The type of the variable. Required, and it cannot be changed after the variable is created.

publicsecret
value
string

The default value of the variable. Required when creating a variable. When omitted or null on an update, the existing value is kept. An empty string clears the default value.

Returns

An environment variable object.

description
string

The description of the variable.

environment_values
object(any)

A map of environment slugs to their override values. Only present for project-scoped responses.

inserted_at
string(date-time)

The timestamp of when the variable was created.

key
string

The key of the variable.

type
enum(string)

The type of the variable.

publicsecret
updated_at
string(date-time)

The timestamp of when the variable was last updated.

value
string

The default value of the variable. For secret variables, this is obfuscated.

Variable

#

An environment variable object.

Attributes

description
string

The description of the variable.

environment_values
object(any)

A map of environment slugs to their override values. Only present for project-scoped responses.

inserted_at
string(date-time)

The timestamp of when the variable was created.

key
string

The key of the variable.

type
enum(string)

The type of the variable.

publicsecret
updated_at
string(date-time)

The timestamp of when the variable was last updated.

value
string

The default value of the variable. For secret variables, this is obfuscated.

New chat