---
title: "Revoke Api Key"
method: POST
path: "/api/v1/keys/{key_id}/revoke"
tags: ["API Keys"]
---

# Revoke Api Key

`POST /api/v1/keys/{key_id}/revoke`

## Request

- Base URL: `https://api.seoproai.co`
- URL: `https://api.seoproai.co/api/v1/keys/{key_id}/revoke`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://dajosjnaalanhqksxrpe.supabase.co/auth/v1/authorize`, token URL `https://dajosjnaalanhqksxrpe.supabase.co/auth/v1/token`)

Revoke (deactivate) an API key.

The key will be immediately invalidated but kept in the database for audit purposes.
Use this instead of delete if you want to preserve usage history.

Args:
    key_id: The API key ID to revoke
    user_id: Authenticated user ID (from JWT)
    db: Database client

Returns:
    Success confirmation

## Path parameters

- `key_id` string, required

## Headers

- `X-User-Id` string, nullable
- `X-Organization-Id` string, nullable
- `Authorization` string, nullable

## Response `200`

Successful Response

- APIKeyRevokeResponse: Response model for revoking an API key
  - `success` boolean, required
  - `message` string, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/seoproai/apis/seopro-ai.md) · [All operations](https://skmtc.dev/seoproai/apis/seopro-ai/llms.txt) · [OpenAPI document](https://skmtc.dev/seoproai/apis/seopro-ai/revisions/5b4b6391ddc9?raw)
