# POST /api/v1/tokens/{token_id}/revoke

> Revoke token

- **Tag:** api-tokens
- **Operation ID:** `revoke_token_api_v1_tokens__token_id__revoke_post`

## Description

Revoke an API token.

**Path Parameters:**
- `token_id`: UUID of the token to revoke

**Request Body:** (optional)
- `reason`: Optional reason for revocation

**Note:** Once revoked, the token can no longer be used for authentication.
The token is added to a blacklist and will be rejected on all future requests.

Revoked tokens cannot be un-revoked.

**Returns:** Revoked token information with revocation timestamp.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Parameters

- `token_id` (path, string, required)

## Responses

### 201 — Successful Response

Schema: `SuccessEnvelope_APITokenRevokeResponse_`

- `success` (boolean)
- `message` (string)
- `code` (string)
- `data` (APITokenRevokeResponse)

### 400 — Bad Request - Invalid input

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 404 — Not Found - Resource does not exist

### 422 — Validation Error

Schema: `HTTPValidationError`

- `detail` (array · ValidationError) → `ValidationError`
  - `loc` (array · string | integer · required)
  - `msg` (string · required)
  - `type` (string · required)
  - `input` (object)
  - `ctx` (object)

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/tokens/{token_id}/revoke' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d ''
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/tokens/{token_id}/revoke', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {}

response = httpx.post("https://api.ondayzero.com/api/v1/tokens/{token_id}/revoke", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/api-tokens/revoke-token
- OpenAPI slice: https://www.ondayzero.com/docs/reference/api-tokens/revoke-token/openapi.json
- Other endpoints in **api-tokens**: https://www.ondayzero.com/docs/reference/api-tokens
