Claude Platform Docs

服务账号

创建服务账号
client.organization.serviceAccounts.create(body, options?): ServiceAccount
POST/v1/organizations/service_accounts

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

列出服务账号
client.organization.serviceAccounts.list(query?, options?): PageCursor<ServiceAccount>
GET/v1/organizations/service_accounts

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

获取服务账号
client.organization.serviceAccounts.retrieve(serviceAccountID, options?): ServiceAccount
GET/v1/organizations/service_accounts/{service_account_id}

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

更新服务账号
client.organization.serviceAccounts.update(serviceAccountID, body, options?): ServiceAccount
POST/v1/organizations/service_accounts/{service_account_id}

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

归档服务账号
client.organization.serviceAccounts.archive(serviceAccountID, options?): ServiceAccount
POST/v1/organizations/service_accounts/{service_account_id}/archive

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

Models
interface ServiceAccount { type: "service_account"; id; archived_at; /* 8 more */ }

Named non-human identity within the caller's organization.

A service account is a pure identity: name + org. Authorization lives on whatever references it (federation rules).

interface ServiceAccountWorkspaceMember { type: "service_account_workspace_member"; created_by_actor_id; implicit; /* 3 more */ }
type: "service_account_workspace_member"
defaultservice_account_workspace_member
created_by_actor_id: string | null

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

implicit: boolean | 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_...).

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"

服务账号工作区

将工作区添加到服务账号
client.organization.serviceAccounts.workspaces.add(serviceAccountID, body, options?): ServiceAccountWorkspaceMember
POST/v1/organizations/service_accounts/{service_account_id}/workspaces

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

列出服务账号所属的工作区
client.organization.serviceAccounts.workspaces.list(serviceAccountID, query?, options?): 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。

从服务账号中移除工作区
client.organization.serviceAccounts.workspaces.remove(workspaceID, params, options?): WorkspaceRemoveResponse
DELETE/v1/organizations/service_accounts/{service_account_id}/workspaces/{workspace_id}

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