# What can be revoked

> Every way access is revoked in a realm, from one token to everything a user holds, and which tokens each one stops.

Access ends in more ways than a token running out. An app signs a user out, a user takes back an agent, you stop an
agent that misbehaves, your workforce provider says someone has left. Each is a revocation, and each stops a known
set of tokens before they expire: at the realm at once, and at the [gateway](/gateway/) within one poll.

## Before you begin

- **To stop an agent, a user or a client**, a realm administrator in a group holding `RealmOwner`, with the API.
  [Call the API](/develop/api/) shows how to get `$CVYUH_SESSION`.
- **To revoke a token**, the credentials of the client it was issued to.
- **What users take back** they take back themselves, in their own account pages; nothing to set up.

## How it works

### Tokens and sign-ins

| Revoked | By | Stops |
|---|---|---|
| One token | The client, at the revocation endpoint ([Revoke tokens](/workforce-identity/applications/revoke-access/revocation/)) | That token, and every token exchanged from it |
| A refresh family | The client revoking a refresh token, or a refresh token used twice | Every token from that one sign-in |
| A session | Sign-out, or a timeout | Every token that names the session (`sid`) |

### What users take back

| Revoked | By | Stops |
|---|---|---|
| An app's access | The user, on **Authorized apps** | That app's tokens about the user, issued before. If they let the app in again, new tokens stand |
| A delegation | The user, on **AI agents**, or you, by deleting the agent's `actsFor` link | Every token about the user in which that agent acts, at any depth, issued before |

### Agents and users

| Revoked | By | Stops |
|---|---|---|
| An agent | You, by quarantining, killing or retiring it ([Stop an agent](/workforce-identity/guides/agents/stop-an-agent/)) | Every token it holds, every token it acts in, and the same for every agent beneath it |
| A user | You, by setting them inactive, or their account expiring | Every token about them, until they're active again |
| Everything a user held | A provider's `account-disabled` or `credential-compromise` signal ([Receive signals](/workforce-identity/signals/receive-signals/)) | Every token and grant about them issued before that moment, offline access included. What they're given afterwards stands |

A quarantined agent can't get a token until you set it back to `active`. A killed or retired agent stays stopped for good.

## Set it up

- **As an app:** revoke at sign-out. See [Revoke a token](/gateway/guides/revoke-a-token/).
- **For an agent:** quarantine or kill it, and every agent beneath it stops with it:

  ```sh
  curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/agent/invoice-agent \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "status": "quarantined" }'
  ```

  Send `"killed"` in place of `"quarantined"` to stop it for good.
- **For a user:** set them inactive:

  ```sh
  curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/user/maya \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "status": "inactive" }'
  ```

- **From your workforce provider:** register it, as in [Receive signals](/workforce-identity/signals/receive-signals/).

## A client you set inactive

Setting a client inactive refuses its tokens at the realm and at introspection at once. The revocation feed doesn't
list clients, though, so the gateway and other enforcement points that decide locally keep taking the access tokens
the client already holds until they expire (five minutes by default). To refuse them sooner at the gateway:

1. **Deny the client by policy.** A policy that denies every action to tokens whose `client_id` is the client
   refuses them at the gateway within its next policy poll, a minute by default:

   ```sh
   curl -i "https://foobar.cvyuh.com/api/v0/am/objects/v1/policy?id=deny-web-app" \
     -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
     -H "Content-Type: application/json" \
     -d '{ "active": true,
           "resources": ["*://*:*/*"],
           "actionValues": { "GET": false, "POST": false, "PUT": false, "DELETE": false,
                             "HEAD": false, "OPTIONS": false, "PATCH": false },
           "subject": { "type": "JwtClaim", "claimName": "client_id", "claimValue": "web-app" } }'
   ```

   Link it to the gateway's policy set and the `url` type, as in [Get started with Gateway](/gateway/get-started/).
   One deny refuses whatever else allows. For an MCP server, write the same deny on its MCP types. Delete the policy
   once the client's last tokens have expired.
2. **Revoke its refresh tokens**, if you hold its credentials, so it can't get new access tokens either: see
   [Revoke a token](/gateway/guides/revoke-a-token/).

The gap is also in [Known limitations](/reference/known-limitations/).

## Good to know

- **Chains are checked whole.** At the realm and at the gateway, a token is refused when its subject or *any*
  agent in its `act` chain is revoked, or when any token it was exchanged from is.
- **Revocations look back, not forward.** Taking back an app, a delegation or everything a user held stops what was
  issued before that moment. A second revocation moves the moment on.
- **A client you set inactive** is refused at the realm at once, and at the gateway with one more step: see
  [A client you set inactive](#a-client-you-set-inactive).

## Limits and defaults

| What | Default | Can it change? |
|---|---|---|
| When the gateway learns of a revocation | At its next poll, every 10 seconds | The gateway's revocation poll interval: see [Gateway configuration](/gateway/configuration/#how-current-it-stays) |
| How long a revoked token stays listed in the feed | While a token it covers could still verify | No |
| A client set inactive, at the gateway | Until its tokens expire, five minutes by default | Deny it by policy, as above |

## What the user sees

An app or agent whose token is revoked is refused at its next call: at the realm, `invalid_token` or
`{ "active": false }`; at the gateway, `401 token_revoked` or `401 agent_revoked`. The app signs the user in again; an
agent that's quarantined or killed can't get a new token. A user set inactive can't sign in until you set them
`active` again.

## Audit record

Every revocation is on the audit trail, whatever the realm's settings:

| Revocation | Record |
|---|---|
| A token, a refresh family, a held request's code | `TOKEN_REVOKED` |
| An app a user took back | `APP_TAKEN_BACK` |
| A delegation a user took back | `AGENT_TAKEN_BACK` |
| An agent stopped, a user or client set inactive | `PATCHED`, with the status before and after |

See [What is recorded](/audit-reports/audit-trail/what-is-recorded/).

## Troubleshooting

| Symptom | Cause | Fix |
|---|---|---|
| A revoked token still works at your API | Your API checks signatures only | Put the gateway in front, introspect, or read status lists: see [How fast revocation takes effect](/gateway/revocation/how-fast/) |
| A client set inactive still gets through the gateway | The feed doesn't list clients | Deny it by policy: see [A client you set inactive](#a-client-you-set-inactive) |
| A user let an app back in, and its old tokens still fail | Taking an app back stops tokens issued before it; only new ones stand | The app gets new tokens |

## Related

- [How fast revocation takes effect](/gateway/revocation/how-fast/): at each kind of API.
- [Revoke tokens](/workforce-identity/applications/revoke-access/revocation/): how a client revokes a token.
- [Stop an agent](/workforce-identity/guides/agents/stop-an-agent/): quarantine and kill.
- [Revocation feed](/gateway/revocation/revocation-feed/): the lists an enforcement point holds.
