Claude Platform Docs

刪除服務帳戶工作區成員

ServiceAccountRemoveResponse organization().workspaces().serviceAccounts().remove(params, requestOptions = RequestOptions.none())
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。

從工作區移除服務帳戶。

移除操作具有冪等性(即使成員資格已被移除,仍會傳回 200)。對隱含的預設工作區成員資格執行 DELETE 會傳回 200,但不會產生任何作用,成員資格仍會保留;刪除明確的預設工作區資料列則會還原為隱含的 workspace_user 成員資格。已封存的工作區會傳回 400。

Parameters
ServiceAccountRemoveParams params
String workspaceId⁠Path parameter

ID of the workspace.

Optional<String> serviceAccountId⁠Path parameter

ID of the service account.

Returns
class ServiceAccountRemoveResponse { type = "service_account_workspace_member_deleted"; serviceAccountId; workspaceId; }
JsonValue type = "service_account_workspace_member_deleted"
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.

刪除服務帳戶工作區成員
package com.anthropic.example;

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.organization.workspaces.serviceaccounts.ServiceAccountRemoveParams;
import com.anthropic.models.organization.workspaces.serviceaccounts.ServiceAccountRemoveResponse;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        AnthropicClient client = AnthropicOkHttpClient.fromEnv();

        ServiceAccountRemoveParams params = ServiceAccountRemoveParams.builder()
            .workspaceId("workspace_id")
            .serviceAccountId("service_account_id")
            .build();
        ServiceAccountRemoveResponse serviceAccount = client.organization().workspaces().serviceAccounts().remove(params);
    }
}
Returns Examples
Response 200
{
  "service_account_id": "service_account_id",
  "type": "service_account_workspace_member_deleted",
  "workspace_id": "workspace_id"
}