spaces module includes a full set of membership management functions. Use these to build admin tools, automate onboarding flows, or enforce membership policies server-side.
joinSpace
Adds a user to a space. If the space requires approval (requireJoinApproval: true), the membership is created in a pending state.
The Sublay space ID.
The Sublay user ID to add.
Promise<JoinSpaceResponse>
leaveSpace
Removes a user from a space.The Sublay space ID.
The Sublay user ID to remove.
Promise<LeaveSpaceResponse>
checkMyMembership
Returns the membership status of a user in a space.The Sublay space ID.
The Sublay user ID to check.
Promise<CheckMyMembershipResponse>
fetchSpaceMembers
Returns a paginated list of approved members in a space.The Sublay space ID.
Page number (1-indexed). Defaults to
1.Results per page. Defaults to
20.Filter by role:
"admin", "moderator", or "member".Filter by membership status:
"pending", "active", "banned", or "rejected".Promise<SpaceMembersResponse>
fetchSpaceTeam
Returns the admin and moderator members of a space (the “team”).The Sublay space ID.
Promise<SpaceTeamResponse>
updateMemberRole
Updates a member’s role within a space.The Sublay space ID.
The Sublay space member ID (not the user ID).
The new role to assign:
"admin", "moderator", or "member".Promise<UpdateMemberRoleResponse>
approveMembership
Approves a pending membership request. Only relevant when the space hasrequireJoinApproval: true.
The Sublay space ID.
The Sublay space member ID of the pending member.
Promise<ApproveMemberResponse>
declineMembership
Declines and removes a pending membership request.The Sublay space ID.
The Sublay space member ID of the pending member.
Promise<DeclineMemberResponse>
banMember
Bans a member from a space, preventing them from rejoining.The Sublay space ID.
The Sublay space member ID to ban.
Promise<BanMemberResponse>
unbanMember
Removes a ban, allowing the user to rejoin the space.The Sublay space ID.
The Sublay space member ID to unban.
Promise<UnbanMemberResponse>
