Skip to main content
List Workspaces
Returns a paginated list of the caller’s workspaces. By default that is every workspace the caller can open — every workspace Fetch Workspace would return for them. With relation=direct it is only the workspaces they own or have a member row on. Every row carries reasons: why the caller can open it.

Query Parameters

string
Which workspaces the list holds:
  • reachable (the default): every workspace the caller can open. That is a workspace they own, one they have a member row on, one under a workspace they own (at any depth, whatever the inherit flags say), and one a capability they hold on an ancestor reaches through an unbroken chain of inheritsFromParent: true.
  • direct: only the workspaces the caller owns or has a member row on.
Left out or sent empty: reachable. Values match exactly. null and undefined are refused with 400 workspace/unsupported-param (see Saying “no value”); any other value returns 400 workspace/invalid-query.
string
The order, by creation time: desc (the default) newest first, asc oldest first. Rows created at the same moment are ordered by id in the same direction, so the order is the same on every request and pages neither repeat nor skip a row.A workspace can’t be moved to another parent, so a sub-workspace is always newer than its parent: asc lists every parent before its children. See Building a workspace switcher.Left out or sent empty: desc. Case is ignored (DESC works). null and undefined are refused with 400 workspace/unsupported-param; any other value returns 400 workspace/invalid-query.
number
Page number for pagination.
number
Page size.
string
Narrows the list by where each workspace sits in the tree:
  • none: top-level workspaces only (workspaces with no parent).
  • A workspace id: the caller’s workspaces directly under that workspace. An id that matches no workspace returns an empty page, not a 404.
  • any, left out, or sent empty: workspaces at every level. This is the default.
The filter applies within relation: a workspace id lists the direct sub-workspaces of that workspace that are in the caller’s list, and none lists the top-level workspaces in it. So none leaves out a sub-workspace the caller is a member of even when they aren’t in its parent; any includes it. It works with page, limit (the pagination counts reflect the filter) and include. null and undefined are refused with 400 workspace/unsupported-param (see Saying “no value”). none and any match exactly (ANY is refused). Any other value that isn’t a workspace id returns 400 workspace/invalid-query.
string
Include flags, as a comma-separated value or repeated params. The only value is memberCount: it adds a memberCount to every row — the workspace’s direct member count, the same number Fetch Workspace returns for one workspace, counting neither descendants nor reach-holders.It is resolved with a single grouped query over the page that was returned, so a workspace switcher showing counts costs one request rather than one per row. Omit the flag and the field is absent from each row — not null, not 0. Matching ignores case; an unknown value returns 400 workspace/invalid-query.
string
required
Service keys only — the user to act as, whose workspaces are listed and whose reasons each row carries. Required for a key: the list is defined as somebody’s workspaces, so a key that names nobody is refused with 400 workspace/missing-user-id.A user token always acts as its own user and must not send it (400 workspace/acting-user-not-allowed). See Acting on behalf of a user.

Response

Returns a paginated response of Workspace objects, each with reasons.
{ type, viaWorkspaceId? }[]
The caller’s full standing on the workspace, one entry per grant: owner, member, ancestor-owner (with the ancestor they own as viaWorkspaceId) and reach-holder (with the ancestor whose capability reaches here). These are the same entries, in the same order, that the authority read returns for that workspace. They describe all of the caller’s standing even under relation=direct: relation picks the rows, not the reasons, so a workspace the caller is a member of and also owns an ancestor of carries both member and ancestor-owner.
memberCount appears only when include=memberCount was sent. limit defaults to 20 when omitted, and page to 1.

Error Responses

A service key called this route without naming an actingUserId. The listing is scoped to a user’s own memberships and owned workspaces, so there is nobody to scope it to.
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.
A GET takes every field, actingUserId included, in the query string, so any request body is refused: a JSON object with keys, a non-empty array, or a non-JSON payload such as multipart (then params is omitted). An absent body and {} pass.
Returned when a service key names an actingUserId that isn’t a user in this project.
null and undefined as the value of parentWorkspaceId, relation or sortDir are rejected with the values to use instead, and param names the parameter. To use a default, leave the parameter out.
Returned with code workspace/invalid-query for a relation other than direct or reachable, or a sortDir other than asc or desc. relation values match exactly (Direct is refused); sortDir ignores case.
An include value outside memberCount. Matching ignores case.
This route declares page, limit, relation, parentWorkspaceId, sortDir, include and actingUserId, and refuses anything else rather than ignoring it. Two or more at once are named together: Unrecognized keys: "sort", "order". The two exceptions across the bundle are the cache-busters _ and _t, which are dropped before the request is read. See Shapes the server rejects.
See also: useWorkspaceList · useFetchManyWorkspaces · Fetch Mutual Workspaces