Skip to main content

Overview

useUpdateMemberRole returns a callable function for changing a space member’s role. Only admins can update roles. The space’s owner (its userId: the creator of a top-level space, the root space’s creator for a sub-space) always stays an admin: only the space’s owner can promote or demote admins, and the owner can’t change their own role.

Usage Example

Parameters

string
required
UUID of the space.
string
required
UUID of the member’s user — 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.
"admin" | "moderator" | "member"
required
The new role to assign.

Returns

Resolves with the updated membership record, as a SpaceMember object: id, spaceId, userId, role, status, joinedAt and createdAt. When the member already has the role, nothing changes and the record comes back as it is.