The Container Environment Variables API lets you read, set, bulk-merge, and delete environment variables on a running container. Writes are propagated to two locations inside the container:
/etc/environment — picked up by PAM/SSH sessions on the next login.
Incus environment.<key> config — visible to incus exec.
Already-running processes keep their original environment until they re-exec. Variable keys must match ^[a-zA-Z_][a-zA-Z0-9_]*$, be at most 256 characters, and must not start with the reserved HOODY_ prefix. Variable values are strings with a maximum length of 32,768 characters.
Merge environment variables into the container. Existing keys are overwritten with the supplied values, new keys are added, and keys absent from the body are left untouched. Writes are propagated to /etc/environment and to Incus environment.<key>; already-running processes do not pick up the change until they re-exec.
Check the error message for specific field requirements and correct your input
INVALID_ENV_KEY
Invalid Environment Variable Key
The environment variable key is invalid. Keys must start with a letter or underscore, contain only alphanumeric characters and underscores, and must not start with the reserved HOODY_ prefix
Use a key that matches [a-zA-Z_][a-zA-Z0-9_]* and does not start with HOODY_
RESERVED_ENV_PREFIX
Reserved Environment Variable Prefix
Environment variable keys starting with HOODY_ are reserved for system use and cannot be set or deleted by users
Use a different key name that does not start with HOODY_
MISSING_TOKEN
Authentication token missing
No authentication token was provided in the request
Include a valid JWT token in the Authorization header as Bearer <token>
RESOURCE_ACCESS_DENIED
Resource access denied
You do not have permission to access this specific resource
Ensure you own this resource or have been granted access by the owner
CONTAINER_NOT_FOUND
Container not found
The requested container does not exist or you do not have permission to access it
Verify the container ID is correct and that you have access to the project it belongs to
Create or update one environment variable on the container. Writes are propagated to /etc/environment and to Incus environment.<key>; already-running processes do not pick up the change until they re-exec.
Check the error message for specific field requirements and correct your input
INVALID_ENV_KEY
Invalid Environment Variable Key
The environment variable key is invalid. Keys must start with a letter or underscore, contain only alphanumeric characters and underscores, and must not start with the reserved HOODY_ prefix
Use a key that matches [a-zA-Z_][a-zA-Z0-9_]* and does not start with HOODY_
RESERVED_ENV_PREFIX
Reserved Environment Variable Prefix
Environment variable keys starting with HOODY_ are reserved for system use and cannot be set or deleted by users
Use a different key name that does not start with HOODY_
MISSING_TOKEN
Authentication token missing
No authentication token was provided in the request
Include a valid JWT token in the Authorization header as Bearer <token>
RESOURCE_ACCESS_DENIED
Resource access denied
You do not have permission to access this specific resource
Ensure you own this resource or have been granted access by the owner
CONTAINER_NOT_FOUND
Container not found
The requested container does not exist or you do not have permission to access it
Verify the container ID is correct and that you have access to the project it belongs to
Remove a single environment variable from the container. The operation is idempotent — the response is 200 whether or not the key previously existed. The variable is removed from /etc/environment (new PAM/SSH logins will no longer see it) and unset from Incus environment.<key>. Already-running processes keep their copy until they re-exec.