Remove an env key from a repository
DELETE /repositories/{id}/env/keys
Removes the key from the repository’s settings and deletes its value on every runner of the workspace that can hold it. A runner that is offline keeps serving the value to its tasks until it reconnects and applies the removal. The answer says which Moondeck Cloud tasks do not have the removal yet. Fails with ENV_KEY_MOVED if the key was added or removed since the token was issued.
Requires: projects.write, projects.env.configure, projects.env.values.write
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Resource ULID.
Header Parameters
Section titled “Header Parameters ”Org scope: me or an org slug. Absent means the caller’s active/personal org. It selects the workspace used for permission checks and for most resource filters; operation-specific access rules still apply.
Request Body required
Section titled “Request Body required ”object
An env var name: a letter or underscore, then letters, digits and underscores.
The key’s remove token, from GET …/env/keys.
Responses
Section titled “ Responses ”Successful response.
object
The key’s listing generation: 0 for a key never listed, then advanced by one at each add and each removal, so a key is listed exactly when it is odd.
Runners the removal deletes the value from: every runner of the workspace that can hold it.
Whether every Moondeck Cloud task of the repository has the removal yet.
object
Running Moondeck Cloud tasks that do not have the removal yet; delivery goes on.
object
Moondeck Cloud tasks that keep the value until their environment is recreated.
object
BAD_JSON — the body is not valid JSON, or INVALID_REQUEST — the decoded body does not match the route’s request schema.
object
object
Stable, machine-readable error code
Human-readable explanation
Present on 403 — the permission the caller lacked
Present on 402 — gated feature
Present on 402 — the plan’s cap
Present on 402 — the current plan
UNAUTHORIZED — missing or invalid token, or an org-scoped API key (only user-scoped keys are accepted).
object
object
Stable, machine-readable error code
Human-readable explanation
Present on 403 — the permission the caller lacked
Present on 402 — gated feature
Present on 402 — the plan’s cap
Present on 402 — the current plan
PLAN_LIMIT — the workspace’s plan does not include API access. Every API-key call can return this; session-token calls never do.
object
object
Stable, machine-readable error code
Human-readable explanation
Present on 403 — the permission the caller lacked
Present on 402 — gated feature
Present on 402 — the plan’s cap
Present on 402 — the current plan
ENV_TOKEN_INVALID: the remove token is not one for this key.
FORBIDDEN (lacking the required permission) or SCOPE_REQUIRED (no workspace, or a membership change in progress).
object
object
Stable, machine-readable error code
Human-readable explanation
Present on 403 — the permission the caller lacked
Present on 402 — gated feature
Present on 402 — the plan’s cap
Present on 402 — the current plan
PROJECT_NOT_FOUND.
SCOPE_REQUIRED — the x-uai-org scope names a workspace that does not exist, or one the caller is not a member of. The two are deliberately indistinguishable: a 403 would confirm the workspace exists.
object
object
Stable, machine-readable error code
Human-readable explanation
Present on 403 — the permission the caller lacked
Present on 402 — gated feature
Present on 402 — the plan’s cap
Present on 402 — the current plan
ENV_KEY_MOVED: the key’s generation is no longer the token’s.
object
object
Stable, machine-readable error code
Human-readable explanation
Present on 403 — the permission the caller lacked
Present on 402 — gated feature
Present on 402 — the plan’s cap
Present on 402 — the current plan
PAYLOAD_TOO_LARGE — the request body exceeds 1048576 bytes.
object
object
Stable, machine-readable error code
Human-readable explanation
Present on 403 — the permission the caller lacked
Present on 402 — gated feature
Present on 402 — the plan’s cap
Present on 402 — the current plan
SCOPE_REQUIRED — membership reconciliation required, or membership verification unavailable.
object
object
Stable, machine-readable error code
Human-readable explanation
Present on 403 — the permission the caller lacked
Present on 402 — gated feature
Present on 402 — the plan’s cap
Present on 402 — the current plan