Claude Platform Docs

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

organization.service_accounts.workspaces.list(service_account_id, **kwargs) -> PageCursor<ServiceAccountWorkspaceMember>
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。请使用 limit 和 next_page 游标进行分页。当服务账号没有显式的默认工作区成员资格时,隐式(implicit: true)成员资格将作为第一页的第一个条目返回;当 limit=1 时,第一页最多可能返回 2 个条目(隐式条目加上一个显式成员资格),以便生成分页游标。仅当服务账号处于活动状态时才会返回成员资格。在没有 page 游标的情况下,已归档的服务账号将返回空列表。与任何活动成员资格都不匹配的 page 游标将返回 400 无效请求错误。当成员资格被移除、工作区被删除或服务账号被归档时,游标将不再匹配。请从第一页重新开始分页以恢复。

Parameters
service_account_id: String⁠Path parameter

ID of the service account.

limit: Integer⁠Query parameter

Number of results per page.

minimum1
maximum100
page: String⁠Query parameter

Opaque cursor from a previous response's next_page.

Returns
class ServiceAccountWorkspaceMember { type: :service_account_workspace_member, created_by_actor_id, implicit, 3 more }
type: :service_account_workspace_member
created_by_actor_id: String

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

implicit: bool

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_...).

workspace_id: String

Tagged workspace ID (wrkspc_...).

workspace_role: WorkspaceRole

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
列出服务账号所属的工作区
require "anthropic"

anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key")

page = anthropic.organization.service_accounts.workspaces.list("service_account_id")

puts(page)
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"
}