跳轉到

取得所有API Key 列表

此 API 用於列出目前系統中所有已建立的 API Key,僅 Master Key 可呼叫此 API。

回傳資料不包含 API Key 明文,只會提供遮罩後的值(redacted_value)、描述資訊(metadata)、建立時間與到期時間等欄位,方便管理者辨識、管理與維護。

curl -X 'GET' \
  'http://127.0.0.1:8000/v1/api-keys' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <master-key>'

Request Headers

Key Value
Request Method GET
accept application/json
Authorization Bearer

Response Body

{
  "data": [
    {
      "id": "3f90f7e3-7ec5-4c68-8bd1-38f54e90d390",
      "object": "api_key",
      "redacted_value": "sk-xxxxxx...abcd",
      "metadata": {
        "customer_name": "ACME Corp",
        "contact": "alice@example.com",
        "purpose": "UAT"
      },
      "created_at": "2025-12-16T00:00:00Z",
      "expires_at": "2026-03-16T00:00:00Z"
    },
    {
      "id": "98ab1f23-6d89-4b55-a1b7-96b8fd3f4e11",
      "object": "api_key",
      "redacted_value": "sk-xxxxxx...wxyz",
      "metadata": {
        "customer_name": "Beta Inc.",
        "contact": "bob@example.com",
        "purpose": "Production"
      },
      "created_at": "2025-12-20T08:30:00Z",
      "expires_at": null
    }
  ],
  "object": "list",
  "has_more": false
}

Field Explanation

Field Detail
data[] 請參考「檔案物件」章節列表
object (與 OpenAI 相容而保留)
has_more 是否有更多的檔案