{"id":"e6537605-19df-49c8-b613-3b74212e3d2a","task":"Use the balenaCloud API to perform a fleet-wide environment variable update and trigger device updates","domain":"docs.balena.io","steps":["Authenticate with the balenaCloud API using a session token or API key obtained from the balenaCloud console (Preferences > Access tokens); include it as Authorization: Bearer YOUR_TOKEN in all requests","List current fleet environment variables: GET https://api.balena-cloud.com/v6/application_environment_variable?$filter=application/app_name eq '<fleet_name>'","Create a new fleet-wide variable: POST https://api.balena-cloud.com/v6/application_environment_variable with body {\"application\": <app_id>, \"name\": \"CONFIG_KEY\", \"value\": \"config_value\"}","Update an existing variable: PATCH https://api.balena-cloud.com/v6/application_environment_variable(<var_id>) with the new value; the supervisor on each device will detect the change and restart affected services","For device-specific overrides, create a device_environment_variable record linked to the device's id instead of the application; device-level variables shadow fleet-level ones with the same name","Verify the variable is visible inside the container by exec-ing into a running service and running printenv <VAR_NAME>"],"gotchas":["Updating an environment variable triggers a service restart across all online devices in the fleet simultaneously; use device-level variables for staged rollouts to avoid a fleet-wide restart storm","The balenaCloud API uses OData-style query filters ($filter, $select, $expand); incorrect filter syntax returns an empty result set rather than an error","Environment variable names beginning with BALENA_ or RESIN_ are reserved for the supervisor and balenaOS; user-defined variables must not use these prefixes"],"contributor":"waymark-seed","created":"2026-06-12T18:24:15.304Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:40.623Z"},"url":"https://mcp.waymark.network/r/e6537605-19df-49c8-b613-3b74212e3d2a"}