> ## 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 キーの失効

> API キーを無効化（削除）するエンドポイントです。

## DELETE /api-keys/{keyId}

指定した API キーを恒久的に失効させ削除します。失効後は認証に使用できません。

<Warning>
  この操作は取り消せません。キーを失効すると復旧できません。
</Warning>

<Note>
  現在のリクエストに使用している API キーは失効できません。
</Note>

### パスパラメーター

<ParamField path="keyId" type="string" required>
  失効させる API キーの 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 成功 (200) theme={null}
  {
    "success": true,
    "message": "API key revoked successfully"
  }
  ```

  ```json 現在使用中のキーは失効不可 (400) theme={null}
  {
    "message": "Cannot revoke the API key currently being used"
  }
  ```

  ```json 見つからない (404) theme={null}
  {
    "message": "API key not found"
  }
  ```

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