Skip to main content

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)
1 min read
post/v2/environments.updateSettings
Request example
Response
post/v2/environments.updateSettings

Authorization

Authorizationstringheaderrequired#

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

application/json
projectstringrequired#

Identifies a resource by either its unique ID or its slug.
Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.

Length: 3–255Pattern: ^[a-zA-Z0-9_-]+$

appstringrequired#

Identifies a resource by either its unique ID or its slug.
Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.

Length: 3–255Pattern: ^[a-zA-Z0-9_-]+$

environmentstringrequired#

Identifies a resource by either its unique ID or its slug.
Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.

Length: 3–255Pattern: ^[a-zA-Z0-9_-]+$

dockerfilestring#

Path to the Dockerfile used for builds.
Omit to leave unchanged; set null to clear and fall back to Railpack.

Length: 1–500

rootDirectorystring#

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.

Length: 1–500

buildCommandstring#

Overrides the build command auto-detected by Railpack.
Omit to leave unchanged; set null to clear and fall back to auto-detection.

Length: 1–1000

watchPathsstring[]#

Glob paths that trigger auto-deploys when changed.
Omit to leave unchanged.

Items: max 10

autoDeployboolean#

Whether pushes auto-deploy.
Omit to leave unchanged.

portinteger#

Container port the app listens on.
Omit to leave unchanged.

Range: 1–65535

vCpusnumber#

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.

Range: >= 0.25Multiple of: 0.25

memoryMibinteger#

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.

Range: >= 256Multiple of: 256

storageMibinteger#

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.

Range: >= 0Multiple of: 512

commandstring[]#

Override container entrypoint command.
Omit to leave unchanged.

Items: max 10

healthcheckobject · null#

HTTP healthcheck configuration.
Omit to leave unchanged; set null to remove.

Show child attributes
shutdownSignalenum<string>#
Signal sent to the container on shutdown.
Options:SIGTERMSIGINTSIGQUITSIGKILL
upstreamProtocolenum<string>#
Protocol used to reach the container.
Options:http1h2c
openapiSpecPathstring#

Path to the OpenAPI spec file within the build. Must start with a slash.
Omit to leave unchanged; set null to clear.

Length: 1–512Pattern: ^(/[\w\-]+)+(\.[\w]+)?$

regionsobject[]#

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.

Items: 1–5

Show child attributes
namestringrequired#
Region name, such as us-east-1.

Length: 1–64

replicasobjectrequired#
Min and max replica bounds for autoscaling in a region.
Show child attributes
minintegerrequired#
Minimum number of replicas.
maxintegerrequired#
Maximum number of replicas.

Responses

application/json
Successfully updated the environment settings.
metaobjectrequired#
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.
Show child attributes
requestIdstringrequired#
A unique id for this request. Always include this ID when contacting support about a specific API request. This identifier allows Unkey's support team to trace the exact request through logs and diagnostic systems to provide faster assistance.
dataobjectrequired#
Empty response object by design. A successful response indicates this operation was successfully executed.