Update environment settings
Update the build, runtime, and regional settings for an environment.
All settings fields are optional. Omit a field to leave it unchanged. For
nullable fields (dockerfile, healthcheck, openapiSpecPath), send null
to clear the value. When regions is present it replaces the full set of
regions for the environment.
Required Permissions
Your root key must have one of the following permissions:
environment.*.update_environment(to update any environment)environment.<environment_id>.update_environment(to update a specific environment)
Authorizations
Unkey uses bearer tokens for authentication. Public integrations use root keys, while the dashboard proxy uses short-lived JWTs. To authenticate, include the token in the Authorization header of each request:
Root keys have specific permissions attached to them, controlling what operations they can perform. Legacy permissions use tuple strings like api.*.create_key; resource permissions use Unkey Resource Names plus actions, like unkey:v1:ws_123:keyspaces/*#create_key.
Security best practices:
- Keep root keys secure and never expose them in client-side code
- Use different root keys for different environments
- Rotate keys periodically, especially after team member departures
- Create keys with minimal necessary permissions following least privilege principle
- Monitor key usage with audit logs.
Body
Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
3 - 255^[a-zA-Z0-9_-]+$"proj_1234abcd"
Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
3 - 255^[a-zA-Z0-9_-]+$"proj_1234abcd"
Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
3 - 255^[a-zA-Z0-9_-]+$"proj_1234abcd"
Path to the Dockerfile used for builds. Omit to leave unchanged; set null to clear and fall back to Railpack.
1 - 500"./Dockerfile"
The directory your app lives in. Unkey builds from here. Use "." for the repository root, or set a subdirectory when your app is nested (e.g., services/api). Omit to leave unchanged.
1 - 500"."
Overrides the build command auto-detected by Railpack. Omit to leave unchanged; set null to clear and fall back to auto-detection.
1 - 1000"pnpm --filter api build"
Glob paths that trigger auto-deploys when changed. Omit to leave unchanged.
10500Whether pushes auto-deploy. Omit to leave unchanged.
true
Container port the app listens on. Omit to leave unchanged.
1 <= x <= 655358080
CPU allocation in vCPUs. Minimum 0.25 (1/4 vCPU), in steps of 0.25. The upper bound is your workspace's per-instance quota; exceeding it returns 400. Omit to leave unchanged.
x >= 0.25Must be a multiple of 0.251
Memory allocation in MiB. Minimum 256, in steps of 256. The upper bound is your workspace's per-instance quota; exceeding it returns 400. Omit to leave unchanged.
x >= 256Must be a multiple of 256512
Ephemeral storage allocation in MiB, in steps of 512 (0 for none). The upper bound is your workspace's per-instance quota; exceeding it returns 400. Omit to leave unchanged.
x >= 0Must be a multiple of 5121024
Override container entrypoint command. Omit to leave unchanged.
104096HTTP healthcheck configuration. Omit to leave unchanged; set null to remove.
Signal sent to the container on shutdown. Omit to leave unchanged.
SIGTERM, SIGINT, SIGQUIT, SIGKILL "SIGTERM"
Protocol used to reach the upstream container. Omit to leave unchanged.
http1, h2c "http1"
Path to the OpenAPI spec file within the build. Must start with a slash. Omit to leave unchanged; set null to clear.
1 - 512^(/[\w\-]+)+(\.[\w]+)?$"/openapi.yaml"
Desired set of regions with per-region replica bounds. Omit to leave regions unchanged; when present, this replaces the full set (regions absent from the list are removed). At least one region is required; an empty list is rejected because an environment cannot have zero regions.
1 - 5 elementsResponse
Successfully updated the environment settings.
Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The requestId is particularly important when troubleshooting issues with the Unkey support team.
Empty response object by design. A successful response indicates this operation was successfully executed.