---
title: Revoke a workspace API key
description: Session or workspace bearer.
api_method: POST
api_path: "/v1/workspaces/{workspaceId}/api-keys/{keyId}/revoke"
canonical_url: https://wiblo.app/docs/developers/api/api-keys/revoke-api-key
last_updated: 2026-07-28T17:31:44+02:00
md_url: https://wiblo.app/docs/developers/api/api-keys/revoke-api-key.md
---

# Revoke a workspace API key

`POST /v1/workspaces/{workspaceId}/api-keys/{keyId}/revoke`

Session or workspace bearer. Owners/admins revoke any key; members revoke only keys they created. Sets `revoked_at`; the key returns 401 on the next request. Per-user rate-limited at 30/60s.

## Path parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `workspaceId` | `string` | Yes |  |
| `keyId` | `string` | Yes |  |

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `reason` | `string` | No | Defaults to `"user_revoked"`. |

## Request

**curl**

```bash
curl https://api.wiblo.app/v1/workspaces/{workspaceId}/api-keys/{keyId}/revoke \
  -X POST \
  -H "Authorization: Bearer $WIBLO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "reason": "..."
}'
```

**TypeScript**

```ts
import { createSdk, revokeApiKey } from "@workspace/sdk"

const sdk = createSdk({ baseUrl: "https://api.wiblo.app" })

const { data, error } = await revokeApiKey({
  client: sdk,
  path: { workspaceId: "...", keyId: "..." },
  body: {
    "reason": "..."
  },
})
```

## Responses

**`204`** — The key is revoked.

**`400`** — Body failed Zod validation (`VALIDATION_FAILED`). Returns `ApiErrorEnvelope`.

**`401`** — No valid session cookie or `wbl_*` bearer was present. Returns `ApiErrorEnvelope`.

**`403`** — Caller may not revoke this key — a member can only revoke keys they created (`INSUFFICIENT_PRIVILEGE`). Returns `ApiErrorEnvelope`.

**`404`** — The key does not exist in this workspace (`API_KEY_NOT_FOUND`), or the caller has no membership / the workspace does not exist (`WORKSPACE_NOT_FOUND`). Returns `ApiErrorEnvelope`.

**`422`** — Path param failed UUID validation (`INVALID_PARAMS`). Returns `ApiErrorEnvelope`.

**`429`** — Rate limit exceeded. The body's `error.code` is `RATE_LIMITED` and `error.details.retry_after` is the same number of seconds as the `Retry-After` header. Returns `ApiErrorEnvelope`.
