Skip to content

Replace the .env file for an app

PUT
/apps/{slug}/env
curl --request PUT \
--url https://your-server.example/api/apps/example/env \
--header 'Content-Type: application/json' \
--cookie session=<session> \
--data '[ { "key": "example", "value": "example" } ]'

Replaces the whole file. Not available to viewers. Never send masked entries back: their empty value would overwrite the secret.

The compose file is checked with the new values like a compose edit: 400 when the values make it fail the security checks or stop it loading; 409 when it already fails the checks with the current .env (fix and redeploy it first) or a value moves an endpoint onto a domain another app or the dashboard uses.

slug
required
string

App slug (lowercase, dash-separated).

Media typeapplication/json
Array<object>
object
key
required
string
value
required
string

Example generated

[
{
"key": "example",
"value": "example"
}
]

Env saved (does not redeploy).

Media typeapplication/json
object
status
string

Example

{
"status": "ok"
}

Invalid request, or the compose file fails security checks (JSON body with every reason).

object
error
string
violations
Array<string>

Example

{
"error": "compose file contains disallowed directives",
"violations": [
"service \"web\": privileged mode not allowed"
]
}

The change cannot be applied: a domain belongs to another app or the dashboard (text body), or the app’s current compose file fails security checks (JSON body with every reason; fix and redeploy it first).

object
error
string
violations
Array<string>

Example

{
"error": "compose file contains disallowed directives",
"violations": [
"service \"web\": privileged mode not allowed"
]
}