Skip to content

API Key 列表

GET/web/v1/workspaces/{workspaceId}/api-keysJWT

返回指定工作空间下所有 API Key 的分页列表。列表响应中不包含密钥值。

鉴权

Auth Chain: WEB Chain — 需要 Authorization: Bearer <jwt> 需要工作空间 OWNER 角色。 以下请求头由系统自动注入(前端无需处理): X-PORTAL-ACCESS-CODE (Nginx)、X-Request-Id (Gateway)

请求参数

NameTypeRequiredInDescription
workspaceIdstringYespath工作空间业务 ID
pageintegerNoquery页码(从零开始)。默认值:`0`
sizeintegerNoquery每页大小。默认值:`20`
sortstringNoquery排序字段和方向(例如 `createdAt,desc`)

成功响应

成功200
{
  "version": "1.3.0",
  "timestamp": 1709337600000,
  "success": true,
  "code": "2000",
  "message": "SUCCESS",
  "data": {
    "content": [
      {
        "apiKeyId": "sk_live_abc123",
        "name": "Production Key",
        "status": "ACTIVE",
        "mode": "LIVE",
        "permissions": [
          "payment:read",
          "payment:write"
        ],
        "ipWhitelist": [
          "192.168.1.0/24"
        ],
        "createdAt": "2026-03-21T00:00:00Z",
        "lastUsedAt": "2026-03-21T12:00:00Z",
        "createdBy": "acc_owner123"
      }
    ],
    "totalElements": 1,
    "totalPages": 1,
    "size": 20,
    "number": 0
  }
}

错误响应

未授权401
{
  "success": false,
  "code": "4010",
  "message": "Invalid or expired token"
}
禁止访问 — 非工作空间所有者403
{
  "success": false,
  "code": "4030",
  "message": "Only workspace owner can manage API keys"
}

说明

  • 列表响应中不会返回 API Key 密钥。
  • 仅工作空间 OWNER 可查看 API Key 列表。

内部文档