Add or edit environment variables
Add or update environment variables with POST /v2/apps//envs. Variables left out of the body stay untouched, which suits rotating a single key.
POST
Add or edit environment variables
string
required
The API key for your account. You can find this in your account settings.
envs:write scope.
Use this endpoint to add new environment variables or update specific ones without touching the rest. Existing variables that aren’t included in the request body are left untouched, which makes it the safest option for incremental changes like rotating a single API key.
Static applications don’t support environment variables and return an error. The full set is capped at 256 variables per application, with a 1024-character limit per key and 4096 characters per value. On workspace-shared applications, the caller needs the admin role or ownership.
To replace the entire variable set instead of merging, use Overwrite Variables. To remove specific keys, see Remove Variables, and to read the current values, see List Variables.
Parameters
string
required
The application ID.
object
required
The key and value of environment variables.
Response
string
Indicates whether the call was successful:
success if it was, error if not.object
The key and value of all environment variables you defined.
Common errors
Related
- CLI:
squarecloud app env set - SDKs:
api.apps.envs.set()(JavaScript),client.apps.envs.set()(Python),c.Apps.Envs.Set()(Go)

