> ## 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.

# 吊销 API Key

> 吊销（删除）API Key。

## DELETE /api-keys/{keyId}

永久吊销并删除指定 API Key。吊销后无法再用于鉴权。

<Warning>
  此操作不可恢复，吊销后密钥无法找回。
</Warning>

<Note>
  不能使用当前请求正在使用的 API Key 来吊销自身。
</Note>

### 路径参数

<ParamField path="keyId" type="string" required>
  要吊销的 API Key ID。
</ParamField>

### 响应

<ResponseField name="success" type="boolean">
  是否吊销成功。
</ResponseField>

<ResponseField name="message" type="string">
  状态说明。
</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>
