Claude Platform Docs

移除 RBAC 群組成員

organization.rbac_groups.members.remove(user_id, **kwargs) -> DeletedRBACGroupMember
DELETE/v1/organizations/rbac_groups/{rbac_group_id}/members/{user_id}

從 RBAC 群組中移除使用者。當租用戶中的組織使用 SCIM 佈建時,由身分識別提供者佈建的群組(來源類型為 "scim")其成員資格無法透過 API 修改。

RBAC 群組 API 僅適用於 Claude Enterprise 組織。

Parameters
rbac_group_id: str⁠Path parameter

ID of the RBAC Group.

user_id: str⁠Path parameter

ID of the User.

Returns
class DeletedRBACGroupMember: type: "rbac_group_member_deleted"; rbac_group_id; user_id
type: Literal["rbac_group_member_deleted"]

Deleted object type. For RBAC Group Members, this is always "rbac_group_member_deleted".

defaultrbac_group_member_deleted
rbac_group_id: str

ID of the RBAC Group.

user_id: str

ID of the User.

Errors

Any method can also return the general HTTP errors.

RBACGroupGrantsOwnerAccessErrorHTTP status 400error code rbac_group_grants_owner_access

A role attached to an RBAC Group in the request grants owner access, so this API does not add members to that group (directly or through an invite), remove its members, or delete it. Make the change in the organization's admin settings in Claude.

RBACGroupOwnerAccessUnconfirmedErrorHTTP status 400error code rbac_group_owner_access_unconfirmed

The API could not finish checking whether an RBAC Group in the request grants owner access, so it made no change. Retrying the same request will not help. Make the change in the organization's admin settings in Claude.

SandboxEgressRestrictedErrorHTTP status 403error code sandbox_egress_restricted

The request came from a Claude sandbox with restricted network access, which is not allowed to make this request. Send it from outside the sandbox, or from a sandbox with unrestricted network access.

移除 RBAC 群組成員
import os
from anthropic import Anthropic

client = Anthropic(
    api_key=os.environ.get(
        "ANTHROPIC_API_KEY"
    ),  # This is the default and can be omitted
)
deleted_rbac_group_member = client.organization.rbac_groups.members.remove(
    user_id="user_id",
    rbac_group_id="rbac_group_id",
)
print(deleted_rbac_group_member.rbac_group_id)
Returns Examples
Response 200
{
  "rbac_group_id": "rbac_group_012rppKaSVsmTo6NqRDXQXNF",
  "type": "rbac_group_member_deleted",
  "user_id": "user_01WxYzAbCdEfGhJkMnPqRsTu"
}