Claude Platform Docs

工作區

列出工作區
client.organization.workspaces.list(query?, options?): Page<Workspace>
GET/v1/organizations/workspaces
建立工作區
client.organization.workspaces.create(body, options?): Workspace
POST/v1/organizations/workspaces
取得工作區
client.organization.workspaces.retrieve(workspaceID, options?): Workspace
GET/v1/organizations/workspaces/{workspace_id}
更新工作區
client.organization.workspaces.update(workspaceID, body, options?): Workspace
POST/v1/organizations/workspaces/{workspace_id}
封存工作區
client.organization.workspaces.archive(workspaceID, options?): Workspace
POST/v1/organizations/workspaces/{workspace_id}/archive
Models
type AllowedInferenceGeo = "global" | "us"
One of the following:
"global"
"us"
interface DataResidency { allowed_inference_geos; default_inference_geo; workspace_geo }
allowed_inference_geos: Array<AllowedInferenceGeo> | "unrestricted"

Permitted inference geo values. 'unrestricted' means all geos are allowed.

One of the following:
"global"
"us"
"unrestricted"
default_inference_geo: "global" | "us"

Default inference geo applied when requests omit the parameter.

One of the following:
"global"
"us"
workspace_geo: "us"

Geographic region for workspace data storage. Immutable after creation.

interface DataResidencyCreateConfig { allowed_inference_geos; default_inference_geo; workspace_geo }
allowed_inference_geos?: Array<AllowedInferenceGeo> | "unrestricted" | null

Permitted inference geo values. Defaults to 'unrestricted' if omitted, which allows all geos. Use the string 'unrestricted' to allow all geos, or a list of specific geos.

One of the following:
"global"
"us"
"unrestricted"
default_inference_geo?: "global" | "us" | null

Default inference geo applied when requests omit the parameter. Defaults to 'global' if omitted. Must be a member of allowed_inference_geos unless allowed_inference_geos is "unrestricted".

One of the following:
"global"
"us"
workspace_geo?: "us" | null

Geographic region for workspace data storage. Immutable after creation. Defaults to 'us' if omitted.

interface DataResidencyUpdateConfig { allowed_inference_geos; default_inference_geo }
allowed_inference_geos?: Array<AllowedInferenceGeo> | "unrestricted" | null

Permitted inference geo values. Use 'unrestricted' to allow all geos, or a list of specific geos.

One of the following:
"global"
"us"
"unrestricted"
default_inference_geo?: "global" | "us" | null

Default inference geo applied when requests omit the parameter. Must be a member of allowed_inference_geos unless allowed_inference_geos is "unrestricted".

One of the following:
"global"
"us"
interface KeyProfileMismatchErrorDetails { error_code }
error_code: "key_profile_mismatch"
type NoBillingWorkspaceRole = "workspace_admin" | "workspace_developer" | "workspace_restricted_developer" | "workspace_user"
One of the following:
"workspace_admin"
"workspace_developer"
"workspace_restricted_developer"
"workspace_user"
interface StorageAttachedDuringArchiveErrorDetails { error_code }
error_code: "storage_attached_during_archive"
interface StorageProfileMismatchErrorDetails { error_code; field }
error_code: "storage_profile_mismatch"
field: string

The storage setting that doesn't match the Workspace's user profile.

interface Workspace { type: "workspace"; id; archived_at; /* 8 more */ }
interface WorkspaceCreatedIncompleteErrorDetails { error_code; workspace_id }
error_code: "workspace_created_incomplete"
workspace_id: string

ID of the Workspace the request created.

interface WorkspaceMember { type: "workspace_member"; user_id; workspace_id; workspace_role }
type: "workspace_member"

Object type.

For Workspace Members, this is always "workspace_member".

defaultworkspace_member
user_id: string

ID of the User.

workspace_id: string

ID of the Workspace.

workspace_role: WorkspaceRole

Role of the Workspace Member.

One of the following:
"workspace_admin"
"workspace_billing"
"workspace_developer"
"workspace_restricted_developer"
"workspace_user"
interface WorkspaceMemberLimitExceededErrorDetails { error_code }
error_code: "workspace_member_limit_exceeded"
type WorkspacePolicyField = "external_key_id"
interface WorkspacePolicyViolationErrorDetails { error_code; field }
error_code: "workspace_policy_violation"

The request field the broken rule applies to. Other values may be returned.

type WorkspaceRole = "workspace_admin" | "workspace_billing" | "workspace_developer" | 2 more
One of the following:
"workspace_admin"
"workspace_billing"
"workspace_developer"
"workspace_restricted_developer"
"workspace_user"
Errors
class KeyProfileMismatchError extends BadRequestError { errorCode; details }⁠HTTP status 400

After this request, the External Key and the Workspace would not have the same user profile. A key and its Workspace must have the same user profile, or both have none.

errorCode: "key_profile_mismatch"
details: KeyProfileMismatchErrorDetails { error_code }
error_code: "key_profile_mismatch"
class StorageProfileMismatchError extends BadRequestError { errorCode; details }⁠HTTP status 400

The Workspace's storage and its user profile don't match: the Workspace and its storage must have the same user profile, or both have none.

errorCode: "storage_profile_mismatch"
details: StorageProfileMismatchErrorDetails { error_code; field }
error_code: "storage_profile_mismatch"
field: string

The storage setting that doesn't match the Workspace's user profile.

class WorkspaceMemberLimitExceededError extends BadRequestError { errorCode; details }⁠HTTP status 400

The workspace has reached the member limit that Anthropic set for it.

errorCode: "workspace_member_limit_exceeded"
error_code: "workspace_member_limit_exceeded"
class WorkspacePolicyViolationError extends BadRequestError { errorCode; details }⁠HTTP status 400

The request breaks the organization's Workspace Policy. The message says which rule it broke; an organization admin can see and change the policy in the Console.

errorCode: "workspace_policy_violation"
details: WorkspacePolicyViolationErrorDetails { error_code; field }
error_code: "workspace_policy_violation"

The request field the broken rule applies to. Other values may be returned.

class StorageAttachedDuringArchiveError extends ConflictError { errorCode; details }⁠HTTP status 409

The Workspace was archived, but External Storage was attached to it during the archive and is still attached. To detach it, archive the Workspace again as a caller with the org:external-storage:use permission.

errorCode: "storage_attached_during_archive"
error_code: "storage_attached_during_archive"
class WorkspaceCreatedIncompleteError extends ServiceUnavailableError { errorCode; details }⁠HTTP status 503

The Workspace was created, but some of what the request asked for did not take effect, or may not have. Don't send the create again. The error's message says what to do with the Workspace at workspace_id.

errorCode: "workspace_created_incomplete"
details: WorkspaceCreatedIncompleteErrorDetails { error_code; workspace_id }
error_code: "workspace_created_incomplete"
workspace_id: string

ID of the Workspace the request created.

工作區速率限制

列出工作區速率限制
client.organization.workspaces.rateLimits.list(workspaceID, query?, options?): PageCursor<WorkspaceRateLimit>
GET/v1/organizations/workspaces/{workspace_id}/rate_limits

列出工作區的速率限制。

設定工作區速率限制
client.organization.workspaces.rateLimits.update(rateLimitID, params, options?): WorkspaceRateLimit
POST/v1/organizations/workspaces/{workspace_id}/rate_limits/{rate_limit_id}

為工作區中的單一速率限制群組設定或清除速率限制覆寫。

工作區成員

列出工作區成員
client.organization.workspaces.members.list(workspaceID, query?, options?): Page<WorkspaceMember>
GET/v1/organizations/workspaces/{workspace_id}/members
建立工作區成員
client.organization.workspaces.members.add(workspaceID, body, options?): WorkspaceMember
POST/v1/organizations/workspaces/{workspace_id}/members
取得工作區成員
client.organization.workspaces.members.retrieve(userID, params, options?): WorkspaceMember
GET/v1/organizations/workspaces/{workspace_id}/members/{user_id}
更新工作區成員
client.organization.workspaces.members.update(userID, params, options?): WorkspaceMember
POST/v1/organizations/workspaces/{workspace_id}/members/{user_id}
刪除工作區成員
client.organization.workspaces.members.remove(userID, params, options?): MemberRemoveResponse
DELETE/v1/organizations/workspaces/{workspace_id}/members/{user_id}

工作區服務帳戶

列出服務帳戶工作區成員
client.organization.workspaces.serviceAccounts.list(workspaceID, query?, options?): PageCursor<ServiceAccountWorkspaceMember>
GET/v1/organizations/workspaces/{workspace_id}/service_accounts

需要具有 org:admin 範圍的 OAuth 存取權杖,可透過 ant auth login --scope org:admin 或工作負載身分聯合(workload identity federation)規則取得;不接受 Admin API 金鑰。請參閱使用 Admin API 管理 WIF。

建立服務帳戶工作區成員
client.organization.workspaces.serviceAccounts.add(workspaceID, body, options?): ServiceAccountWorkspaceMember
POST/v1/organizations/workspaces/{workspace_id}/service_accounts

需要具有 org:admin 範圍的 OAuth 存取權杖,可透過 ant auth login --scope org:admin 或工作負載身分聯合(workload identity federation)規則取得;不接受 Admin API 金鑰。請參閱使用 Admin API 管理 WIF。

取得服務帳戶工作區成員
client.organization.workspaces.serviceAccounts.retrieve(serviceAccountID, params, options?): ServiceAccountWorkspaceMember
GET/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}

需要具有 org:admin 範圍的 OAuth 存取權杖,可透過 ant auth login --scope org:admin 或工作負載身分聯合(workload identity federation)規則取得;不接受 Admin API 金鑰。請參閱使用 Admin API 管理 WIF。

更新服務帳戶工作區成員
client.organization.workspaces.serviceAccounts.update(serviceAccountID, params, options?): ServiceAccountWorkspaceMember
POST/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}

需要具有 org:admin 範圍的 OAuth 存取權杖,可透過 ant auth login --scope org:admin 或工作負載身分聯合(workload identity federation)規則取得;不接受 Admin API 金鑰。請參閱使用 Admin API 管理 WIF。

刪除服務帳戶工作區成員
client.organization.workspaces.serviceAccounts.remove(serviceAccountID, params, options?): ServiceAccountRemoveResponse
DELETE/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}

需要具有 org:admin 範圍的 OAuth 存取權杖,可透過 ant auth login --scope org:admin 或工作負載身分聯合規則取得;不接受 Admin API 金鑰。請參閱使用 Admin API 管理 WIF。