Claude Platform Docs

從服務帳戶移除工作區

$client->beta->organization->serviceAccounts->workspaces->remove(string workspaceID, string serviceAccountID, ?list<AnthropicBeta> betas): 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

從工作區移除服務帳戶。

這是 DELETE /workspaces/{workspace_id}/service_accounts/{service_account_id} 的鏡像, 從服務帳戶端定址。移除具冪等性(即使成員資格已被移除也會傳回 200)。 對隱含預設工作區成員資格執行 DELETE 會傳回 200,但不會有任何作用, 且成員資格會持續存在;刪除明確的預設工作區列會還原為隱含的 workspace_user 成員資格。已封存的工作區會傳回 400。

Parameters
serviceAccountID: string

ID of the service account.

workspaceID: string

ID of the workspace.

betas?:optional list<AnthropicBeta>

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

Returns
class WorkspaceRemoveResponse { $type = 'service_account_workspace_member_deleted'; $serviceAccountID; $workspaceID; }
"service_account_workspace_member_deleted" type
string serviceAccountID

Tagged service account ID (svac_...) named in the delete request. Removal is idempotent; see the endpoint description for the implicit-membership no-op.

string workspaceID

Tagged workspace ID (wrkspc_...) named in the delete request.

從服務帳戶移除工作區
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

$client = new Client(apiKey: 'my-anthropic-api-key');

$workspace = $client->beta->organization->serviceAccounts->workspaces->remove(
  'workspace_id',
  serviceAccountID: 'service_account_id',
  betas: [AnthropicBeta::MESSAGE_BATCHES_2024_09_24],
);

var_dump($workspace);
Returns Examples
Response 200
{
  "service_account_id": "service_account_id",
  "type": "service_account_workspace_member_deleted",
  "workspace_id": "workspace_id"
}