---
title: "Revoke an API key"
method: POST
path: "/v1beta/api-keys/{api_key_id}/revoke"
tags: ["API Keys"]
---

# Revoke an API key

`POST /v1beta/api-keys/{api_key_id}/revoke`

Revokes an API key, immediately preventing it from being used for authentication.

## Path parameters

- `api_key_id` string, required — API key ID to revoke. Pattern: key_[0-9a-hjkmnp-tv-z]{26}

## Request body

- object — RevokeApiKeyRequest identifies an API key to revoke.
  - `reason` string, nullable — Optional reason for revocation (for audit purposes). The revoking user's identity and timestamp are captured in audit logs separately.

## Response `200`

Success

- RevokeApiKeyResponse — RevokeApiKeyResponse contains the revoked API key.
  - `api_key` ApiKey, required — ApiKey represents an authentication credential for programmatic API access.
    - `created_at` string, date-time, required — Timestamp when the key was created.
    - `expires_at` string, date-time — Expiration timestamp. If set, the key becomes invalid after this time.
    - `id` string, required — Unique ID for the API key. Pattern: key_[0-9a-hjkmnp-tv-z]{26}
    - `is_active` boolean, required — Whether the key is currently active (not revoked and not expired). Computed: is_active = (revoked_at == null) && (expires_at == null || expires_at > now())
    - `key_prefix` string, required — Truncated key prefix for identification in UI (e.g., "ffy_prod_01jd4h5..."). Shows the first 16 characters for better uniqueness while maintaining security.
    - `name` string, required — Human-readable name for the key (e.g., "Production", "Staging").
    - `organization_id` string, required — ID of the organization this key belongs to. Pattern: org_[0-9a-hjkmnp-tv-z]{26}
    - `revoked_at` string, date-time — Timestamp when the key was revoked. Null if the key has not been revoked.

## Other responses

- `400` — Invalid request parameters
- `401` — Authentication failed - missing or invalid API key
- `403` — Authorization failed - valid key but insufficient permissions
- `404` — Resource not found
- `429` — Too many requests
- `500` — Internal server error

---

[API](https://skmtc.net/factify-inc/apis/factify-api.md) · [All operations](https://skmtc.net/factify-inc/apis/factify-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/factify-inc/factify-api/revisions/8baabdfb82bf/schema)
