> ## 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 列表。

## GET /api-keys

返回当前认证账户下的全部 API Key。出于安全考虑，从不返回完整密钥，仅返回预览片段。

### 响应

<ResponseField name="apiKeys" type="array">
  API Key 对象数组。

  <Expandable title="apiKey 字段">
    <ResponseField name="id" type="string">
      API Key 唯一标识。
    </ResponseField>

    <ResponseField name="name" type="string">
      用户自定义名称。
    </ResponseField>

    <ResponseField name="keyPreview" type="string">
      脱敏预览（例如 `llm_1234...abcd`）。
    </ResponseField>

    <ResponseField name="isActive" type="boolean">
      密钥是否可用。
    </ResponseField>

    <ResponseField name="lastUsedAt" type="string">
      最近使用时间（ISO 8601）。
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      创建时间（ISO 8601）。
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="total" type="number">
  API Key 总数。
</ResponseField>

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

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

  const data = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json Success (200) theme={null}
  {
    "apiKeys": [
      {
        "id": "llm_1706123456_abc123def456",
        "name": "Production Key",
        "keyPreview": "llm_1706...f456",
        "isActive": true,
        "lastUsedAt": "2026-01-20T15:30:00.000Z",
        "createdAt": "2026-01-01T10:00:00.000Z"
      },
      {
        "id": "llm_1706234567_xyz789abc012",
        "name": "Development Key",
        "keyPreview": "llm_1706...c012",
        "isActive": true,
        "lastUsedAt": null,
        "createdAt": "2026-01-15T09:00:00.000Z"
      }
    ],
    "total": 2
  }
  ```
</ResponseExample>
