Skip to main content
Fetch Mutual Spaces
Returns a paginated list of spaces that both the authenticated user and another user are active members of — i.e. their spaces in common. Requires an authenticated user. Only spaces the authenticated user can see are listed; as an active member, they can see every space they share. Sub-spaces are counted in each space’s childSpacesCount only when the user can see them.

Path Parameters

string
required
The other user’s Sublay ID. Mutual spaces are computed between this user and the authenticated user.

Query Parameters

string
Service key only, and required with one: the user this request acts as, whose spaces are compared with the user in the path. A user token always acts as its own user and must not send it (400 space/acting-user-not-allowed).
number
Page number (1-indexed): a whole number, 1 or more. Defaults to 1. Any other value returns 400 space/invalid-query with param: "page".
number
Results per page: a whole number from 1 to 100. Defaults to 20. A larger value returns 400 space/invalid-query with param: "limit" (it is never lowered to 100), as does 0, a negative number or a value that isn’t a whole number. See Pagination.
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.

Response

Space[]
The spaces both users are active members of. Computed fields such as membersCount and isMember are populated from the authenticated user’s perspective.
object
Standard pagination metadata (page, pageSize, totalPages, totalItems, hasMore).

Error Responses

Returned when userId isn’t a valid UUID. Checked before sign-in, permissions and the endpoint’s other checks.
A service key sent no actingUserId.
Returned with code space/invalid-query for an unknown include value.
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.
See also: useFetchMutualSpaces