Claude Platform Docs

Eliminar cuenta de servicio miembro del espacio de trabajo

ServiceAccountRemoveResponse organization().workspaces().serviceAccounts().remove(params, requestOptions = RequestOptions.none())
DELETE/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_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 API de administrador. Consulta Administrar WIF con la Admin API.

Elimina una cuenta de servicio de un espacio de trabajo.

La eliminación es idempotente (devuelve 200 incluso si la membresía ya se había eliminado). Un DELETE contra 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
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.

Eliminar cuenta de servicio miembro del espacio de trabajo
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"
}