> ## Documentation Index
> Fetch the complete documentation index at: https://docs.llmgenerator.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Revoke API Key

> This endpoint revokes (deletes) an API key.

## DELETE /api-keys/{keyId}

This endpoint permanently revokes and deletes an API key. Once revoked, the key can no longer be used to authenticate requests.

<Warning>
  This action is irreversible. Once an API key is revoked, it cannot be recovered.
</Warning>

<Note>
  You cannot revoke the API key that is currently being used to make the request.
</Note>

### Path Parameters

<ParamField path="keyId" type="string" required>
  The ID of the API key to revoke.
</ParamField>

### Response

<ResponseField name="success" type="boolean">
  Whether the key was successfully revoked.
</ResponseField>

<ResponseField name="message" type="string">
  A status message.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X DELETE https://api.llmgenerator.com/api/v1/api-keys/llm_1706123456_abc123def456 \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.llmgenerator.com/api/v1/api-keys/llm_1706123456_abc123def456',
    {
      method: 'DELETE',
      headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
    }
  );
  ```
</RequestExample>

<ResponseExample>
  ```json Success (200) theme={null}
  {
    "success": true,
    "message": "API key revoked successfully"
  }
  ```

  ```json Cannot Revoke Current Key (400) theme={null}
  {
    "message": "Cannot revoke the API key currently being used"
  }
  ```

  ```json Not Found (404) theme={null}
  {
    "message": "API key not found"
  }
  ```

  ```json Forbidden (403) theme={null}
  {
    "message": "Access denied to this API key"
  }
  ```
</ResponseExample>
