Claude Platform Docs

列出服务账户的工作区

GET/v1/organizations/service_accounts/{service_account_id}/workspaces

需要具有 org:admin 作用域的 OAuth 访问令牌,可通过 ant auth login --scope org:admin 或工作负载身份联合规则获取;不接受 Admin API 密钥。请参阅使用 Admin API 管理 WIF

列出服务账号所属的工作区。

每个条目都包含服务账号在该工作区中的 workspace_role。使用 limitnext_page 游标进行分页。当服务账号没有显式的默认工作区成员资格时,隐式(implicit: true)成员资格会作为第一页的第一个条目返回;当 limit=1 时,第一页最多可能返回 2 个条目(隐式条目加一个显式成员资格),以便推导出分页游标。仅在服务账号处于活动状态时返回成员资格。在没有 page 游标的情况下,已归档的服务账号返回空列表。与活动成员资格不匹配的 page 游标会返回 400 无效请求错误。当成员资格被移除、工作区被删除或服务账号被归档时,游标将不再匹配。请从第一页重新开始分页以恢复。

Path parameters
service_account_id: string

ID of the service account.

Query parameters
limit: optional number

Number of results per page.

default20
maximum100
minimum1
page: optional string

Opaque cursor from a previous response's next_page.

Headers
"anthropic-beta": optional array of string

Optional header to specify the beta version(s) you want to use.

To use multiple betas, use a comma separated list like beta1,beta2 or specify the header multiple times for each beta.

Returns
data: array of object{ created_by_actor_id, implicit, service_account_id, 3 more }
created_by_actor_id: string or null

Tagged ID (user_.../svac_...) of the actor who created this membership.

implicit: boolean or null

True when this is the implicit default-workspace membership every service account has when no explicit membership exists. Implicit memberships have role workspace_user and cannot be removed.

service_account_id: string

Tagged service account ID (svac_...).

type: "service_account_workspace_member"
defaultservice_account_workspace_member
workspace_id: string

Tagged workspace ID (wrkspc_...).

workspace_role: "workspace_admin" or "workspace_billing" or "workspace_developer" or 2 more

Role of the service account in this workspace. Service accounts cannot hold the workspace_billing role.

One of the following:
"workspace_admin"
"workspace_billing"
"workspace_developer"
"workspace_restricted_developer"
"workspace_user"
next_page: string or null

Opaque cursor for the next page, or null if no more results.

列出服务账户的工作区
cURL
curl https://api.anthropic.com/v1/organizations/service_accounts/$SERVICE_ACCOUNT_ID/workspaces \
    -H 'anthropic-version: 2023-06-01' \
    -H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN"
Returns Examples
Response 200
{
  "data": [
    {
      "created_by_actor_id": "created_by_actor_id",
      "implicit": true,
      "service_account_id": "service_account_id",
      "type": "service_account_workspace_member",
      "workspace_id": "workspace_id",
      "workspace_role": "workspace_admin"
    }
  ],
  "next_page": "next_page"
}