Querying content
Reading cards with a view definition — filters, sorts, cursors, grouped pages, counts and search.
Reading content means sending a view definition and getting a keyset page back.
It is a POST rather than a GET because a filter is a tree, and a tree does
not survive a query string in any form worth reading. Despite the verb, these
routes only read — which is exactly why the scope table that governs installed
apps names them one by one instead of guessing from the method.
A page of cards
POST /workspaces/{workspaceId}/collections/{collectionId}/query{
"definition": {
"filter": { "op": "eq", "field": { "fieldId": "sys:status" }, "value": "<statusId>" },
"sort": [{ "field": { "fieldId": "sys:order" }, "direction": "asc" }],
"includeSecondaryLists": true
},
"cursor": null,
"limit": 50
}limit defaults to 50 and caps at 200. The response is:
{ "rows": [ /* Item */ ], "nextCursor": "…" }Loop until nextCursor is null, passing it back as cursor each time.
Items in a page have no body
rows are Item, and Item has no body and no blocks. Fetch a single card
with GET /workspaces/{workspaceId}/items/{itemId} to get ItemDetail, which
does. A page of 50 rows does not carry 50 documents.
Filters
A filter is either a predicate or a boolean node:
{ "and": [ <filter>, <filter> ] }
{ "or": [ <filter>, <filter> ] }A predicate names a field and an operator:
| Operators | Shape |
|---|---|
eq neq lt lte gt gte | { op, field, value } |
contains starts_with | { op, field, value } — string value |
in not_in | { op, field, values } — array |
is_empty is_not_empty | { op, field } |
A field is { "fieldId": "…" } — either a registry property's id, or a system
field like sys:title, sys:status, sys:order or sys:created_at. The
collection publishes both lists, so a client never has to hard-code them.
Three behaviours that are easy to get wrong from the outside, and are settled here:
neqkeeps the empties. It compiles tois distinct from, so a card with no value for the property still matches "different from X". Anything else surprises everyone who tries it.containsandstarts_withare literal.%and_in your value are escaped. A search term is data, not a pattern.inwith an empty list matches nothing;not_inwith an empty list matches everything. Which is the reading that lets you build a filter from a selection without special-casing zero.
On an array property (multi_select, multi_person, multi_file, relation), eq and contains both
mean containment, neq means "does not hold this one", and in / not_in are
an or-chain of containments. Anything else is a 400 with a message that names
the three that work.
A rollup compares like a number (or a date, for min/max of dates) and
sorts like one; contains and starts_with are a 400, and so is grouping by it.
Each item of the list computes its value on the fly — see the
cost.
A formula filters and sorts by the type it returns (config.formula.resultType):
a number or a date compares, a text can also be searched (contains,
starts_with), a checkbox is true or false. Grouping by it is a 400. A
formula that became invalid (a property it reads was deleted) is empty on every
item — is_empty finds them all, and the view still answers. See
formulas.
Sorts
sort is an ordered list of { field, direction }, asc or desc.
Array properties cannot be sorted on, and asking returns a 400 rather than an
arbitrary ordering. Sorting a select is alphabetical, not by option
order — a known sharp edge.
Cursors
A cursor encodes the position and the sort it was issued for. Sending one back with a different sort fails loudly rather than returning a plausible wrong page.
Do not parse them. Do not build them. The one thing they promise is that handing one back gets you the next page of the same query.
Grouped reads
Two routes serve the grouped layouts, both compiling the same definition — which is what makes the columns add up to the view:
POST …/group-counts — how many cards per group
POST …/grouped-query — a page per group, each with its own cursorBoth need a groupBy in the definition, and both return null as an ordinary
group key: the cards with no value.
grouped-query takes the groups you want rendered, in that order, even the
empty ones — a GROUP BY only returns values that have rows, and an empty
column still has to exist to be dropped
into (see why).
Omit it and you get the groups the data happens to contain.
limit there is per group, not per response, and defaults to 20. Each group
comes back with its own nextCursor and with count — the group's full size,
not the number of rows returned. Loading more of one column means sending that
group's cursor in cursors, keyed by group.
Aggregated reads
A chart does not need cards, it needs counts:
POST …/aggregate — a count, sum or average per value of an axis, in one queryIt takes the view's definition as is (filter, secondary lists, range,
version), plus an axis (fieldId, and a bucket — day, week or
month — on a date), an optional stackBy, and a measure (count, or sum /
avg with the fieldId of a number property). The view's own groupBy is not
used.
Like grouped-query, it takes the groups you want, in order, even the empty
ones; values the data holds beyond those follow, so the buckets always add up
to total. Each bucket has count (cards) and value (the measure — null for
an average with no value), and, with stackBy, one cell per series in stacks.
The same refusals as grouping apply: no axis on a multi_select, a
multi_person or a relation. Apps call it with items:read.
The chart layout.
Date windows
Both query and grouped-query accept a range — the window a calendar or a
timeline is looking at. It is added to the view's filter, never saved with it:
{ "range": { "field": { "fieldId": "<date fieldId>" }, "endField": { "fieldId": "<date fieldId>" }, "from": "2026-11-01", "to": "2026-11-30" } }from and to are both included. Without endField, a card is in the window
when its date falls in it; with one, when its span overlaps it (a missing
end, or one before the start, counts as one day). field must be a date
property or sys:created_at; anything else is a 400, and so is a window that
ends before it starts. A date property with config.range carries its own
end: without endField, its ranges overlap the window exactly like a span
between two properties would. For a month grid, group by the same date field and pass
the grid's days as groups — the range narrows the counts too.
Index hints
POST …/index-hintsGiven a view definition, the API reports which indexes would serve it well, each with the reason it is wanted. It is the honest answer to "why is this view slow" — a filter on a JSON property with no expression index behind it reads very differently from one with.
Described, not created
This route reports. It does not create anything: the job that would apply the hints does not exist yet.
Search
GET /workspaces/{workspaceId}/search?q=…&limit=…Search crosses every list in the workspace and returns two arrays, never mixed: matching cards and matching collections.
Cards come in this order, 20 at most:
- an exact readable key (
DOC-12) brings that card to the front, even if nothing else matches; - cards whose title contains the query — anywhere, even mid-word;
- cards whose body contains it, in the places titles left. Body search is
full text: every word you type must appear, each one as the start of a
word (
paginfinds “pagination”), in any order, accents ignored (editeurfinds “éditeur”). There is no stemming, in any language.
Within each tier, the most recent card comes first. A card found by its body
carries a snippet: the passage around the match, as segments, each with a
highlight flag — never HTML, so there is nothing to sanitize before
displaying it:
{
"id": "…",
"key": "DOC-12",
"title": "Monday meeting",
"snippet": {
"segments": [
{ "text": "we decided to move the ", "highlight": false },
{ "text": "editor", "highlight": true },
{ "text": " to blocks before the end of the quarter", "highlight": false }
]
}
}snippet is optional: cards found by their key or title have none. The excerpt
is taken from the first 10,000 characters of the body; a match further down is
still found, and its excerpt then shows the start of the body.
Also:
- archived cards are excluded, and the draft is searched, not the published version;
- your query is data:
%and_are escaped, and full-text operators (&,|,!,:*) are plain characters; - comments and property values are not searched.
It does not go through the view compiler: it carries no filter, no sort, and no cursor. Putting it there would have required a virtual field nothing else uses — which is also why views cannot filter on a body (limits).