
# Revoke a directory token

`DELETE /v1/directories/{directory_id}/tokens/{token_id}` · permission `directories:write`

Revokes the token at once; SCIM requests carrying it get `401` from then on. Revoking an already revoked token also returns `204`. The revocation is audited as `directory.token_revoked`.

## Request

| Field | Type | Required | Description |
|---|---|---|---|
| `directory_id` | path | yes | SCIM directory ID (`dir_…`). |
| `token_id` | path | yes | The token ID (lower-case UUID). |

There is no request body.

## Response

`204 No Content`.

## Errors

| HTTP | code | When |
|---|---|---|
| 404 | `not_found` | The directory or the token does not exist in this environment, or the token belongs to another directory. |
| 401 | `unauthenticated` | The credential is missing, invalid or revoked. |
| 403 | `insufficient_permissions` | The credential lacks the required permission. |
| 429 | `rate_limited` | The rate limit was exceeded; retry after the `Retry-After` period. |
| 503 | `service_unavailable` | Directory sync is temporarily unavailable or not configured in this deployment; retry after the `Retry-After` period. |

## Example

```bash
curl -i -X DELETE "https://api.eu.keenauth.com/v1/directories/dir_01j9xm2n4p6q8r0s2t4v6w8y0z/tokens/0192a3b4-c5d6-7e8f-9a0b-1c2d3e4f5a6b" \
  -H "Authorization: Bearer $KEENAUTH_SECRET_KEY"
```
