Reference
Operator routes
Manage environments, variables, API keys and private workers. These routes need the operator token, which apps should never hold.
On this page
- List environments
- Get an environment
- Make a deployment current in an environment
- Archive a preview
- Unarchive a preview
- List an environment's variable names
- Set a variable
- Delete a variable
- List environment API keys
- Create an environment API key
- Revoke an environment API key
- List remote workers
- Register a remote worker
- Revoke a worker token
- Release a revoked worker's reservations
- Drain a worker
- Release a quarantined embedded attempt
The CLI wraps each route: durable-compute environments, variables, api-keys and workers. See Environments, API keys and variables and Private workers.
Deployments are not on this page: deploy registers them by writing to the database directly, and there is no HTTP route for it yet.
List environments#
GET/v1/environments
Auth: Operator token or personalToken
dev, staging and prod, then previews by branch, each with its last run and counts. A person sees their projects' environments only.
Parameters
| Field | Description |
|---|---|
projectstring in query | A project's ref: only its environments. One the caller does not reach is a 404. |
Responses
- 200OK
EnvironmentSummary[] - 401Missing or wrong bearer token.
Error - 403The credential is valid but may not read this resource.
Error - 404The resource does not exist.
Error
Get an environment#
GET/v1/environments/{slug}
Auth: Operator token or personalToken
Parameters
| Field | Description |
|---|---|
slugstring in path required | Environment slug. A preview's slash is sent percent-encoded: preview%2Fmy-branch. |
Responses
- 200OK
Environment - 401Missing or wrong bearer token.
Error - 403The credential is valid but may not read this resource.
Error - 404The resource does not exist.
Error
Fields of Environment
| Field | Description |
|---|---|
idstring (uuid) required | |
slugstring required | Environment slug: dev, staging, prod or preview/<branch>, after the project's ref and a colon for every project but the first (proj_...:prod). |
kindEnvironmentKind required | |
branchstring | null required | The git branch of a preview. |
deployment_idstring | null required | The current deployment: where runs that name no deployment run. |
created_atstring (date-time) required | |
updated_atstring (date-time) required | |
archived_atstring | null required | Set on an archived preview, which refuses new runs and deploys and keeps its history. |
project_idstring (uuid) required | The project it belongs to. |
Make a deployment current in an environment#
POST/v1/environments/{slug}/promote
Auth: Operator token or personalToken
Runs that name no deployment use it from now on. The same deployment may be current in several environments. An unregistered deployment or unknown environment is a 404; an archived preview is a 409.
Parameters
| Field | Description |
|---|---|
slugstring in path required | Environment slug. A preview's slash is sent percent-encoded: preview%2Fmy-branch. |
Request body PromoteRequest
| Field | Description |
|---|---|
deployment_idstring required | A registered deployment. |
Responses
- 200OK
Environment - 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead.
Error - 401Missing or wrong bearer token.
Error - 403The credential is valid but may not read this resource.
Error - 404The resource does not exist.
Error - 409The request conflicts with current state, or is fenced by a newer attempt epoch, lease or owner.
Error - 422The JSON body did not match the request schema
string
Fields of Environment
| Field | Description |
|---|---|
idstring (uuid) required | |
slugstring required | Environment slug: dev, staging, prod or preview/<branch>, after the project's ref and a colon for every project but the first (proj_...:prod). |
kindEnvironmentKind required | |
branchstring | null required | The git branch of a preview. |
deployment_idstring | null required | The current deployment: where runs that name no deployment run. |
created_atstring (date-time) required | |
updated_atstring (date-time) required | |
archived_atstring | null required | Set on an archived preview, which refuses new runs and deploys and keeps its history. |
project_idstring (uuid) required | The project it belongs to. |
Archive a preview#
POST/v1/environments/{slug}/archive
Auth: Operator token or personalToken
An archived preview refuses new runs and deploys and keeps its history; unarchive restores it. Idempotent. Archiving dev, staging or prod is a 409.
Parameters
| Field | Description |
|---|---|
slugstring in path required | Environment slug. A preview's slash is sent percent-encoded: preview%2Fmy-branch. |
Responses
- 200OK
Environment - 401Missing or wrong bearer token.
Error - 403The credential is valid but may not read this resource.
Error - 404The resource does not exist.
Error - 409The request conflicts with current state, or is fenced by a newer attempt epoch, lease or owner.
Error
Fields of Environment
| Field | Description |
|---|---|
idstring (uuid) required | |
slugstring required | Environment slug: dev, staging, prod or preview/<branch>, after the project's ref and a colon for every project but the first (proj_...:prod). |
kindEnvironmentKind required | |
branchstring | null required | The git branch of a preview. |
deployment_idstring | null required | The current deployment: where runs that name no deployment run. |
created_atstring (date-time) required | |
updated_atstring (date-time) required | |
archived_atstring | null required | Set on an archived preview, which refuses new runs and deploys and keeps its history. |
project_idstring (uuid) required | The project it belongs to. |
Unarchive a preview#
POST/v1/environments/{slug}/unarchive
Auth: Operator token or personalToken
Restores an archived preview: it accepts runs and deploys again. Idempotent: an environment that is not archived (dev, staging and prod never are) is returned unchanged. While a preview was archived, staging writes no longer counted it, so the variables its new runs would receive (its own and staging's) may now exceed 256 KiB; then this is a 400 and the preview stays archived.
Parameters
| Field | Description |
|---|---|
slugstring in path required | Environment slug. A preview's slash is sent percent-encoded: preview%2Fmy-branch. |
Responses
- 200OK
Environment - 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead.
Error - 401Missing or wrong bearer token.
Error - 403The credential is valid but may not read this resource.
Error - 404The resource does not exist.
Error
Fields of Environment
| Field | Description |
|---|---|
idstring (uuid) required | |
slugstring required | Environment slug: dev, staging, prod or preview/<branch>, after the project's ref and a colon for every project but the first (proj_...:prod). |
kindEnvironmentKind required | |
branchstring | null required | The git branch of a preview. |
deployment_idstring | null required | The current deployment: where runs that name no deployment run. |
created_atstring (date-time) required | |
updated_atstring (date-time) required | |
archived_atstring | null required | Set on an archived preview, which refuses new runs and deploys and keeps its history. |
project_idstring (uuid) required | The project it belongs to. |
List an environment's variable names#
GET/v1/environments/{slug}/variables
Auth: Operator token or personalToken
Names and when each was set, never values. A preview also lists staging's variables it does not override.
Parameters
| Field | Description |
|---|---|
slugstring in path required | Environment slug. A preview's slash is sent percent-encoded: preview%2Fmy-branch. |
Responses
- 200OK
VariablesView - 401Missing or wrong bearer token.
Error - 403The credential is valid but may not read this resource.
Error - 404The resource does not exist.
Error
Fields of VariablesView
| Field | Description |
|---|---|
environmentstring required | Environment slug: dev, staging, prod or preview/<branch>. |
variablesVariableInfo[] required | By name. |
writableboolean required | Whether this control plane has a secrets key, so it can store values. It says nothing about values already stored: see each variable's readable. |
Set a variable#
PUT/v1/environments/{slug}/variables/{name}
Auth: Operator token or personalToken
Seals the value with XChaCha20-Poly1305 under the control plane's secrets key. New runs see it; runs already accepted keep the value they snapshotted. A malformed body is a 400 whose message never quotes it.
Parameters
| Field | Description |
|---|---|
slugstring in path required | Environment slug. A preview's slash is sent percent-encoded: preview%2Fmy-branch. |
namestring in path required | Variable name: [A-Za-z_][A-Za-z0-9_]*, at most 128 bytes. PATH, HOME, NODE_OPTIONS, PYTHONPATH, PYTHONHOME and names starting DC_, LD_ or DYLD_ are reserved. |
Request body SetVariableRequest
| Field | Description |
|---|---|
valuestring required | Up to 16 KiB of UTF-8 without NUL bytes. Sealed at rest; never returned or logged. Refused (400) when it would make the variables new runs of the environment receive (its own, plus staging's for a preview, and for staging those of every active preview) exceed 256 KiB encoded as JSON. |
Responses
- 200OK
VariableInfo - 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead.
Error - 401Missing or wrong bearer token.
Error - 403The credential is valid but may not read this resource.
Error - 404The resource does not exist.
Error - 503This control plane has no secrets key (DC_SECRETS_KEY or --secrets-key-file), so it cannot store a variable.
Error
Fields of VariableInfo
| Field | Description |
|---|---|
namestring required | |
updated_atstring (date-time) required | |
inherited_fromstring | null required | staging, when a preview inherits the variable rather than defining it. |
readableboolean required | Whether this control plane's secrets key opens the value. False when it was sealed under another key, or the control plane has none: runs that need it are deferred and fail after the deferral window unless a server with that key starts them. Setting it again seals it under this key. |
Delete a variable#
DELETE/v1/environments/{slug}/variables/{name}
Auth: Operator token or personalToken
New runs no longer see it; a preview falls back to staging's value if staging defines one. Needs no secrets key. A name this environment does not define is a 404. In a preview, a deletion that would uncover a staging value too large for the 256 KiB limit is refused with 400.
Parameters
| Field | Description |
|---|---|
slugstring in path required | Environment slug. A preview's slash is sent percent-encoded: preview%2Fmy-branch. |
namestring in path required | Variable name: [A-Za-z_][A-Za-z0-9_]*, at most 128 bytes. PATH, HOME, NODE_OPTIONS, PYTHONPATH, PYTHONHOME and names starting DC_, LD_ or DYLD_ are reserved. |
Responses
- 200OK
VariableDeleted - 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead.
Error - 401Missing or wrong bearer token.
Error - 403The credential is valid but may not read this resource.
Error - 404The resource does not exist.
Error
Fields of VariableDeleted
| Field | Description |
|---|---|
deletedboolean required | |
namestring required |
List environment API keys#
GET/v1/api-keys
Auth: Operator token or personalToken
Never tokens or their hashes.
Parameters
| Field | Description |
|---|---|
environmentstring in query | Only this environment's keys. An unknown environment is a 404. |
Responses
- 200OK
ApiKeyRecord[] - 401Missing or wrong bearer token.
Error - 403The credential is valid but may not read this resource.
Error - 404The resource does not exist.
Error
Create an environment API key#
POST/v1/api-keys
Auth: Operator token or personalToken
The response carries the token once; only its SHA-256 hash is kept. The key may list tasks and submit, list, read, cancel and signal runs in its environment only.
Request body CreateApiKeyRequest
| Field | Description |
|---|---|
environmentstring required | Environment slug: dev, staging, prod or preview/<branch>. |
namestring required | 1..64 characters, to tell keys apart. |
Responses
- 201Created. The token is never shown again.
CreatedApiKey - 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead.
Error - 401Missing or wrong bearer token.
Error - 403The credential is valid but may not read this resource.
Error - 404The resource does not exist.
Error - 422The JSON body did not match the request schema
string
Fields of CreatedApiKey
| Field | Description |
|---|---|
keyApiKeyRecord required | An environment API key as listed. Never contains the token or its hash. |
tokenstring required | The bearer token, returned only here. Only its SHA-256 hash is stored. |
Revoke an environment API key#
POST/v1/api-keys/{id}/revoke
Auth: Operator token or personalToken
Requests with it are refused from now on; runs it submitted keep running. Idempotent.
Parameters
| Field | Description |
|---|---|
idstring (uuid) in path required | API key ID. |
Responses
- 200OK
ApiKeyRecord - 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead.
Error - 401Missing or wrong bearer token.
Error - 403The credential is valid but may not read this resource.
Error - 404The resource does not exist.
Error
Fields of ApiKeyRecord
| Field | Description |
|---|---|
idstring (uuid) required | |
environmentstring required | Environment slug: dev, staging, prod or preview/<branch>. |
namestring required | |
prefixstring required | The token's public start, for example bjk_prod_1a2b3c4d. |
created_atstring (date-time) required | |
last_used_atstring | null required | Updated at most every 10 seconds. |
revoked_atstring | null required |
List remote workers#
GET/v1/workers
Auth: Operator token
Responses
- 200OK
WorkerRecord[] - 401Missing or wrong bearer token.
Error - 403The credential is valid but may not read this resource.
Error
Register a remote worker#
POST/v1/workers
Auth: Operator token
Request body WorkerRegistration
| Field | Description |
|---|---|
namestring required | 1..64 characters of [A-Za-z0-9._-]. |
poolPoolKind required | |
executorWorkerExecutor required | |
slotsinteger required | |
cpu_millisinteger required | |
memory_mibinteger required | |
deployment_idstring | null | Scope: 1..256 bytes. Give both deployment_id and runtime, or neither. An in-image worker must be scoped and serve the cloud pool. |
runtimeRuntime | null | Scope runtime; required with deployment_id. |
environmentsstring[] | Environment scope, at most 16 existing slugs: the worker claims only runs of these environments, so a prod worker never runs preview code. Default: every environment. |
Responses
- 201Created. The token is returned only here.
RegisteredWorker - 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead.
Error - 401Missing or wrong bearer token.
Error - 403The credential is valid but may not read this resource.
Error - 409The request conflicts with current state, or is fenced by a newer attempt epoch, lease or owner.
Error - 422The JSON body did not match the request schema
string
Fields of RegisteredWorker
| Field | Description |
|---|---|
workerWorkerRecord required | Operator view of a worker. Never contains the token or its hash. |
tokenstring required | The worker token, returned exactly once. Only its SHA-256 hash is stored. |
Revoke a worker token#
POST/v1/workers/{id}/revoke
Auth: Operator token
The worker's reservations stay held until released.
Parameters
| Field | Description |
|---|---|
idstring (uuid) in path required | Worker ID. |
Request body RevokeRequest
| Field | Description |
|---|---|
reasonstring required | 1..1024 bytes without NUL. |
Responses
- 200OK
WorkerRecord - 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead.
Error - 401Missing or wrong bearer token.
Error - 403The credential is valid but may not read this resource.
Error - 404The resource does not exist.
Error - 422The JSON body did not match the request schema
string
Fields of WorkerRecord
| Field | Description |
|---|---|
idstring (uuid) required | |
namestring required | |
poolPoolKind required | |
executorWorkerExecutor required | |
capacityPoolCapacity required | |
created_atstring (date-time) required | |
last_seen_atstring | null required | |
liveboolean required | |
revoked_atstring | null required | |
revoke_reasonstring | null required | |
inventoryInventoryEntry[] required | |
reservedPoolCapacity required | Summed reservations of the attempts holding this worker's capacity. |
reserved_attemptsstring (uuid)[] required | |
deployment_idstring | null required | Scope deployment, when scoped. |
runtimeRuntime | null required | Scope runtime, when scoped. |
draining_atstring | null required | |
environmentsstring[] required | Environment scope: the worker claims only runs of these environments. Empty means every environment. |
hot_taskstring | The hot task this warm worker is kept for. Absent for every other worker. |
Release a revoked worker's reservations#
POST/v1/workers/{id}/release
Auth: Operator token
Only for a revoked worker, and only with confirm_terminated after confirming termination out of band.
Parameters
| Field | Description |
|---|---|
idstring (uuid) in path required | Worker ID. |
Request body ReleaseRequest
| Field | Description |
|---|---|
confirm_terminatedboolean | Assert that every reserved execution of this revoked worker (or, for an attempt release, this attempt's execution) has terminated. Without it nothing is released. |
reasonstring required | 1..2048 bytes without NUL. |
released_bystring | Who is releasing, recorded with each release: the console sends the signed-in super admin's email, the CLI `--released-by`, `DC_OPERATOR` or the account's user name. 1..320 bytes without control characters. Optional. |
Responses
- 200OK
ReleaseResponse - 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead.
Error - 401Missing or wrong bearer token.
Error - 403The credential is valid but may not read this resource.
Error - 404The resource does not exist.
Error - 409The request conflicts with current state, or is fenced by a newer attempt epoch, lease or owner.
Error - 422The JSON body did not match the request schema
string
Fields of ReleaseResponse
| Field | Description |
|---|---|
worker_idstring (uuid) required | |
released_attemptsstring (uuid)[] required |
Drain a worker#
POST/v1/workers/{id}/drain
Auth: Operator token
No request body is read. From now on the worker's claims return nothing; its agent finishes what it holds and exits. One way.
Parameters
| Field | Description |
|---|---|
idstring (uuid) in path required | Worker ID. |
Responses
- 200OK
WorkerRecord - 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead.
Error - 401Missing or wrong bearer token.
Error - 403The credential is valid but may not read this resource.
Error - 404The resource does not exist.
Error
Fields of WorkerRecord
| Field | Description |
|---|---|
idstring (uuid) required | |
namestring required | |
poolPoolKind required | |
executorWorkerExecutor required | |
capacityPoolCapacity required | |
created_atstring (date-time) required | |
last_seen_atstring | null required | |
liveboolean required | |
revoked_atstring | null required | |
revoke_reasonstring | null required | |
inventoryInventoryEntry[] required | |
reservedPoolCapacity required | Summed reservations of the attempts holding this worker's capacity. |
reserved_attemptsstring (uuid)[] required | |
deployment_idstring | null required | Scope deployment, when scoped. |
runtimeRuntime | null required | Scope runtime, when scoped. |
draining_atstring | null required | |
environmentsstring[] required | Environment scope: the worker claims only runs of these environments. Empty means every environment. |
hot_taskstring | The hot task this warm worker is kept for. Absent for every other worker. |
Release a quarantined embedded attempt#
POST/v1/attempts/{id}/release
Auth: Operator token
For an attempt no worker owns that stays quarantined because nothing can prove it stopped (native execution after a crash, or a container on a Docker daemon no control plane reaches any more), and only with confirm_terminated after confirming termination out of band. Until then it keeps its capacity and its queue slot. The release is audited with the worker releases, the lost duration stays unresolved and uncharged, and the run retries under its normal budget. 409 for a worker's attempt (release it with its worker) or an attempt not in quarantine.
Parameters
| Field | Description |
|---|---|
idstring (uuid) in path required | Attempt ID. |
Request body ReleaseRequest
| Field | Description |
|---|---|
confirm_terminatedboolean | Assert that every reserved execution of this revoked worker (or, for an attempt release, this attempt's execution) has terminated. Without it nothing is released. |
reasonstring required | 1..2048 bytes without NUL. |
released_bystring | Who is releasing, recorded with each release: the console sends the signed-in super admin's email, the CLI `--released-by`, `DC_OPERATOR` or the account's user name. 1..320 bytes without control characters. Optional. |
Responses
- 200OK
AttemptRelease - 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead.
Error - 401Missing or wrong bearer token.
Error - 403The credential is valid but may not read this resource.
Error - 404The resource does not exist.
Error - 409The request conflicts with current state, or is fenced by a newer attempt epoch, lease or owner.
Error - 422The JSON body did not match the request schema
string
Fields of AttemptRelease
| Field | Description |
|---|---|
attempt_idstring (uuid) required | |
run_idstring (uuid) required | The attempt's run, retried under its normal budget (a cancelled run stays cancelled). |