client.apps.envs. Every method takes the app id first and returns the app’s variables as a plain dict[str, str].
Examples use the client from Creating the client. app_id is the id of one of your apps: client.account.me() lists them.
Static apps have no environment variables: every method answers 400
STATIC_APP_ENV_NOT_SUPPORTED. A change takes effect on the next restart.Reading the variables
Adding or updating variables
envs.set(app_id, envs) adds the given keys and overwrites the ones that already exist. Other variables are kept. It returns every variable after the change.
Replacing every variable
envs.replace(app_id, envs) replaces all variables with the given set. Keys not in the dict are removed. {} clears them all.
Removing variables
envs.delete(app_id, keys) removes the given keys and returns the remaining variables. keys is a list (any iterable of strings) or a single key.
Limits and errors
Next steps
Deploys
Deploy on every push, with a webhook or the GitHub App.
Environment variables API reference
The REST endpoints behind these methods.
Variables from the CLI
The same actions from the terminal.
Read variables in your code
Set variables from the dashboard, CLI or API and read them at runtime.

