/ api reference
Environment variables
Variables are managed per project, one entry per key, with a value in each environment that has it. Values are encrypted at rest, and a secret's value is never returned by any route.
A deployment reads its variables when it's built: redeploy after a change.
- get/projects/{projectId}/variablesList variables
- post/projects/{projectId}/variablesCreate variables
- patch/projects/{projectId}/variables/{key}Update a variable
- delete/projects/{projectId}/variables/{key}Delete a variable
List variables
/api/v1/projects/{projectId}/variablesOne entry per key, with its value in each of the project's environments. A secret's value is never returned, by this route or any other; sameValue says whether every environment holds the same one. value at the top level is set when sameValue is true and the variable is not secret.
Requires Viewer key or above (workspace.read)
Parameters
projectIdstringin pathrequired
Responses
200The project's environments and variables.Response fields
environmentsobject[]required3 fields
idstringrequirednamestringrequiredactiveDeploymentIdstring | nullrequired
variablesobject[]required7 fields
keystringrequiredsecretbooleanrequirednotestring | nullrequiredsameValuebooleanrequiredvaluestringupdatedAtstringrequiredenvironmentsobject[]required4 fields
environmentIdstringrequiredsecretbooleanrequiredvaluestringupdatedAtstringrequired
404No such project in this workspace.
Create variables
/api/v1/projects/{projectId}/variablesSets up to 100 variables, with the same values, in each of environmentIds. Values are encrypted at rest. All or nothing: if a key already exists in one of the environments, nothing is written and the 409 lists every conflict. A running deployment reads new values only once redeployed.
Requires Developer key or above (variables.write)
Parameters
projectIdstringin pathrequired
Body
secretbooleanrequiredenvironmentIdsstring[]requiredat least 1 item
variablesobject[]requiredat least 1 item · at most 100 items
3 fields
keystringrequiredmatches ^[A-Z_][A-Z0-9_]*$
valuestringrequiredat most 4096 characters
notestring | nullat most 500 characters
Responses
201The created variables.Response fields
variablesobject[]required7 fields
keystringrequiredsecretbooleanrequirednotestring | nullrequiredsameValuebooleanrequiredvaluestringupdatedAtstringrequiredenvironmentsobject[]required4 fields
environmentIdstringrequiredsecretbooleanrequiredvaluestringupdatedAtstringrequired
404No such project in this workspace.409Some keys already exist in the chosen environments.Body: see Errors
422An environment of another project, the same key twice, or more than an environment's 100 variables.
Update a variable
/api/v1/projects/{projectId}/variables/{key}Every field is optional. key renames it, secret: true hides its values from now on, and environments is the full set of environments the variable is kept in: one left out loses it, one with no value keeps its own, and an added one with no value takes the value the others share (when they differ, it needs one). A secret can never become a plain variable again.
Requires Developer key or above (variables.write)
Parameters
projectIdstringin pathrequiredkeystringin pathrequired
Body
keystringmatches ^[A-Z_][A-Z0-9_]*$
secretbooleannotestring | nullat most 500 characters
environmentsobject[]at least 1 item
2 fields
environmentIdstringrequireduuid
valuestringat most 4096 characters
Responses
200The variable.Response fields
keystringrequiredsecretbooleanrequirednotestring | nullrequiredsameValuebooleanrequiredvaluestringupdatedAtstringrequiredenvironmentsobject[]required4 fields
environmentIdstringrequiredsecretbooleanrequiredvaluestringupdatedAtstringrequired
404No such project in this workspace, or no variable with that key.409The new key already exists in one of the environments.Body: see Errors
422A secret turned back into a plain variable, an environment of another project, an added environment with novaluewhile the others differ, or more than 100 variables in one environment.
Delete a variable
/api/v1/projects/{projectId}/variables/{key}Removes the key from every environment of the project.
Requires Developer key or above (variables.write)
Parameters
projectIdstringin pathrequiredkeystringin pathrequired
Responses
204Deleted.404Project not found, or no variable with that key.