Overview
useFetchManySpaces returns a callable function for fetching multiple spaces. It supports searching by name, slug or description, filtering by parent space, and sorting.
For paginated, stateful lists with load-more support, use useSpaceList instead.
This is a discovery surface: a space is listed only if it and every space above it are
public, for every caller. unlisted and private spaces, and every space under one, are never listed here, not even to their members (whoever can see them reaches them by id, slug or short id). To list the spaces the current user is a member of, whatever their visibility, use useFetchUserSpaces. See Space visibility.Usage Example
Parameters
number
Page number to fetch. Defaults to
1.number
Number of results per page.
string
Sort order:
"createdAt" (when the space was created), "members" (by active member count) or "alphabetical" (by name). Defaults to "members".string
Direction,
"asc" or "desc", for any sortBy. Left out: A–Z for "alphabetical", otherwise newest / most first.string | null
Free-text search term, matched as a case-insensitive substring. A blank value is left out of the request, and
searchFields with it."slug" | "name" | "description" | null
The one field
query is matched against. Leave it out to match the slug, the name or the description.string | "none" | "any" | null
Which level of the space tree to return. A space id returns that space’s direct sub-spaces the viewer can see that are
public or that the viewer is an active member of — the same ones its childSpaces preview shows and its childSpacesCount counts; this is how to page through a space’s sub-spaces (add sortBy: "alphabetical" to order them A–Z by name). An id that matches no space returns an empty page, not a 404. "none" returns top-level spaces only. "any" returns spaces at every level. Left out or null: nothing is sent, so the API’s default applies: top-level spaces only."include-all" | "exclude" | "only"
Filter by each space’s
nsfwEffective (own flag OR any ancestor). "include-all" (default) adds no predicate; "exclude" drops effective-NSFW spaces; "only" returns only them. Because the filter keys off effective status, "only" may return an NSFW child whose safe parent is omitted — results are not guaranteed to form a contiguous tree. See Space NSFW flagging.SpaceIncludeParam
Optional. A single value or an array; the only value is
"files". Pass it to include avatar and banner file objects in each result.Returns
object
Pagination metadata including
page, limit, total, and hasMore.
