Set gateway variables

A gateway variable is a named value stored in one environment. Recipes read it as sdk.env.NAME when they run in that environment, so the same recipe can use a different value in Staging and in Production.

Variables are encrypted and are never shown again after you save them. Clients do not see them, and a script a client runs in Code mode cannot read them.

Add a variable

To add a variable:

  1. In the portal, go to Agent Gateway and select your gateway.
  2. Check the environment button in the header. The variable is stored in the environment it names.
  3. Select the Variables tab, then Add a variable.
  4. Enter the name and the value.
  5. Select Add.

The table lists the variable by name with the date it was last updated. The value column shows only its length.

A recipe reads the variable by name:

const res = await sdk.crm.contactsList({ region: sdk.env.REGION })
return res.items

Replace a value

To store a new value under an existing name, select Rotate on the variable's row, enter the new value and select Rotate. The previous value cannot be recovered.

Delete a variable

Select Delete on the variable's row and confirm. Every recipe that reads that name in this environment fails on the line that reads it.

Limits

Limit Value
Name Letters, digits and underscores, not starting with a digit. Up to 64 characters.
Value Up to 4096 characters.
Variables per environment 100

Variables and environments

Variables are not copied when you add an environment or promote one onto another. The Variables tab also lists the names that another environment of the gateway has and this one lacks. Select one of those rows to set its value here. Values never travel between environments.

Troubleshooting

Symptom Cause Fix
A recipe fails and the error names a variable The variable is not set in the environment the call was made on. Add it in that environment's Variables tab.

Next steps

Last updated November 13, 2026