Skip to content
Hoody.com

The Container Environment Variables API manages process environment variables on a running container. Use it to list every variable on a container, merge in new variables or update existing ones (in bulk or one at a time), and delete individual variables.

Variables you write through these endpoints are persisted to /etc/environment inside the container, where they are picked up by PAM/SSH on the next login, and they are also applied to the container runtime environment, where they appear in any new exec or console session. Processes that are already running do not pick up the change until they re-exec.

Every response on this page returns the container’s whole map in environment_vars, along with a values_redacted flag that says whether the values were shown to you.

Callerenvironment_varsvalues_redacted
Logged-in session (JWT)Every key with its valuefalse
Auth Token with containers.features.env_valuesEvery key with its valuefalse
Auth Token without containers.features.env_valuesEvery key, each with the value nulltrue

A redacted response is still a 200, and the set and delete operations still apply the change; only the returned map hides the values. The permission decides what comes back, not what a token may do: listing needs containers.read and changing a variable needs containers.update, with or without it. A container with no variables returns {}.

The full_access and dev_team templates grant containers.features.env_values; read_only, external_customer and finance_team do not. A token built from an explicit permission tree has it only when the tree sets it to true. Tokens that existed before this permission was introduced were granted it wherever they held containers.read or containers.update, so they still see values. The tokens the Hoody Agent creates for itself also hold it, so the agent reads values in your containers.

A redacted list response looks like this:

{
"statusCode": 200,
"message": "Environment variables retrieved",
"data": {
"environment_vars": {
"DATABASE_URL": null,
"LOG_LEVEL": null
},
"values_redacted": true,
"env_sync": {
"pending": false,
"revision": 42,
"applied_revision": 42,
"verified_at": "2026-02-15T10:42:13.000Z",
"attempted_at": "2026-02-15T10:42:13.000Z",
"last_error": null,
"exhausted": false
}
}
}

GET /api/v1/containers/{id}/env

Return every environment variable on the container together with the host-side reconciliation state. The env_sync block reports whether a recent change is still pending on the host, which revision is currently applied, and when the host last verified it.

NameInTypeRequiredDescription
idpathstringYesContainer ID.

This endpoint does not accept a request body.

Terminal window
curl -X GET "https://api.hoody.com/api/v1/containers/67e89abc123def456789abcd/env" \
-H "Authorization: Bearer $HOODY_TOKEN"
{
"statusCode": 200,
"message": "Environment variables retrieved",
"data": {
"environment_vars": {
"DATABASE_URL": "postgres://app:secret@db.internal:5432/app",
"LOG_LEVEL": "info",
"FEATURE_FLAGS": "billing_v2,checkout_v3"
},
"values_redacted": false,
"env_sync": {
"pending": false,
"revision": 42,
"applied_revision": 42,
"verified_at": "2026-02-15T10:42:13.000Z",
"attempted_at": "2026-02-15T10:42:13.000Z",
"last_error": null,
"exhausted": false
}
}
}
Error CodeTitleDescriptionResolution
MISSING_TOKENAuthentication token missingNo authentication token was provided in the request.Include a valid JWT token in the Authorization header as Bearer <token>.
RESOURCE_ACCESS_DENIEDResource access deniedYou do not have permission to access this specific resource.Ensure 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.

PUT /api/v1/containers/{id}/env

Merge multiple environment variables into the container in one call. Existing keys are updated, new keys are added, and keys not present in the request body are left unchanged (merge semantics).

The body is a flat JSON object where each property is an environment variable name and its value is a string between 1 and 4,096 characters. Key names must match ^[a-zA-Z_][a-zA-Z0-9_]*$, are at most 128 characters long, and may not start with the reserved HOODY_ prefix. A single request must contain between 1 and 256 properties.

NameInTypeRequiredDescription
idpathstringYesContainer ID.

A flat object of environment variable names to values. Between 1 and 256 entries; each value is a string of 1 to 4,096 characters.

{
"DATABASE_URL": "postgres://app:secret@db.internal:5432/app",
"LOG_LEVEL": "info",
"FEATURE_FLAGS": "billing_v2,checkout_v3"
}
Terminal window
curl -X PUT "https://api.hoody.com/api/v1/containers/67e89abc123def456789abcd/env" \
-H "Authorization: Bearer $HOODY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"DATABASE_URL": "postgres://app:secret@db.internal:5432/app",
"LOG_LEVEL": "info",
"FEATURE_FLAGS": "billing_v2,checkout_v3"
}'
{
"statusCode": 200,
"message": "Environment variables updated",
"data": {
"environment_vars": {
"DATABASE_URL": "postgres://app:secret@db.internal:5432/app",
"LOG_LEVEL": "info",
"FEATURE_FLAGS": "billing_v2,checkout_v3",
"LEGACY_FLAG": "off"
},
"values_redacted": false,
"synced": true,
"env_sync": {
"pending": false,
"revision": 43,
"applied_revision": 43,
"verified_at": "2026-02-15T11:00:00.000Z",
"attempted_at": "2026-02-15T11:00:00.000Z",
"last_error": null,
"exhausted": false
}
}
}
Error CodeTitleDescriptionResolution
VALIDATION_ERRORInvalid input parametersOne or more request parameters failed validation.Check 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 request.Include a valid JWT token in the Authorization header as Bearer <token>.
RESOURCE_ACCESS_DENIEDResource access deniedYou do not have permission to access this specific resource.Ensure 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.

PUT /api/v1/containers/{id}/env/{key}

Set or update one environment variable, identified by key in the path. Use this when you only need to touch a single variable and do not want to merge into the whole map.

The value field is required and must be a string between 1 and 4,096 characters. The key must match ^[a-zA-Z_][a-zA-Z0-9_]*$, must be at most 128 characters long, and may not start with the reserved HOODY_ prefix.

NameInTypeRequiredDescription
idpathstringYesContainer ID.
keypathstringYesEnvironment variable key.
FieldTypeRequiredDescription
valuestringYesValue for the environment variable. Must be 1 to 4,096 characters.
{
"value": "postgres://app:secret@db.internal:5432/app"
}
Terminal window
curl -X PUT "https://api.hoody.com/api/v1/containers/67e89abc123def456789abcd/env/DATABASE_URL" \
-H "Authorization: Bearer $HOODY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"value":"postgres://app:secret@db.internal:5432/app"}'
{
"statusCode": 200,
"message": "Environment variable updated",
"data": {
"environment_vars": {
"DATABASE_URL": "postgres://app:secret@db.internal:5432/app",
"LOG_LEVEL": "info"
},
"values_redacted": false,
"synced": true,
"env_sync": {
"pending": false,
"revision": 44,
"applied_revision": 44,
"verified_at": "2026-02-15T11:15:00.000Z",
"attempted_at": "2026-02-15T11:15:00.000Z",
"last_error": null,
"exhausted": false
}
}
}
Error CodeTitleDescriptionResolution
VALIDATION_ERRORInvalid input parametersOne or more request parameters failed validation.Check 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 request.Include a valid JWT token in the Authorization header as Bearer <token>.
RESOURCE_ACCESS_DENIEDResource access deniedYou do not have permission to access this specific resource.Ensure 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.

DELETE /api/v1/containers/{id}/env/{key}

Remove a single environment variable from the container. The call is idempotent and returns 200 whether or not the key was present. Reserved keys (those starting with HOODY_) are rejected.

The variable is removed from /etc/environment and from the container runtime environment. Already-running processes keep their copy of the variable until they re-exec.

NameInTypeRequiredDescription
idpathstringYesContainer ID.
keypathstringYesEnvironment variable key.

This endpoint does not accept a request body.

Terminal window
curl -X DELETE "https://api.hoody.com/api/v1/containers/67e89abc123def456789abcd/env/LEGACY_FLAG" \
-H "Authorization: Bearer $HOODY_TOKEN"
{
"statusCode": 200,
"message": "Environment variable deleted",
"data": {
"environment_vars": {
"DATABASE_URL": "postgres://app:secret@db.internal:5432/app",
"LOG_LEVEL": "info"
},
"values_redacted": false,
"synced": true,
"env_sync": {
"pending": false,
"revision": 45,
"applied_revision": 45,
"verified_at": "2026-02-15T11:30:00.000Z",
"attempted_at": "2026-02-15T11:30:00.000Z",
"last_error": null,
"exhausted": false
}
}
}
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 request.Include a valid JWT token in the Authorization header as Bearer <token>.
RESOURCE_ACCESS_DENIEDResource access deniedYou do not have permission to access this specific resource.Ensure 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.