Page bodies
A card's body is a block document — validated on write, incapable of carrying HTML, and always readable as plain text too.
Every card has a body, and it is a document made of blocks — not a string of Markdown, not HTML.
Two columns, one rule
A card carries its body twice:
blocks— the document: an ordered list of typed blocks;body— the plain-text projection of that document, with no markers.
The rule for writing them is: never both.
Writing blocks sets the document and recomputes body from it. Writing body
sets the text and drops the document back to being derived from that text.
Reading is simpler: the API always returns both. A card written before block bodies existed has no stored document, and one is derived from its text on read — so no consumer ever has to know which régime a given card is in, and none has to parse Markdown to render content.
Block types
paragraph, heading, bulleted, numbered, todo, quote, callout,
code, divider, image, embed, bookmark, toggle, table, file,
table_of_contents, equation, view.
type is an open string in responses. The list above is what you can
write, and the API refuses anything else on write — but a body you read may one
day hold a type that did not exist when you wrote your renderer. Render an
unknown type degraded (its text, if it has one) rather than failing, and send
it back as it is if you save the document.
Every block has a stable id (a UUIDv7, preserved across writes) and an
indent between 0 and 5. Then, depending on type: text for textual blocks,
level for a heading, checked for a todo, code and language for code, and
fileId plus alt for an image, url (plus embedUrl and provider) for an
embed, url plus an optional title and description for a bookmark,
rows and headerRow for a table, fileId and alt (plus name,
contentType and size) for a file, expression for an equation, and
viewId plus an optional title for an embedded view.
Text is spans, not markup
A textual block's text is a list of spans: a string plus its marks.
{
"type": "paragraph",
"text": [
{ "text": "See the " },
{ "text": "reference", "link": "https://cms.spunto.net/api/docs" },
{ "text": " for details. " },
{ "text": "Required.", "bold": true }
]
}The marks are bold, italic, code, strike and link. A link is an
absolute http, https or mailto URL.
A span can also be a mention of another card — { "text": "Login bug", "mention": "<card id>" }. See mentions.
There is nothing to sanitise
The format cannot express HTML. Not "HTML is stripped" — there is no place to put it. A span is a string and a set of boolean marks, and the closed list of block types is enforced when written.
That is the whole reason for the shape. A Markdown or HTML body would have made every consumer responsible for sanitising the same content, correctly, forever.
Images are identifiers
An image block carries a fileId, never a URL.
Files have no shareable address in this product at all — the bytes are served by the API from a scoped route, with the same authorisation as everything else. Each consumer composes the URL it knows how to serve. See files and attachments.
alt doubles as the caption, and it is what lands in the text projection.
Embeds are an allowlist
An embed block shows a video, a design or a code sandbox inside the card. You
write the address of the page — { "type": "embed", "url": "https://youtu.be/…" } —
and the API accepts it only from YouTube, Vimeo, Loom, Figma, Google Docs,
Google Sheets, Google Slides, CodeSandbox or CodePen, over https. Anything
else is a 400 that lists them — for any other page, write a
bookmark.
A Google document is shown through its /preview page, never /edit: the
frame shows what the reader may see on Google's side. A document shared
with "anyone with the link" shows for everyone; a restricted one shows only to
readers signed in to a Google account that has access, and Google's own
"access denied" page to the others. Nothing about Google sharing passes through
Spunto. A document published to the web (/d/e/2PACX-…/pub) is shown through
its published player.
The API then adds two fields you never write: provider, and embedUrl, the
address of the provider's player. That is the one to put in an <iframe>;
the API computes it on every write, so a consumer never rebuilds a player URL
itself, and whatever a client sends for those two fields is ignored. To check a
link before writing it, GET /workspaces/{workspaceId}/embeds/resolve?url=…
answers with the same rule. The text projection of an embed is its url.
The document still holds no markup: an embed is an address from a closed list, not an iframe.
Bookmarks: any other page
A bookmark block is a link card — title, description, domain — for a page
that is not on the embed list: { "type": "bookmark", "url": "https://…", "title": "…" }. Nothing is loaded in the card; it is a link that opens in a new
tab. title and description are plain text, capped at 300 and 1,000
characters, and both are optional (without a title, the domain is shown).
POST /workspaces/{workspaceId}/link-previews { "url" } tells you what a pasted
address would become: an embed (computed without loading anything) or a
bookmark, with the page's title and description when the API could read them.
Reading a page from the server is guarded: only public addresses, checked
after DNS resolution and again at every redirect (so no localhost, no
private network, no cloud metadata endpoint), ports 80 and 443 only, 4 seconds
and 512 KiB at most, HTML only. A page that cannot be read — or that it refuses
to read — still gives a bookmark, just without a title. It happens once, when you
paste; opening a card never makes the server fetch anything.
The text projection of a bookmark is its title and its address.
Toggles
A toggle block is a line you click to show what is under it. Its own text is
the line; its content is the blocks that follow it with a greater indent —
the same rule that nests a list item, so there is no children field.
Open or closed is not in the document: it is a reading state, each reader's
own, and every toggle starts closed. Storing it would make each click a write.
The content of a closed toggle is still in blocks and in the text projection —
it is hidden, not removed.
Tables
A table block is rows × columns of text: rows is a list of rows, each a list
of cells, each cell a list of spans — marks and
links, but no mention, and never a block inside a cell. headerRow: true makes
the first row a header.
{
"type": "table",
"headerRow": true,
"rows": [
[[{ "text": "Plan" }], [{ "text": "Price" }]],
[[{ "text": "Team", "bold": true }], [{ "text": "€20" }]]
]
}A table is rectangular — every row has the same number of cells, or the write is
a 400 — with at most 200 rows and 20 columns. Its text projection is one line
per row, cells separated by a tab.
Files: video, audio, PDF
A file block shows an attachment of the workspace inside the card:
{ "type": "file", "fileId": "…", "alt": "The demo" }. Like an image, it is an
identifier, never a URL, and the file must belong to the workspace (a 400
otherwise; a file deleted later does not stop the card from saving).
The API then adds three fields you never write, copied from the file on every
write: name, size, and contentType — the type the API serves. That is
what picks the rendering: video/* plays in a <video>, audio/* in an
<audio>, application/pdf opens in the browser's viewer, anything else is a
download. The content route answers byte Range requests, which is how a video
player seeks (files). alt is the caption; the
text projection is the caption and the name.
Table of contents and equations
A table_of_contents block carries nothing: it is derived from the document's
headings when it is rendered, so renaming a heading updates it without a write.
An equation block carries expression, the raw LaTeX source of a display
equation (5,000 characters at most) — { "type": "equation", "expression": "e^{i\\pi} + 1 = 0" }. Rendering it is the reader's job, like highlighting a
code block: the app uses KaTeX. Its text projection is the source. There is no
inline equation.
In Markdown
When a body is written as text (body, which is also what an
AI assistant writes), three forms become these blocks: a GFM
table (header row, dash row, then rows), a $$ … $$ block, and a line that is
just [TOC]. They are also how an assistant reads them back.
Mentions: cite a card by its id
In the editor, @ or [[ opens a search of the workspace's cards; picking one
writes a span that carries the card's id:
{ "text": "Login bug", "mention": "0190a1b2-…" }The id is checked on write — a card of this workspace, or a 400. That
covers a card from another workspace too: it simply cannot be found from here.
A mention already in a document keeps saving after its card is deleted.
text is a snapshot of the title at the time of writing. It is what lands in
the text projection and what a client that ignores mentions shows — but not
what you should render. ItemDetail.mentions lists every cited card with its
current key (SPR-12), title, icon and homeCollectionId, so the
mention follows a rename without the citing card being rewritten. A card that
is not in that list was deleted: render it neutrally, not with the snapshot.
With ?version=published, only published cards are resolved, with their
published title — a site never reads a draft's title through a mention.
Mentioning a person
@ also proposes the workspace's members, first. Picking one writes a
span that carries their user id:
{ "text": "@Camille", "person": "0190a1b2-…" }The id must be a member of the workspace (400 otherwise) — checked for
new mentions only, so a body that names someone who has since left keeps
saving. text is the readable snapshot (@Camille): it is what a client that
ignores person mentions shows, and what lands in the text projection. A span
is a link, a card mention or a person mention — one of the three. Mentioning
someone notifies them, once per card.
Backlinks: who mentions this card
The other way round: GET /workspaces/{workspaceId}/items/{itemId}/backlinks
lists the cards whose body mentions this one, from every list of the
workspace, with the same current key, title, icon and
homeCollectionId. Archived cards are left out, a card mentioning itself does
not count, and mentioning a card twice in the same body makes one backlink.
The page is keyset-paginated (cursor, limit), and total counts them all
whatever the page. For an app, it is an items:read route.
Backlinks follow the draft body: they change as soon as a card is saved, not when it is published. In the app, they appear among the card's native fields, folded: "3 backlinks", which opens on the list.
Embedded views
A view block places, in the middle of a document, a saved view of a list
in the same workspace — the “Roadmap” page that shows, under its text, the board
of the tasks in progress. In the editor: /, then “View of a list”, a list, one
of its views.
{ "type": "view", "viewId": "0190a1b2-…", "title": "In progress" }The block only holds the view's identity, never its definition: it shows what
the view selects today, and renaming it, filtering it differently or deleting it
shows everywhere it is placed. viewId is checked on write — a view of this
workspace, or a 400; a view already in the body keeps saving after it is
deleted. title is a snapshot of its name, used only by the text projection
(Vue : In progress) and by clients that do not resolve the view.
ItemDetail.views lists every placed view with its current name, kind,
collectionId and list name. A view missing from that list was deleted: show
“view deleted”. For its cards, query it like any view —
POST …/collections/{collectionId}/query with its
definition (read from GET …/collections/{collectionId}): that is what the app
does, and what a site should do.
With ?version=published, the block comes out as it is. A view has no draft:
the card publishes the block, not the cards it shows. A site that wants them
queries the view with version: "published", and then only gets published cards.
Bodies are not in list results
Item — what a page of a view returns — has no body.
Only ItemDetail carries body and blocks, and only the routes that return a
single card use it. A 50-row view does not fetch 50 documents.
Neither body nor blocks can be sorted or filtered on in a view. Bodies are
found through workspace search instead: it reads
body, the plain-text projection of the blocks, in full text, and returns an
excerpt around the match.
List automations and buttons
Rules of a list — "when the status becomes Done, then…" — that run inside the write that triggers them, under their own name, and buttons that run the same actions as whoever clicks.
Using the API
Base URL, credentials, errors and the generated client — everything that is true of every route before you pick one.