Spunto CMS
Concepts

Saved views

A view is data — a filter tree, sorts and a group-by — compiled to SQL in one place. What it selects, and what it only changes about looking at it.

A view is a saved way of looking at a collection. It is made of two halves that are deliberately kept apart:

  • definition — what the view selects: a filter tree, sorts, an optional group-by, and whether to follow secondary list attachments;
  • display — how it is looked at: the order of board columns, and which fields the view shows (columns) — a table's column order, widths and hidden columns, and the same order and hidden fields for the cards of a board or a list. One setting per view, whatever its kind.

Moving, widening or hiding a column changes display. It cannot make a single card enter or leave the result, because it never reaches the part that selects.

`display` is replaced wholesale

Saving one half means sending the other back. A client that saves column widths without returning groupOrder erases the board's column order.

A definition is data, not SQL

{
  "filter": {
    "and": [
      { "op": "eq", "field": { "fieldId": "sys:status" }, "value": "<statusId>" },
      { "op": "contains", "field": { "fieldId": "<fieldId>" }, "value": "draft" }
    ]
  },
  "sort": [{ "field": { "fieldId": "sys:order" }, "direction": "asc" }],
  "groupBy": { "fieldId": "sys:status" },
  "includeSecondaryLists": true
}

No SQL fragment can enter a view — not a snippet, not an expression, not a column name. A definition is a serialisable tree, which is what makes it storable, sendable, diffable, and executable somewhere other than where it was written.

It becomes SQL in exactly one place in the codebase. That is a deliberate constraint: it is what makes it possible to route a view to a different read backend one day without touching a single screen.

Kinds

A view has a kind: table, board, list or calendar.

The kind does not change what the view selects. It changes the layout, and for the grouped kinds it changes which route you call.

The interface renders all four. A calendar view has three layouts — month, week and timeline —, a list view two — stack and gallery —, and a table view two — grid and chart —, chosen in its display, not as extra kinds.

Calendar and timeline

A calendar puts cards on a date property (or on sys:created_at, read-only). Which date, and which layout, live in display.calendar:

{ "calendar": { "layout": "month", "dateField": "<date fieldId>", "endField": "<date fieldId>" } }

Like the column settings, this is looking, not selecting: the definition is untouched, and the same view shown as a table selects the same cards. The month being looked at is not saved anywhere — it travels with each read as a range:

{
  "definition": { "...": "the view's definition, plus groupBy on the date" },
  "groups": ["2026-10-26", "2026-10-27", "…", "2026-12-06"],
  "range": { "field": { "fieldId": "<date fieldId>" }, "from": "2026-10-26", "to": "2026-12-06" }
}

A month is therefore a grouped read by day: each cell is a group, empty ones included, each with its own cursor — "+3 more" loads the rest of that day. The range is compiled by the API and narrows both rows and counts.

With an endField, a card is a span, and it is returned by every window it overlaps: a draft started on October 28 and due on November 4 is in both months. A missing end, or an end before the start, counts as a one-day span.

A date property with config.range is a span on its own: its { start, end } values overlap windows the same way, no endField needed. On the month and week grids they are drawn as continuous bars across the days they cover, cut at the edges of each week; the cells hold the cards without an end. The interface asks for each half with field.part: "end" (is_empty for the cells, is_not_empty for the bars), so the two add up to the view. When the property carries a time (config.includeTime), the week layout is laid out in hours, in the reader's time zone; the month grid keeps UTC days, like group keys.

In the interface, dragging a card to another day writes its date — keeping its time and its length —, dropping it on the No date panel clears it, and clicking an empty part of a day creates a card that is born with that date. On the timeline, dragging a bar shifts both ends, pulling an edge writes only that edge, and clicking the track of an undated card places it.

Why the timeline is not a `kind`

kind is part of every view in every response. The iOS app decodes responses strictly: a value it does not know would make it fail to open the whole list. calendar has been in the enum since the start, so the timeline is a layout of it — and older apps simply show it as a table.

A gallery is a grid of cards: image, icon and title, then the fields the view shows (display.columns). It is the natural view of a content catalogue. It is a list view whose display.list says so:

{
  "list": {
    "layout": "gallery",
    "cardSize": "medium",
    "imageFit": "cover",
    "imageField": "sys:cover"
  }
}
  • cardSize — small, medium (default) or large. A minimum width: the grid fits as many columns as it can, then stretches them.
  • imageFit — cover (default) crops the image to fill the card, contain shows it whole.
  • imageField — sys:cover (default, the card's cover), sys:none (no image), or the fieldId of a file property. A file is shown only when the API serves it as an image (File.image).

A gallery reads what the stack reads. Grouped, it keeps the stack's sections (grouped-query), and dragging a card into another section writes the grouped value. Ungrouped, it is one grid read with /query. In both cases, dragging within a section writes the manual order, and an empty card at the end of each section creates one. Rows outside the screen are not rendered.

Why the gallery is not a `kind`

For the same reason as the timeline: kind is an enum in every response, and the iOS app decodes strictly. An app that does not know display.list shows the gallery as a stack — the same cards, in the same sections (as a table when it is ungrouped).

Chart

A chart counts the cards a view selects — or sums or averages a number property — per value of an axis. It is a table view whose display says so:

{
  "table": { "layout": "chart" },
  "chart": {
    "type": "bar",
    "xField": "<fieldId of Team>",
    "stackField": "sys:status",
    "measure": { "op": "sum", "fieldId": "<fieldId of Points>" }
  }
}
  • type — bar (default, vertical), pie, donut or line.
  • xField — the axis: sys:status (default), sys:publication, sys:created_at, or a property that can be grouped. Not a multi_select, a multi_person or a relation: a card with two tags would be in two bars, and the bars would no longer add up to the view.
  • bucket — on a date axis: day (default), week (starting Monday) or month. A line chart needs a date axis.
  • stackField — bars only: a second axis, stacked within each bar.
  • measure — count (default), or sum / avg of a number property. A card without a value counts as zero in a sum and is left out of an average.

The chart reads POST /workspaces/{id}/collections/{id}/aggregate, with the view's definition as is: same filter, same secondary lists. The axis is the chart's own, not the view's groupBy. It is one query, whatever the number of bars, and it returns counts, not cards:

{
  "definition": { "filter": { … }, "sort": [], "includeSecondaryLists": true },
  "axis": { "fieldId": "<fieldId of Delivery>", "bucket": "month" },
  "groups": ["2026-09-01", "2026-10-01", "2026-11-01"],
  "measure": { "op": "count" }
}

Like a board's columns, bars come from the domain: groups names the bars you want, in order, and they come back even when empty — a status with no card gets its bar, at zero. Values the data holds beyond those you named follow after, so total — what the bars add up to — is always the view. A date bucket's key is the first day of its period (2026-10-01 for October).

Clicking a bar shows the table of the same view with that bar's filter added (eq on the value, a gte/lt range for a period, is_empty for "no value"): the cards it counts, editable in place. Nothing is saved; "Back to the chart" returns. Colours come from the axis when it declares them — a status's colour, a select option's — and from the brand ramp otherwise.

Why the chart is not a `kind`

For the same reason as the gallery: kind is an enum in every response, and the iOS app decodes strictly. An app that does not know display.table shows the table — exactly the cards the chart counts.

Grouping, and why columns come from the domain

A board column is the view, plus one group value. Same compiled SQL, one extra predicate — which is what makes the columns add up to the view exactly.

Two consequences you will meet immediately:

Each group paginates on its own. POST …/grouped-query returns groups, each with its own cursor. Slicing a flat page into columns client-side would fill three columns at the mercy of the sort order and leave "load more" on a single column inexpressible.

The caller names the groups it wants. A GROUP BY only returns values that have rows, so an empty "Done" column would not exist — and you cannot drop a card into a column that is not rendered. The caller passes the groups, because only the caller knows the workspace's statuses, a select's declared options, or the member list.

So an axis you cannot write accepts no drops: dropping a card is a write, not a gesture of arrangement.

Group keys must survive a round trip

A group key comes out of one query as ::text and goes back into another to find that group's rows. If it doesn't re-read in the type of the expression, the column shows "12" in its header and zero rows underneath — with no error anywhere. This is why grouping by sys:created_at groups by day of creation, in UTC: read as is, the column is a timestamp whose key would not re-read as a date, and every card would get its own group. The day round-trips, and it is what a calendar of creations needs.

Manual order is global to the list

sys:order is one ordering per collection, not one per column.

So dropping a card at the top of a board column also puts it on the first row of the table view. Notion keeps a separate order per group; here there is one, and it shows. If that surprises you, it is the documented behaviour rather than a bug.

One consequence that was applied on purpose: dropping into an empty column writes no order at all. The card will be first there regardless, and writing one would have catapulted it to the top of the entire list.

The default view

A collection with no saved views is not unreadable. The API publishes CollectionDetail.defaultView: manual order, grouped by status, secondary lists included.

It is published rather than copied into each client for a reason — see collections and cards.

Sorting and paging

Pagination is keyset only. There is no OFFSET anywhere in the API, and no way to ask for one: the cursor is opaque, you pass back what you were given.

That is measured, not aesthetic — around page 12 000, the offset form took 348 ms where the keyset form took 3 ms.

A cursor is bound to the sort it was issued for. Change the sort, start again; the API will tell you rather than silently return a wrong page.

Details in querying content.

On this page