工作区与账号

工作区上下文

我是谁、在哪个工作区、什么角色、本凭证的 scope 与发布落点、可用平台、配额余量与回站深链。接入后建议先调它,后续端点的平台 / 账号参数都从这里取。

GET/api/v1/workspace
workspace:read读档限流只读

鉴权与护栏

  • 请求头 Authorization: Bearer <长期凭证>,凭证在设置页「接入外部系统 → 长期凭证」签发,见 鉴权与权限。
  • 凭证需带 scope workspace:read;签发者在工作区里的角色也要允许该动作。
  • 限流:读档,每分钟 60 次(按凭证计),超出回 429 并带 Retry-After。
  • 幂等:读端点,无需 Idempotency-Key。
  • 只读端点:不写库、不外发。

响应

成功返回 HTTP 200,信封为 { data, meta };右侧(窄屏在本页末尾)给出了各状态码的示例。所有错误都是 { error: { code, message, params }, meta },按机器码处理而不是按 message 匹配,码表见 错误码。

状态码可能的错误码
400invalid_input
401unauthenticated
403forbidden / workspace_not_found
404not_found
429rate_limited
500internal

示例

请求
curl -X GET "https://popkit.loxily.com/api/v1/workspace" \
  -H "Authorization: Bearer popkit_it_••••••••"
响应
成功
{
  "data": {
    "workspace": {
      "id": "ws_01J7PZ4A8K3D",
      "name": "popkit 团队",
      "kind": "team",
      "role": "admin"
    },
    "user": {
      "id": "usr_01J7PZ3Y2M0Q"
    },
    "credential": {
      "kind": "mcp_client",
      "scopes": [
        "workspace:read",
        "accounts:read",
        "posts:read",
        "posts:write",
        "schedule:write"
      ],
      "allowedActions": [
        "draft",
        "schedule"
      ],
      "confirmMode": "preauthorized"
    },
    "quotas": {
      "scheduledThisMonth": {
        "used": 3,
        "limit": 15,
        "left": 12
      },
      "rendersThisMonth": {
        "used": 0,
        "limit": 30,
        "left": 30
      },
      "seats": {
        "used": 2,
        "limit": 3,
        "left": 1
      },
      "aiThisMonth": {
        "used": 4,
        "limit": 50,
        "left": 46
      }
    },
    "platforms": {
      "publishable": [
        "x",
        "youtube",
        "instagram",
        "tiktok",
        "facebook",
        "threads"
      ],
      "manual": [
        "douyin",
        "xiaohongshu",
        "wechat_mp"
      ]
    },
    "accounts": {
      "total": 4,
      "byPlatform": {
        "x": 1,
        "youtube": 1,
        "instagram": 1,
        "tiktok": 1
      }
    },
    "deepLinks": {
      "dashboard": "https://popkit.loxily.com/dashboard",
      "drafts": "https://popkit.loxily.com/content",
      "calendar": "https://popkit.loxily.com/calendar",
      "history": "https://popkit.loxily.com/history",
      "planning": "https://popkit.loxily.com/planning"
    }
  },
  "meta": {
    "requestId": "6a1d0c9e-2b7f-4e3a-8c5d-1f0e9b8a7c61"
  }
}