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"
}