Skip to content

Documents API ​

Documents are the top-level containers for content in the CMS. Each document can contain multiple content instances.

A project's documents form one tree with a single root. To find it without knowing a uuid, start at GET /project, or read the row whose parent is null from the listing.

Create a Document ​

Create a new document.

Endpoint: POST /api/v1/document

Request Body:

FieldTypeNotes
titlestringRequired.
slugstring / nullOptional. One segment of the page's path. Omit it (or send null) to derive it from the title, once. A supplied slug is normalised like a generated one; one another document in the project already has is a 422.
parentuuidOptional. Document to nest under. A project's documents form one tree with a single root - omit this for the project's very first document, or to append under that existing root.
positionfirst/lastOptional, only meaningful with parent. Defaults to last.
revealAt / concealAtdatetimeOptional, nullable.
permissionsstringOptional. One of "600", "644", "664". Defaults to "664".
groupstringOptional. A role slug, or "project" for every member - the default. Needs the content.permissions ability.

A slug is set once. Generated from the title at create unless you supply one, it never follows a rename: fixing a typo in a page title does not move the page. Change it on purpose with slug on PATCH, or send slug: null there to regenerate it from the current title. Every document answers its slug and its path - ancestors' slugs and its own, joined with /, the root contributing nothing - and a render carries both under _document. Changing a slug rewrites the path of every page beneath it and every link pointing into that subtree; the old URLs are gone, so do it before launch or redirect on your side.

There's no component field either. A new document is empty, and reading one back returns just its _document metadata until you give it content. Which component sits at its root is decided by the first POST /content that names the document without a parent

  • and only the first, since a document holds exactly one top-level content root for its whole life. A second one is a 422.

That root is almost always a container: a component with a slot, so that everything else on the page composes into it (see Slots and refs). You don't have to write one to get started - a new project arrives with a Page component already in it, of exactly that shape:

json
{
  "title": "Page",
  "type": "object",
  "properties": {
    "title": { "type": "string" },
    "body": { "$ref": "http://access.flatnode.net/slot/body#" }
  }
}

It's an ordinary component with no special status, so rename it, add fields to it, or delete it and write your own. Nothing reads it back by name, and it counts toward your plan's schema limit like any other.

Example Request:

bash
curl -X POST "https://admin.flatnode.net/api/v1/document" \
  -H "Authorization: Bearer your-token-here" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "motorhead"
  }'

Response: 201 Created

json
{
  "message": "document created",
  "document": {
    "_uuid": "550e8400-e29b-41d4-a716-446655440000",
    "title": "My Document",
    "slug": "my-document",
    "published": false,
    "type": "document",
    "parent": "440e8400-e29b-41d4-a716-446655440007",
    "permissions": "664",
    "group": "project",
    "revealAt": null,
    "concealAt": null,
    "createdAt": "2026-11-08T09:12:44+00:00",
    "updatedAt": "2026-11-08T09:12:44+00:00",
    "treeLeft": 4,
    "treeRight": 5,
    "treeLevel": 1
  }
}

_uuid is the document's identifier everywhere else in the API.

published says whether the document has a live root version right now - promoted and inside its reveal/conceal window, in any language - which is the same rule Get a Document renders by. A new document is false until its root content is promoted. It is on every document row the API answers, so a consumer walking the tree knows which pages to build without rendering each one first.

permissions comes back in the same three-digit octal form the request accepts, so a document can be read and written back unchanged.

group is the one role the document belongs to, as a role slug - "project" means every member, and is what a new document gets. A document works exactly like a content block here; see Content Permissions for what the modes and the group mean together. group is null if the role it named has been deleted.

treeLeft/treeRight/treeLevel are the nested-set bounds. They are there so a consumer can tell a node's depth, and whether it has children at all, without a request per node: (treeRight - treeLeft) == 1 means a leaf. Treat them as read-only - the way to move a document is Move a Document Node.

The same object is returned by PATCH /document/{uuid} (unwrapped, as the whole body), by the duplicate endpoint, and for every node listed by GET /tree/{uuid}.

List Documents ​

Every document the caller may read, each in the shape shown under Create a Document. The root is the row whose parent is null; every other row names its parent, so the whole tree can be assembled from one response without walking GET /tree/{uuid}. A library's container document is left out, as it is from the tree.

Endpoint: GET /api/v1/document

Query parameters:

NameNotes
offsetThe page number, 1-based. Either offset or limit turns paging on; defaults to 1 when only limit is sent.
limitPage size, default 10. On its own it answers the first page.

Without either, the whole listing is answered and there is no pager.

bash
curl -X GET "https://admin.flatnode.net/api/v1/document?limit=50" \
  -H "Authorization: Bearer your-token-here"

Response: 200 OK

json
{
  "message": "OK",
  "pager": { "results": 2, "paginate": false, "first": 1, "last": 2 },
  "data": [
    {
      "_uuid": "550e8400-e29b-41d4-a716-446655440000",
      "title": "Home",
      "slug": "home",
      "published": true,
      "type": "document",
      "parent": null,
      "treeLevel": 0,
      "...": "..."
    },
    {
      "_uuid": "660e8400-e29b-41d4-a716-446655440001",
      "title": "About",
      "slug": "about",
      "published": true,
      "type": "document",
      "parent": "550e8400-e29b-41d4-a716-446655440000",
      "treeLevel": 1,
      "...": "..."
    }
  ]
}

If all you need is the root, GET /project answers it directly, along with the project's languages.

Changed

Until 2026-11-27 a row was {id, title} only, and ?limit= without ?offset= was a 422. A client reading id from this listing now wants _uuid.

Get a Document ​

Retrieve a document by ID. The response includes the document structure with all content.

Endpoint: GET /api/v1/document/{uuid}

Query parameters:

NameNotes
localeWhich language to render in. Only meaningful for a project that publishes in more than one; a locale the project does not publish in is a 422. See Translations.
richtextHow Rich text values are served: document (the tree, the default), html or text. Anything else is a 422. See Rich text values.

Example Request:

bash
curl -X GET "https://admin.flatnode.net/api/v1/document/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer your-token-here"

Response: 200 OK

The response structure depends on the content within the document. For a simple document with a single string value:

json
{
  "_value": "based",
  "_uuid": "ee0e8400-e29b-41d4-a716-446655440009",
  "_type": "component",
  "_component": "550e8400-e29b-41d4-a716-446655440000"
}

(_uuid is this content node's own uuid - what every /content/{uuid} endpoint takes - and _component is the uuid of the component SCHEMA it was built from. Both are uuids; they identify different things. A block also carries _entry: the uuid of the version wrapper above it, which is the same for every version of that block and is therefore what a single-entry reference stores. A block whose component has a handle also carries _handle - see Handles. Simplified examples below omit _type/_component for brevity. The real response also always includes _document: {title, slug, path}, omitted below for the same reason - see "Look Up by Path" next. On a multilingual project _document also carries the locale that was asked for, and each block carries the _locale it actually resolved to.)

List a Document's Versions ​

Every version of the document's root content, newest first, whatever its status. This is how to find content that is not live: new content starts as a draft, and a draft-only document renders as just _document above, so without this a caller that did not keep the _uuid from POST /content could not tell the document had content at all.

Endpoint: GET /api/v1/document/{uuid}/versions

Query parameters: locale (optional) - the language is_current is answered for, as for GET /document/{uuid}.

Requires content.read, like GET /content/{uuid}/versions: what is listed is content, and the response is the same. Each entry's _uuid is what every /content/{uuid} endpoint takes - edit it, promote it, or list its lineage from there.

bash
curl -X GET "https://admin.flatnode.net/api/v1/document/550e8400-e29b-41d4-a716-446655440000/versions" \
  -H "Authorization: Bearer your-token-here"

Response: 200 OK

json
{
  "message": "OK",
  "data": [
    {
      "_uuid": "ee0e8400-e29b-41d4-a716-446655440009",
      "_component": "550e8400-e29b-41d4-a716-446655440000",
      "locale": null,
      "status": "draft",
      "is_current": false,
      "created_at": "2026-11-26T09:12:00+00:00",
      "updated_at": "2026-11-26T09:12:00+00:00",
      "reveal_at": null,
      "conceal_at": null,
      "submitted_at": null,
      "approved_at": null,
      "rejected_at": null,
      "rejection_reason": null,
      "promoted_at": null,
      "withdrawn_at": null,
      "discarded_at": null
    }
  ]
}

An empty document answers "data": []. Slot children have their own lineages and are not listed here; a render carries each one's _uuid once it is live, and GET /content/{uuid}/versions lists its siblings.

Look Up by Path ​

Same response as GET /document/{uuid} above, addressed by the document's path - what every document resource answers, and what your site serves the page at.

Endpoint: GET /api/v1/document/by-path?path={path}

bash
curl -X GET "https://admin.flatnode.net/api/v1/document/by-path?path=about/team&locale=nb&richtext=html" \
  -H "Authorization: Bearer your-token-here"

Response: 200 OK, same shape as GET /document/{uuid}, with the same ?locale= and ?richtext=. An empty path is the project root. Leading and trailing slashes are ignored. An unknown path answers 404, and so does a page the token may not read - a path is guessable, so the two are deliberately the same answer.

Look Up by Slug ​

Same response as GET /document/{uuid} above, but addressed by the document's slug - one leaf segment, not a path - instead of its uuid.

Endpoint: GET /api/v1/document/by-slug/{slug}

bash
curl -X GET "https://admin.flatnode.net/api/v1/document/by-slug/motorhead" \
  -H "Authorization: Bearer your-token-here"

Response: 200 OK, same shape as GET /document/{uuid}, and it takes the same ?locale=.

Slug uniqueness is scoped per-project - two different projects (even under the same owner) can each have their own document titled, and therefore slugged, "Home" without either colliding into a numeric suffix. A duplicate title within the same project still gets one (home, home-1, home-2, ...) when the slug is generated; a slug you supply is refused instead.

For a document with an array:

json
{
  "_value": [
    "eins",
    "zwei",
    "drei"
  ],
  "_uuid": "ee0e8400-e29b-41d4-a716-446655440009"
}

For nested structures:

json
{
  "_value": [
    ["a", "b", "c"],
    ["1", "2", "3"]
  ],
  "_uuid": "ee0e8400-e29b-41d4-a716-446655440009"
}

Get Document Tree ​

Retrieve a document and its nested structure as a tree.

Endpoint: GET /api/v1/tree/{uuid}

Example Request:

bash
curl -X GET "https://admin.flatnode.net/api/v1/tree/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer your-token-here"

Response: 200 OK

Returns this document's direct children, each in the same shape as Create a Document - not the whole subtree. Walk down by calling this again for a child whose (treeRight - treeLeft) > 1, and skip a child whose published is false: it has nothing a public token can read, and GET /document/{uuid} would answer only its _document metadata.

A library's container document is filtered out, so what comes back is the editable page tree.

json
[
  {
    "_uuid": "660e8400-e29b-41d4-a716-446655440001",
    "title": "About",
    "slug": "about",
    "published": true,
    "type": "document",
    "parent": "550e8400-e29b-41d4-a716-446655440000",
    "permissions": "664",
    "group": "project",
    "revealAt": null,
    "concealAt": null,
    "createdAt": "2026-11-08T09:12:44+00:00",
    "updatedAt": "2026-11-08T09:12:44+00:00",
    "treeLeft": 2,
    "treeRight": 7,
    "treeLevel": 1
  }
]

An empty array means the document has no children.

Duplicate a Document ​

Copy a document and its entire subtree, inserted as a new last child alongside the original. Every descendant is deep-cloned with fresh uuids and slugs, content included.

Endpoint: POST /api/v1/document/{uuid}/duplicate

The project's root document cannot be duplicated - there is exactly one root per project, so there is nowhere structurally valid to put a copy of it. That returns a 422.

Example Request:

bash
curl -X POST "https://admin.flatnode.net/api/v1/document/550e8400-e29b-41d4-a716-446655440000/duplicate" \
  -H "Authorization: Bearer your-token-here"

Response: 201 Created

json
{
  "message": "document duplicated",
  "document": {
    "_uuid": "770e8400-e29b-41d4-a716-446655440002",
    "title": "My Document",
    "slug": "my-document-1",
    "...": "..."
  }
}

document is the new copy, in the shape shown under Create a Document.

Update a Document ​

Update an existing document. You can update the title and move a node within the document tree.

Endpoint: PATCH /api/v1/document/{uuid} or PUT /api/v1/document/{uuid}

Request Body:

json
{
  "title": "Updated Document Title"
}

permissions and group can be set here too, in the same form Create a Document accepts them. group needs the content.permissions ability even though the rest of this endpoint only needs document.update: handing a document to a role is governance, not an edit, so an editor renaming a page gets a 403 if they send one.

Move a Document Node ​

Move a document within the tree. You can either move it under a parent or relative to a sibling.

Move to the first or last child of a parent:

json
{
  "parent": "550e8400-e29b-41d4-a716-446655440000",
  "position": "first"
}
json
{
  "parent": "550e8400-e29b-41d4-a716-446655440000",
  "position": "last"
}

Move relative to a sibling:

json
{
  "insertBefore": "990e8400-e29b-41d4-a716-446655440004"
}
json
{
  "insertAfter": "990e8400-e29b-41d4-a716-446655440004"
}

Notes:

  • position is only valid when parent is provided.
  • insertBefore and insertAfter cannot be used together or with parent.

Example Request:

bash
curl -X PATCH "https://admin.flatnode.net/api/v1/document/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer your-token-here" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Updated Title"
  }'

Response: 200 OK

The updated document, in the shape shown under Create a Document. Unlike create, it is the whole body - no document wrapper:

json
{
  "_uuid": "550e8400-e29b-41d4-a716-446655440000",
  "title": "Updated Title",
  "slug": "my-document",
  "...": "..."
}

Delete a Document ​

Delete a document.

Endpoint: DELETE /api/v1/document/{uuid}

Example Request:

bash
curl -X DELETE "https://admin.flatnode.net/api/v1/document/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer your-token-here"

Response: 200 OK or 204 No Content