> ## Documentation Index
> Fetch the complete documentation index at: https://weights.fyi/run/llms.txt

# DELETE /v1/tokens/{token_id}

```text
DELETE https://weights.fyi/run/v1/tokens/<token_id>
Authorization: Bearer <token>                    scope: manage
```

**Available since:** 2026-10-08, when the service went live on weights.fyi/run.

**Answer time:** synchronous: the token stops working the moment the answer is written.

Revokes one of your account's API tokens, for good. From the moment of the answer, any call that carries the revoked token is refused with `401 token_revoked` and `WWW-Authenticate: Bearer error="invalid_token"`, whatever its scopes were. There is no way to turn a revoked token back on; if you revoked one by mistake, make a new token with [POST /v1/tokens](/run/docs/reference/tokens-create.md) and give it to the program that used the old one.

You identify the token by its `id`, the number [GET /v1/tokens](/run/docs/reference/tokens-list.md) lists next to its name and prefix, never by the token itself, so revoking a token never requires you to send it anywhere. This is the call to make when a token may have been seen by someone it was not meant for, when a program or a colleague no longer needs access, or when you rotate tokens on a schedule. Revoking a token does not touch the work it sent. Jobs the token submitted keep running, their results stay readable with any other token of the account that holds `read`, and their cost is charged as usual. A token can revoke itself, if it holds `manage`; the call answers normally and the next call with that token is refused. A token that does not exist, belongs to another account, or is already revoked all answer the same way, `404 token_not_found`. The service never tells you whether a number belongs to someone else, and a second revoke of the same token is not an error you need to act on: the token is off either way.

## Request

| Name | Where | Required | Meaning |
|---|---|---|---|
| `Authorization` | header | yes | `Bearer` and a token that holds the `manage` scope. |
| `token_id` | path | yes | The `id` of the token to revoke, a whole number from [GET /v1/tokens](/run/docs/reference/tokens-list.md). |

The call takes no body.

## Return value

**200 OK** with one field.

| Field | Meaning |
|---|---|
| `revoked` | The `id` of the token that was revoked just now. |

## Errors

| Status | Code | When it happens | What to do |
|---|---|---|---|
| `401` | `unauthorized`, `invalid_token`, `token_revoked`, `token_expired` | No token, or the calling token does not work (any more). | Use a valid token. |
| `403` | `scope_required` | The calling token lacks `manage`. | Use a token with `manage`, or revoke on the panel. |
| `403` | `csrf_required` | A panel session made the call without `X-CSRF-Token`. | Send the panel's CSRF token, or use an API token. |
| `404` | `token_not_found` | No token of your account has this `id`, or it is revoked already. | Check the `id` against [GET /v1/tokens](/run/docs/reference/tokens-list.md). |

## Examples

```sh
curl -s -X DELETE https://weights.fyi/run/v1/tokens/TOKEN_ID -H "Authorization: Bearer $WEIGHTS_API_KEY"
```

```json
{
  "revoked": 2
}
```

## Patterns

### Rotating a token without a gap

To replace a token that a running program uses, make the new token first, give it to the program, check in [GET /v1/tokens](/run/docs/reference/tokens-list.md) that the new token's `last_used_at` moves and the old one's does not, and only then revoke the old one. The program never sees a refusal, and the list tells you that nothing still depends on the old token.

## History

- 2026-10-08: live with the service.

## See also

- [GET /v1/tokens](/run/docs/reference/tokens-list.md) and [POST /v1/tokens](/run/docs/reference/tokens-create.md).
- Your panel, [/app](/run/app), revokes tokens under API tokens too.
