Skip to main content
Fetch My Spaces
Returns a paginated list of spaces a user has a membership in — the signed-in user, or with a service key the user named by actingUserId — along with their membership details for each space. Every space the user is an active member of is listed, whatever its visibility (public, unlisted or private), so this is the endpoint for a “my spaces” screen. A pending, banned or rejected membership of a space the user can’t see (a private space, or one under a private space they aren’t a member of) is left out, and doesn’t count toward the total; Fetch Spaces lists public spaces only. By default only active memberships are returned; use status to list pending join requests or spaces the user was banned from. query searches within the user’s spaces.

Query Parameters

string
Service key only, and required with one: the user this request acts as, whose spaces are listed. A user token always acts as its own user and must not send it (400 space/acting-user-not-allowed).
string
Membership status to list: "active" (default), "pending", or "banned"."pending" surfaces join requests still awaiting admin approval — useful for a “waiting to join” screen on spaces that have requireJoinApproval enabled.
number
Page number. Defaults to 1.
number
Results per page. Max 100.
string
Free-text search term, matched as a case-insensitive substring, the same way as on Fetch Spaces. Trimmed; a blank value returns 400 space/invalid-query. Leave it out for no text filtering.
string
The one field query is matched against: "slug", "name" or "description". Left out, query matches the slug, the name or the description. Values match exactly; any other value returns 400 space/invalid-query.
string
Sort order: "joinedAt" (when the user joined), "createdAt" (when the space was created), "alphabetical" (by name) or "members" (by active member count). Defaults to "joinedAt". Ties are broken by a stable order, so pages neither repeat nor skip a space.
string
Direction, "asc" or "desc" (either case), for any sortBy. Left out: A–Z for "alphabetical", otherwise newest / most first.
string
Filter by role. Single value ("admin", "moderator", "member") or comma-separated list (e.g. "admin,moderator").
string
Narrows the list by where each space sits in the tree. none lists the user’s memberships in top-level spaces only (spaces with no parent). A space id lists their memberships in that space’s direct sub-spaces; an id that matches no space returns an empty page, not a 404. any, left out, or sent empty: memberships at every level are listed. This is the default, because membership is per space. none and any match exactly (ANY is refused). null and undefined are refused with 400 space/unsupported-param (see Saying “no value”). Any other value that isn’t a space id returns 400 space/invalid-query.none goes by the space, not by what the user belongs to: a membership in a sub-space whose parent the user isn’t a member of is still not top-level, so none leaves it out. To show such a sub-space too, list every level and group the results yourself.
string
Associations to include, as a comma-separated value or repeated params. The only value is:
  • files — the processed avatarFile and bannerFile objects on each space (requires the files-images bundle)
Matching ignores case. An unknown value returns 400 space/invalid-query.
string
Pass "true" to return all memberships without pagination. When used, the response omits the pagination field.

Response

MySpaceItem[]
Each item contains a space and a membership object.
object
Standard pagination metadata.

Error Responses

Returned with no JSON body: 401 when no Authorization header is sent, 403 when the access token is invalid or expired.
sortBy=newest is rejected with a pointer to the two sorts it could mean: sortBy=createdAt (newest spaces first) or sortBy=joinedAt (the default, most recently joined first).
parentSpaceId=null and parentSpaceId=undefined are rejected with the spelling to use instead.
Returned with code space/invalid-query for invalid values — for example an unknown sortBy, sortDir, searchFields or include value, a blank query, or an actingUserId that isn’t a valid UUID. error names the first problem found.
A service key sent no actingUserId.
A user token sent actingUserId, even naming its own user. Only a service key names the user it acts as; a user token always acts as its own user.
Returned when a service key names an actingUserId that isn’t a user in this project.
The request sent userId. On this route the user a service key acts as is actingUserId.With a service key:
With a user token, or with no credentials:
GET /spaces/user-spaces is not a v8 route. It answers with a pointer to this endpoint.
See also: useFetchMySpaces