Claude Platform Docs

Keluarkan Workspace dari Akun Layanan

client.Organization.ServiceAccounts.Workspaces.Remove(ctx, workspaceID, body) (*OrganizationServiceAccountWorkspaceRemoveResponse, error)
DELETE/v1/organizations/service_accounts/{service_account_id}/workspaces/{workspace_id}

Memerlukan token akses OAuth dengan scope org:admin, dari ant auth login --scope org:admin atau aturan workload identity federation; kunci Admin API tidak diterima. Lihat Mengelola WIF dengan Admin API.

Keluarkan akun layanan dari workspace.

Cerminan dari DELETE /workspaces/{workspace_id}/service_accounts/{service_account_id}, diakses dari sisi akun layanan. Penghapusan bersifat idempoten (mengembalikan 200 meskipun keanggotaan sudah dihapus). DELETE terhadap keanggotaan implisit workspace default mengembalikan 200 tetapi tidak melakukan apa pun dan keanggotaan tetap ada; menghapus baris eksplisit workspace default akan kembali ke keanggotaan implisit workspace_user. Workspace yang diarsipkan mengembalikan 400.

Parameters
workspaceID string⁠Path parameter

ID of the workspace.

body OrganizationServiceAccountWorkspaceRemoveParams
ServiceAccountID string⁠Path parameter

ID of the service account.

Returns
type OrganizationServiceAccountWorkspaceRemoveResponse struct { Type: "service_account_workspace_member_deleted"; ServiceAccountID; WorkspaceID }
Type ServiceAccountWorkspaceMemberDeleted
defaultservice_account_workspace_member_deleted
ServiceAccountID string

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

WorkspaceID string

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

Keluarkan Workspace dari Akun Layanan
package main

import (
	"context"
	"fmt"

	"github.com/anthropics/anthropic-sdk-go"
	"github.com/anthropics/anthropic-sdk-go/option"
)

func main() {
	client := anthropic.NewClient(
		option.WithAPIKey("my-anthropic-api-key"),
	)
	workspace, err := client.Organization.ServiceAccounts.Workspaces.Remove(
		context.TODO(),
		"workspace_id",
		anthropic.OrganizationServiceAccountWorkspaceRemoveParams{
			ServiceAccountID: "service_account_id",
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", workspace.ServiceAccountID)
}
Returns Examples
Response 200
{
  "service_account_id": "service_account_id",
  "type": "service_account_workspace_member_deleted",
  "workspace_id": "workspace_id"
}