Variables and secrets
A variable is a named value that steps insert with double braces: {{email}}. This page is about managing a project’s variables. Values in steps covers how steps use them.
Add a variable
Section titled “Add a variable”Choose Variables in the sidebar, under Workflows. The variables open in a panel over the page you are on; Open as a page gives them a page of their own.
- Name: starts with a letter, then letters, digits,
-, and_. - Value: any text that is not empty.
- For: the default, used on every environment, or one environment only.
- Secret: whether the value is hidden.
Choose Add, or Add secret for a secret.
A default and a value per environment
Section titled “A default and a value per environment”A variable can have a default, used on every environment, and its own value on any environment, which is used there in place of the default.
For example, {{email}} might default to qa@example.com and be qa-prod@example.com on production.
Edit on a variable shows its default and every environment’s value together. Each environment says its own value, uses the default, or not set.
A run on an environment where a variable it uses has no value does not start, and says which variable is missing.
Secrets
Section titled “Secrets”Turn on Secret for a value that must not be seen, such as a test account’s password.
- A secret is stored encrypted.
- Once saved, its value is never shown again, in Belay or through MCP. The list shows only whether it is set.
- A step can enter a secret only into a password field. See Secrets in steps.
- Editing a secret shows an empty field. Saving it empty keeps the value it has.
Changing a plain variable into a secret is refused while a step uses it somewhere other than typing it into a field. Changing a secret into a plain variable warns you first, since its value is then shown to everyone who can view the project.
Store only test accounts’ passwords in secrets, not real people’s.
A workflow’s own variables
Section titled “A workflow’s own variables”A workflow can have variables of its own. In the editor, type {{ in a step, choose New variable…, give it a name and a value, and choose Add to this workflow.
A workflow’s variable is plain, never a secret. When it has the same name as a project variable, the workflow’s value is used in that workflow, even where the project’s is a secret, and it is shown like any plain value. The variable list says how many workflows use their own value for a name.
Where a variable is used
Section titled “Where a variable is used”The list shows how many workflows use each variable; hover the number to see which.
A variable that a saved workflow’s steps use cannot be deleted. Belay names the workflows; change those steps or delete those workflows first.
With an agent
Section titled “With an agent”list_variables shows each variable with its kind, default, and each environment’s value. A secret’s value is never returned, only whether it is set. save_variable adds a variable or sets a value: the default, or with environment_id the value for that environment. delete_variable removes one.