Skip to main content
POST
Python (SDK)

Authorizations

Authorization
string
header
required

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
project
string
required

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

Required string length: 3 - 255
Pattern: ^[a-zA-Z0-9_-]+$
Example:

"proj_1234abcd"

app
string
required

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

Required string length: 3 - 255
Pattern: ^[a-zA-Z0-9_-]+$
Example:

"proj_1234abcd"

environment
string
required

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

Required string length: 3 - 255
Pattern: ^[a-zA-Z0-9_-]+$
Example:

"proj_1234abcd"

dockerfile
string | null

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

Required string length: 1 - 500
Example:

"./Dockerfile"

rootDirectory
string

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.

Required string length: 1 - 500
Example:

"."

buildCommand
string | null

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

Required string length: 1 - 1000
Example:

"pnpm --filter api build"

watchPaths
string[]

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

Maximum array length: 10
Maximum string length: 500
autoDeploy
boolean

Whether pushes auto-deploy. Omit to leave unchanged.

Example:

true

port
integer

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

Required range: 1 <= x <= 65535
Example:

8080

vCpus
number<double>

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.

Required range: x >= 0.25Must be a multiple of 0.25
Example:

1

memoryMib
integer

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.

Required range: x >= 256Must be a multiple of 256
Example:

512

storageMib
integer

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.

Required range: x >= 0Must be a multiple of 512
Example:

1024

command
string[]

Override container entrypoint command. Omit to leave unchanged.

Maximum array length: 10
Maximum string length: 4096
healthcheck
object | null

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

shutdownSignal
enum<string>

Signal sent to the container on shutdown. Omit to leave unchanged.

Available options:
SIGTERM,
SIGINT,
SIGQUIT,
SIGKILL
Example:

"SIGTERM"

upstreamProtocol
enum<string>

Protocol used to reach the upstream container. Omit to leave unchanged.

Available options:
http1,
h2c
Example:

"http1"

openapiSpecPath
string | null

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

Required string length: 1 - 512
Pattern: ^(/[\w\-]+)+(\.[\w]+)?$
Example:

"/openapi.yaml"

regions
object[]

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.

Required array length: 1 - 5 elements

Response

Successfully updated the environment settings.

meta
object
required

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.

data
object
required

Empty response object by design. A successful response indicates this operation was successfully executed.

Last modified on July 22, 2026