# Disable and trash

**Last updated:** 2026-11-22T06:50:00-03:00 (UTC-3)

Disabling is the everyday, reversible action for managed keys, teams and console users: the object stops working at once and comes back unchanged when you enable it. Deleting stays a separate action: it revokes at once and keeps a tombstone for audit in the [recycle bin](/docs/features/access-control/). With `trash_restore`, an administrator can restore a tombstone within a retention window; a restored key always gets a **new** secret, so the old one never works again.

## How to turn it on

```yaml
features:
  identity_management: true
  reversible_disable: true   # off by default; disable/enable keys, teams and users
  recycle_bin: true          # the read-only tombstone list
  trash_restore: true        # off by default; requires recycle_bin and reversible_disable
trash:
  retention_days: 30         # 1 to 365; how long a tombstone can be restored
```

| Flag | Default | What it turns on |
| --- | --- | --- |
| `reversible_disable` | `false` | Disable and enable as the reversible action for managed keys, teams and console users: a disabled key, or every key of a disabled team, stops authenticating at once and works again with the same secret when enabled; delete stays the separate tombstone action. Requires `identity_management` |
| `recycle_bin` | `false` | The read-only list of tombstones of deleted keys, teams and workloads, with who deleted them |
| `trash_restore` | `false` | Restores a deleted key or team, or a disabled user, within `trash.retention_days`; a restored key always gets a new secret. Requires `recycle_bin` and `reversible_disable` |

The three are operator flags and can be switched in the console. They need PostgreSQL (migration 185 adds `disabled_at` to keys and teams).

## Disable and enable

| Object | Disable | Enable | While disabled |
| --- | --- | --- | --- |
| Managed key | `POST /api/v1/admin/keys/{id}/disable` | `POST .../keys/{id}/enable` | The key answers `401`; the same secret works again after enable |
| Team (console) | `POST /api/v1/admin/teams/{id}/disable` | `POST .../teams/{id}/enable` | None of its keys authenticate; nothing else changes |
| Console user | `DELETE /api/v1/admin/users/{id}` (as before) | `POST .../users/{id}/enable` | No token or session works; sessions issued before the disable stay invalid after enable |

- In the console: **Disable** / **Enable** in Virtual keys, **Disable team** / **Enable team** in Teams and **Enable** on a disabled console user.
- A revoked key cannot be enabled (`409 key_state`); revoke stays final. A YAML team is changed in YAML (`409 yaml_owned`). A SCIM-managed user follows its identity provider (`409 scim_managed`), and a user awaiting a JIT decision is approved or rejected instead (`409 jit_pending`). `POST /users/{id}/enable` itself has no window: disabling a user is the reversible action.
- A disabled key or team is also refused for JWT inference and customer portal credentials. The replica that handles the change drops its cached key lookups at once; with the [managed key cache](/docs/features/managed-key-cache/) another replica may keep a verified entry until its window ends, as for any revocation.
- Who: key actions need `keys:manage` (team administrators for their teams, with membership delegation); teams need `teams:manage`; users need `users:manage`. An organization admin acts only inside its organization.
- **Enable needs the disabling scope.** A disable records the scope of its actor (migration 186, `disabled_scope` on keys and teams): `global` (a global administrator, an operator or the shared bearer), `organization` (an organization admin) or `team` (a team administrator or a member with the delegated key action). Enable needs an actor of at least that scope: a team administrator cannot enable a key that an organization or global administrator disabled, and an organization admin cannot enable a key or team that a global administrator disabled (`403 disabled_by_wider_scope`). Each scope can undo its own disables and narrower ones. A key or team disabled before migration 186 has no recorded scope and counts as `global`. Delete and restore do not undo it either: a key disabled by a wider scope than the restoring administrator is restored with its new secret but still disabled.
- Audit: `key.disable`, `key.enable`, `team.disable`, `team.enable` and `console_user.enable`, with the actor and the request ID.

## Delete and the recycle bin

Delete keeps its current meaning: a key is revoked and tombstoned, a team is tombstoned and its keys revoked, a user is disabled. **Settings → Recycle bin** (`GET /api/v1/admin/recycle-bin`) lists the tombstones with who deleted them and the request ID. An organization admin sees only its organization's tombstones.

## Restore

With `trash_restore`, the list answers `"restore": true`, `"trash": {"retention_days": 30}` (the effective `trash.retention_days`, also shown on the page), and a `restorable_until` on each key, team or user still inside the window. **Restore** (`POST /api/v1/admin/recycle-bin/{kind}/{id}/restore`) does:

| Kind | Result |
| --- | --- |
| `key` | The key is live again with a **new secret**, shown once (`no-store`). Every earlier credential is revoked, so the old secret never authenticates again; pending rotation schedules are cancelled and JWT bindings that named the key are disabled until bound again. The key's team must be live (`409 parent_deleted`). A key revoked before it was deleted stays revoked (`409 key_revoked`) |
| `team` | The team is live again. The keys revoked when it was deleted stay revoked and its workloads stay deleted: issue new keys. The organization must be live; the name must be free (`409 name_taken`) |
| `user` | The same as enable, but only inside the window: sessions from before stay invalid |

```json
POST /api/v1/admin/recycle-bin/key/vk_3f1c.../restore
200 {"key": {"id": "vk_3f1c...", "team": "team_7a...", ...}, "secret": "gw_..."}
```

- Who: a global admin, or an organization admin for its own organization (`recycle_bin:restore`). Team administrators, viewers and operators cannot restore. Another organization's tombstone answers `404`.
- Outside the window the answer is `409 restore_window_passed`; the tombstone stays for audit. Workloads cannot be restored.
- Audit: `key.restore`, `team.restore` and `console_user.enable`.

## Other objects

Aliases, providers, MCP servers and guardrails already have a reversible off switch (`enabled: false` or `disabled`) and a delete; they are not part of the recycle bin.

## Upgrade notes

- An older binary ignores `disabled_scope` (migration 186): it lets any administrator who can reach the key enable it again. An older binary also ignores `disabled_at`, so a disabled key or team would authenticate again: enable them (or delete them) and turn the flags off before rolling back. Remove `trash` and the flags from YAML too.

## See also

- [Keys, teams and roles](/docs/features/access-control/) · [Key lifecycle](/docs/features/key-policy/) · [Organizations](/docs/features/organizations/)
