Overview
useBanMember returns a callable function for banning a member from a space by setting their status to "banned". Requires the caller to be a moderator or admin. Moderators can only ban regular members — banning an admin requires being the space’s owner (its userId: the creator of a top-level space, the root space’s creator for a sub-space), and the last remaining admin cannot be banned. The space’s owner can’t be banned at all.
A ban is a standing bar: the member stays out until someone calls useUnbanMember. It also cascades to the space’s child spaces and removes the member from the space chat.
Usage Example
Parameters
UUID of the user to ban — their user id, not a membership id. Must be another member: your own id is refused (
400 space/own-member-id). Your own membership is useCheckMyMembership / useLeaveSpace.Returns
Resolves with the banned membership record (status: "banned"), as a SpaceMember object: id, spaceId, userId, role, status, joinedAt and createdAt.
See also: useUnbanMember to reverse a ban, and useLeaveSpace for a member leaving voluntarily.
