Skip to content

The Container Environment Variables API lets you list, set, bulk-update, and delete environment variables on a container. Changes are written to /etc/environment (visible to PAM/SSH on next login) and to the Incus container configuration (visible to incus exec). Already-running processes do not pick up changes until they re-exec.

Key names must match the pattern ^[a-zA-Z_][a-zA-Z0-9_]*$ — start with a letter or underscore, then contain only alphanumeric characters and underscores.

Get all environment variables for a container.

NameInTypeRequiredDescription
idpathstringYesContainer ID
{
"statusCode": 200,
"message": "Environment variables retrieved successfully",
"data": {
"environment_vars": {
"DATABASE_URL": "postgres://app:secret@db.internal:5432/app_production",
"NODE_ENV": "production",
"REDIS_HOST": "cache.internal",
"LOG_LEVEL": "info"
}
}
}
Error CodeTitleDescriptionResolution
MISSING_TOKENAuthentication token missingNo authentication token was provided in the requestInclude a valid JWT token in the Authorization header as Bearer <token>
RESOURCE_ACCESS_DENIEDResource access deniedYou do not have permission to access this specific resourceEnsure you own this resource or have been granted access by the owner
CONTAINER_NOT_FOUNDContainer not foundThe 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.
Terminal window
curl -X GET https://api.hoody.com/api/v1/containers/5f9b3c2e1a8d4f7b6c5e2d3a/env \
-H "Authorization: Bearer <token>"

Merge environment variables into the container using merge semantics. Existing keys are updated, new keys are added, and keys not present in the body are left unchanged.

The request body is a JSON object whose keys are environment variable names and whose values are strings. Each value is limited to 32,768 characters. Each key must match ^[a-zA-Z_][a-zA-Z0-9_]*$, be at most 256 characters long, and must not start with HOODY_. The body must contain between 1 and 200 properties.

NameInTypeRequiredDescription
idpathstringYesContainer ID
{
"statusCode": 200,
"message": "Environment variables updated successfully",
"data": {
"environment_vars": {
"DATABASE_URL": "postgres://app:secret@db.internal:5432/app_production",
"NODE_ENV": "production",
"REDIS_HOST": "cache.internal"
},
"synced": true
}
}

The data.synced field reports whether changes were propagated to the container. It is false if no changes were detected or if the sync failed.

Error CodeTitleDescriptionResolution
VALIDATION_ERRORInvalid input parametersOne or more request parameters failed validationCheck the error message for specific field requirements and correct your input
INVALID_ENV_KEYInvalid Environment Variable KeyThe 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_PREFIXReserved Environment Variable PrefixEnvironment 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_TOKENAuthentication token missingNo authentication token was provided in the requestInclude a valid JWT token in the Authorization header as Bearer <token>
RESOURCE_ACCESS_DENIEDResource access deniedYou do not have permission to access this specific resourceEnsure you own this resource or have been granted access by the owner
CONTAINER_NOT_FOUNDContainer not foundThe 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.
Terminal window
curl -X PUT https://api.hoody.com/api/v1/containers/5f9b3c2e1a8d4f7b6c5e2d3a/env \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"DATABASE_URL": "postgres://app:secret@db.internal:5432/app_production",
"NODE_ENV": "production",
"REDIS_HOST": "cache.internal"
}'

Set or update a single environment variable on the container. Keys starting with HOODY_ are reserved and will be rejected.

NameInTypeRequiredDescription
idpathstringYesContainer ID
keypathstringYesEnvironment variable key
FieldTypeRequiredDescription
valuestringYesValue for the environment variable. Max 32,768 characters.
{
"statusCode": 200,
"message": "Environment variable set successfully",
"data": {
"environment_vars": {
"DATABASE_URL": "postgres://app:secret@db.internal:5432/app_production",
"NODE_ENV": "production",
"REDIS_HOST": "cache.internal"
},
"synced": true
}
}
Error CodeTitleDescriptionResolution
VALIDATION_ERRORInvalid input parametersOne or more request parameters failed validationCheck the error message for specific field requirements and correct your input
INVALID_ENV_KEYInvalid Environment Variable KeyThe 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_PREFIXReserved Environment Variable PrefixEnvironment 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_TOKENAuthentication token missingNo authentication token was provided in the requestInclude a valid JWT token in the Authorization header as Bearer <token>
RESOURCE_ACCESS_DENIEDResource access deniedYou do not have permission to access this specific resourceEnsure you own this resource or have been granted access by the owner
CONTAINER_NOT_FOUNDContainer not foundThe 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.
Terminal window
curl -X PUT https://api.hoody.com/api/v1/containers/5f9b3c2e1a8d4f7b6c5e2d3a/env/DATABASE_URL \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"value": "postgres://app:secret@db.internal:5432/app_production"
}'

Remove a single environment variable from the container. The operation is idempotent and returns 200 whether the key existed or not. Keys starting with HOODY_ are reserved and cannot be deleted.

NameInTypeRequiredDescription
idpathstringYesContainer ID
keypathstringYesEnvironment variable key
{
"statusCode": 200,
"message": "Environment variable deleted successfully",
"data": {
"environment_vars": {
"NODE_ENV": "production",
"REDIS_HOST": "cache.internal"
},
"synced": true
}
}
Error CodeTitleDescriptionResolution
RESERVED_ENV_PREFIXReserved Environment Variable PrefixEnvironment 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_TOKENAuthentication token missingNo authentication token was provided in the requestInclude a valid JWT token in the Authorization header as Bearer <token>
RESOURCE_ACCESS_DENIEDResource access deniedYou do not have permission to access this specific resourceEnsure you own this resource or have been granted access by the owner
CONTAINER_NOT_FOUNDContainer not foundThe 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.
Terminal window
curl -X DELETE https://api.hoody.com/api/v1/containers/5f9b3c2e1a8d4f7b6c5e2d3a/env/DATABASE_URL \
-H "Authorization: Bearer <token>"