spaces module covers core space lifecycle management: creating spaces, fetching them by various identifiers, updating settings, navigating parent-child hierarchies, and checking slug availability.
For membership management see Space Members, and for moderation, rules, and digest configuration see Space Moderation.
createSpace
Creates a new space.The Sublay user ID of the space creator, who becomes the initial admin.
Display name for the space.
URL-friendly identifier. Must be unique within the project. Generated from
name if omitted.Short description of the space.
Who can read content:
"anyone" (default) or "members".Who can post content:
"anyone", "members" (default), or "admins".When
true, join requests must be manually approved. Defaults to false.Makes this space a child of the specified parent space.
Arbitrary metadata attached to the space.
Promise<Space>
fetchSpace
Fetches a space by its Sublay ID, including member counts and permission details.The Sublay space ID.
Promise<SpaceDetailed>
fetchManySpaces
Fetches a paginated list of top-level spaces, with optional text search.Page number (1-indexed). Defaults to
1.Results per page. Defaults to
20.Sort order:
"alphabetical", "newest", or "members".Filter spaces whose name matches the query.
Filter spaces whose slug matches the query.
Filter spaces whose description matches the query.
Filter spaces matching the query across name, slug, or description.
When
"true", returns only spaces the requesting context is a member of.Filter to children of a specific space, or pass
"null" for top-level spaces only.Comma-separated list of associations to populate.
Promise<PaginatedResponse<Space>>
fetchSpaceBySlug
Fetches a space by its unique slug.The space’s URL slug.
Promise<SpaceDetailed>
fetchSpaceByShortId
Fetches a space by its short, human-readable ID (used in share URLs).The space’s short ID.
Promise<SpaceDetailed>
fetchUserSpaces
Fetches the spaces a specific user is a member of.The Sublay user ID.
Page number (1-indexed). Defaults to
1.Results per page. Defaults to
20.Sort order:
"alphabetical", "newest", or "members".Filter by the user’s role in the space. A single role or comma-separated list, e.g.
"admin,moderator".When
"true", returns the full set of spaces rather than only the paginated page.Comma-separated list of associations to populate.
Promise<UserSpacesResponse>
updateSpace
Updates settings on an existing space.The Sublay space ID to update.
New display name.
New slug. Must be unique.
New description.
Updated reading permission:
"anyone" or "members".Updated posting permission:
"anyone", "members", or "admins".Updated metadata. Merged with existing values.
Promise<Space>
deleteSpace
Permanently deletes a space and all its content.The Sublay space ID to delete.
Promise<DeleteSpaceResponse>
checkSlugAvailability
Checks whether a slug is available for use.The slug to check.
Promise<{ available: boolean }>
fetchChildSpaces
Fetches the direct child spaces of a given parent space.The parent Sublay space ID.
Page number (1-indexed). Defaults to
1.Results per page. Defaults to
20.Sort order:
"alphabetical", "newest", or "members".Comma-separated list of associations to populate.
Promise<PaginatedResponse<Space>>
fetchSpaceBreadcrumb
Returns the full ancestor chain from the root down to the specified space. Useful for rendering breadcrumb navigation.The Sublay space ID to get the breadcrumb for.
Promise<SpaceBreadcrumb>
