> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wellapp.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# List Workspaces

> Query workspaces with filtering and sorting — including across related objects.

Workspaces are listed through the records query: `POST /v1/records/query` with `root: "workspaces"` (a dedicated `GET /v1/workspaces` list endpoint is planned). It accepts the full `filters` / raw `whereClause` and `orderBy` model — see [Filtering & sorting](/api-reference/filtering-and-sorting) for the operator set and pagination notes.

## Filtering & sorting on related objects

Filter and sort on a **related (included) object** by nesting into the relationship — the same relationships you pass to `include`.

* **To-one** relations nest directly: `{ "issuer": { "name": { "_eq": "Acme" } } }`, and sort by a dot-path: `"orderBy": { "field": "issuer.name", "direction": "asc" }`.
* **To-many** relations must be quantified with `_some`, `_every`, or `_none`: `{ "items": { "_some": { "quantity": { "_gt": 1 } } } }`. They are **not** directly sortable (a to-many sort needs an aggregate proxy).
* **Composite** `composite_*` columns are virtual — filter and sort on their underlying source fields, not on the composite.

Workspace row-level security applies at every hop, so a related-object filter never widens your tenant scope. Full operator set, deep-nesting rules, and pagination notes: [Filtering & sorting](/api-reference/filtering-and-sorting).

This resource's related objects (the ones you can `include`) and how to filter or sort on each:

| Relationship                    | Cardinality                              | Filter on a field                                                        | Sort by a field                                         |
| ------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------ | ------------------------------------------------------- |
| `media`                         | to-one (media)                           | `{ "media": { "file_name": { "_eq": … } } }`                             | `"field": "media.file_name"` ✅                          |
| `parent_workspace`              | to-one (workspace)                       | `{ "parent_workspace": { "name": { "_eq": … } } }`                       | `"field": "parent_workspace.name"` ✅                    |
| `own_company`                   | to-one (company)                         | `{ "own_company": { "name": { "_eq": … } } }`                            | `"field": "own_company.name"` ✅                         |
| `child_workspaces`              | to-many (workspace)                      | `{ "child_workspaces": { "_some": { "name": { "_eq": … } } } }`          | aggregate proxy only ⚠️                                 |
| `memberships`                   | to-many (membership)                     | `{ "memberships": { "_some": { "role": { "_eq": … } } } }`               | aggregate proxy only ⚠️                                 |
| `webhooks`                      | to-many (webhook)                        | `{ "webhooks": { "_some": { "field_name": { "_eq": … } } } }`            | aggregate proxy only ⚠️                                 |
| `workspace_accounting_settings` | to-one (workspace\_accounting\_settings) | `{ "workspace_accounting_settings": { "field_name": { "_eq": … } } }`    | `"field": "workspace_accounting_settings.field_name"` ✅ |
| `workspace_providers`           | to-many (workspace\_provider)            | `{ "workspace_providers": { "_some": { "field_name": { "_eq": … } } } }` | aggregate proxy only ⚠️                                 |

Replace `field_name` with any field of the related object. See its object-reference page for the full field list.

**Filter by a to-one relation** (and sort by it):

```json theme={null}
{
  "root": "workspaces",
  "whereClause": { "media": { "file_name": { "_ilike": "%acme%" } } },
  "orderBy": { "field": "media.file_name", "direction": "asc" }
}
```

**Filter by a to-many relation** (quantified — bare nesting is invalid):

```json theme={null}
{
  "root": "workspaces",
  "whereClause": { "child_workspaces": { "_some": { "name": { "_ilike": "%eu%" } } } }
}
```
