Claude Platform Docs

Quitar espacio de trabajo de la cuenta de servicio

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

Requiere un token de acceso OAuth con el alcance org:admin, obtenido de ant auth login --scope org:admin o de una regla de federación de identidades de carga de trabajo; no se aceptan claves de Admin API. Consulta Administrar WIF con la Admin API.

Quita una cuenta de servicio de un espacio de trabajo.

Es el equivalente de DELETE /workspaces/{workspace_id}/service_accounts/{service_account_id}, abordado desde el lado de la cuenta de servicio. La eliminación es idempotente (devuelve 200 incluso si la membresía ya se había quitado). Un DELETE sobre la membresía implícita del espacio de trabajo predeterminado devuelve 200, pero no tiene efecto y la membresía persiste; eliminar una fila explícita del espacio de trabajo predeterminado revierte a la membresía implícita workspace_user. Los espacios de trabajo archivados devuelven 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.

Quitar espacio de trabajo de la cuenta de servicio
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"
}