获取工作区用量

OpenAPI 契约

方法
GET
路径
/api/v1/workspaces/{id}/usage
认证
jwtBearer (bearer)
响应状态
200 400 401 403 404 409 429 500
请求与响应 Schema
JSON
{
  "requestBody": {},
  "responses": {
    "200": {
      "description": "Workspace usage",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/WorkspaceUsageResponse"
        }
      }
    },
    "400": {
      "description": "Invalid request",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/RequestError"
        }
      }
    },
    "401": {
      "description": "Authentication required or invalid",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "403": {
      "description": "Authenticated but not permitted",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "404": {
      "description": "Requested workspace resource was not found",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    },
    "409": {
      "description": "Request conflicts with current workspace state",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    },
    "429": {
      "description": "Rate limit exceeded",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "500": {
      "description": "Unexpected server error",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    }
  }
}

GET /api/v1/workspaces/{id}/usage 仅接受 JWT,并要求 workspace 的 usage:read。它返回归属于该 workspace 的 lifetime NCU:已结算 usage、当前 reservation、refund,以及 organization billing owner 的剩余 wallet balance。此版本尚不支持 workspace-specific limit,因此 limitNcu 为 null。

projects、people 和 apiKeys 数组会按 attribution ID 与显示名称拆分 usage 和 reservation。已删除密钥仍标识为 deleted,没有项目的构建归入 unprojected。此 endpoint 不接受 date range,也不会暴露调用方 collaboration boundary 之外的 workspace。

http
GET /api/v1/workspaces/{id}/usage
Authorization: Bearer <access token>