Skip to content

Content API ​

Content instances are created from components and stored within documents. Each content instance must reference both a document and a component.

Create Content ​

Create a new content instance in a document.

Endpoint: POST /api/v1/content

Request Body:

json
{
  "DocumentId": "550e8400-e29b-41d4-a716-446655440000",
  "ComponentId": "660e8400-e29b-41d4-a716-446655440001",
  "position": "first",
  "data": <value>
}

The data field should match the schema defined by the component. By default this is always validated and stored against the component's currently published schema version (see Component Versioning) - every ordinary piece of content created this way stays on whatever version was live at the time, even after the component is published forward again later.

A caller holding the content.component_version ability - admins, and any role granted it - may pass an additional componentVersion (integer) to create content against a specific unpublished draft version instead, to test a schema change before publishing it - rejected with 422 for anyone else, or if that component has no such version.

Examples:

String Content ​

json
{
  "DocumentId": "550e8400-e29b-41d4-a716-446655440000",
  "ComponentId": "660e8400-e29b-41d4-a716-446655440001",
  "position": "first",
  "data": "based"
}

A string field holds up to 255 characters. For anything longer the component declares the field as Long text or Rich text - see Text fields and their length.

Long Text Content ​

A field declared {"type": "string", "format": "text"} takes a string of any length, written exactly the same way:

json
{
  "DocumentId": "550e8400-e29b-41d4-a716-446655440000",
  "ComponentId": "660e8400-e29b-41d4-a716-446655440001",
  "position": "first",
  "data": {
    "title": "Chronik",
    "body": "A paragraph of any length, and as many of them as the page needs..."
  }
}

Rich Text Content ​

A field declared {"type": "string", "format": "richtext"} takes a document, not a string - a tree of blocks and marks, described in Rich text values. A string of HTML or Markdown is refused with a 422.

json
{
  "DocumentId": "550e8400-e29b-41d4-a716-446655440000",
  "ComponentId": "660e8400-e29b-41d4-a716-446655440001",
  "position": "first",
  "data": {
    "title": "Chronik",
    "body": {
      "type": "doc",
      "content": [
        {
          "type": "paragraph",
          "content": [
            { "type": "text", "text": "Founded in " },
            { "type": "text", "text": "1859", "marks": [{ "type": "bold" }] },
            { "type": "text", "text": "." }
          ]
        }
      ]
    }
  }
}

It reads back as the same tree.

Integer Content ​

json
{
  "DocumentId": "550e8400-e29b-41d4-a716-446655440000",
  "ComponentId": "660e8400-e29b-41d4-a716-446655440001",
  "position": "first",
  "data": 150
}

Array Content ​

json
{
  "DocumentId": "550e8400-e29b-41d4-a716-446655440000",
  "ComponentId": "660e8400-e29b-41d4-a716-446655440001",
  "position": "first",
  "data": [
    "eins",
    "zwei",
    "drei"
  ]
}

Array of Arrays ​

json
{
  "DocumentId": "550e8400-e29b-41d4-a716-446655440000",
  "ComponentId": "660e8400-e29b-41d4-a716-446655440001",
  "position": "first",
  "data": [
    ["a", "b", "c"],
    ["1", "2", "3"]
  ]
}

Object Content ​

json
{
  "DocumentId": "550e8400-e29b-41d4-a716-446655440000",
  "ComponentId": "660e8400-e29b-41d4-a716-446655440001",
  "position": "first",
  "data": {
    "firstName": "Chuck",
    "helpText": null
  }
}

Nested Array of Objects ​

json
{
  "DocumentId": "550e8400-e29b-41d4-a716-446655440000",
  "ComponentId": "660e8400-e29b-41d4-a716-446655440001",
  "position": "first",
  "data": [
    [
      {
        "firstName": "Chuck",
        "helpText": null
      },
      {
        "firstName": "André",
        "helpText": null
      }
    ],
    [
      {
        "firstName": "Wheeler",
        "helpText": null
      }
    ]
  ]
}

Content with Slots (Parent Parameter) ​

To add content to a slot, include a parent parameter:

json
{
  "DocumentId": "550e8400-e29b-41d4-a716-446655440000",
  "ComponentId": "770e8400-e29b-41d4-a716-446655440002",
  "parent": {
    "HostContentId": "550e8400-e29b-41d4-a716-446655440000",
    "Slot": "items"
  },
  "position": "first",
  "data": {
    "title": "Slot Item Title",
    "description": "Slot Item Description"
  }
}

Parameters:

  • parent.HostContentId - UUID of the content instance containing the slot
  • parent.Slot - Name of the slot (must match the $ref in the component schema)

A slot can be a mount: a reference to another block's slot rather than a container of its own, so that both blocks show one set of children. Writing into a mounted slot writes into the slot it mounts, and the response then carries a parent of its own naming where the child actually landed:

json
{
  "message": "OK",
  "data": { "_uuid": "…", "_type": "component", "…": "…" },
  "parent": { "HostContentId": "<the block whose slot was written>", "Slot": "items" }
}

parent is absent when the child went exactly where it was asked to. The same redirection applies to adding an instance to an array-of-slots field and to _moveTo.

For detailed information on slots and references, see the Slots & References documentation.

Example Request:

bash
curl -X POST "https://admin.flatnode.net/api/v1/content" \
  -H "Authorization: Bearer your-token-here" \
  -H "Content-Type: application/json" \
  -d '{
    "DocumentId": "550e8400-e29b-41d4-a716-446655440000",
    "ComponentId": "660e8400-e29b-41d4-a716-446655440001",
    "position": "first",
    "data": ["eins", "zwei", "drei"]
  }'

Response: 201 Created

The newly created content, rendered in the usual envelope - _uuid is what every other /content/{uuid} endpoint takes.

json
{
  "message": "OK",
  "data": {
    "_uuid": "770e8400-e29b-41d4-a716-446655440002",
    "_type": "component",
    "_component": "660e8400-e29b-41d4-a716-446655440001",
    "_value": ["eins", "zwei", "drei"]
  }
}

Get Content ​

Retrieve one version by its uuid - the _uuid a render or a versions listing reports, never the _entry wrapper above it.

What comes back depends on who is asking. An API token reads a version only once it is published: promoted, with its reveal/conceal window open right now. A draft, a version scheduled for later, a withdrawn or a discarded version answers 404 with Record not found. - the same answer as a uuid that does not exist or a node you may not read, so the existence of unpublished work is not confirmed either. The CMS's own editor session reads any version, which is what its version switcher runs on.

The rule is the one GET /document/{uuid} renders by, applied to the version you named. To find out which versions a lineage has and what state each is in, use List Versions: identifiers and status are not withheld, only values are.

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

Example Request:

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

Response: 200 OK

Returns the content data and metadata.

Building a site from webhooks

A content.created webhook names a draft, which this endpoint will not hand to you until it is promoted. Rebuild on content.promoted and content.withdrawn, and fetch through GET /document/{uuid} or a library's entries listing, both of which resolve what is live for you.

Update Content ​

Update an existing content instance using its UUID.

Endpoint: PATCH /api/v1/content/{uuid}

Request Body:

The request body should contain the fields to update. Use _value to update the main content value:

Update String Value ​

json
{
  "_value": "updated text"
}

A string field's new value may not exceed 255 characters. A longer one is refused with a 422 before anything is written, naming the field and the two kinds that do hold it.

Update Long Text Value ​

No different from a string, and no length limit:

json
{
  "_value": {
    "body": "...the whole page, however long it is..."
  }
}

Update Integer Value ​

json
{
  "_value": 75
}

Update Array Value ​

json
{
  "_value": [
    "updated",
    "version"
  ]
}

Update Nested Array ​

json
{
  "_value": [
    [
      "updated version"
    ]
  ]
}

Example Request:

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

Response: 200 OK

Delete Content ​

Hard-delete one version of a content node: the version the uuid names, with everything composed into it (slot children included), and nothing else. Sibling versions stay. Deleting a lineage's last version removes the node altogether; for a document's root content that empties the document.

This is the one operation that bypasses the version workflow, which is why it needs content.delete - an ability only an admin holds. The workflow's own way to retire something keeps it on record: Discard a draft, Withdraw a promoted version.

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

Example Request:

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

Response: 200 OK

json
{ "message": "component deleted." }

Fires content.deleted. Each version is addressed on its own, so clearing a lineage with three versions is three calls.

A version whose slot another block mounts cannot be deleted while the mount stands: the request answers 422 naming the mounting block, so that its children do not vanish from under it. Delete or re-point that block first.

Validation ​

Content is validated against the component schema when created or updated. Common validation errors:

Array Without Item Type ​

json
{
  "message": "The given data was invalid.",
  "errors": {
    "data": [
      "an array without item type is not supported"
    ]
  }
}

Array Length Constraints ​

If an array component has minItems: 2 and maxItems: 3:

  • Too few items: [1] → 422 Unprocessable Entity
  • Too many items: [1, 2, 3, 4] → 422 Unprocessable Entity
  • Valid: [1, 2, 3] → 201 Created

Object Additional Properties ​

If an object component has additionalProperties: false:

json
{
  "type": "object",
  "properties": {
    "foo": { "type": "integer" }
  },
  "additionalProperties": false
}
  • Invalid: {"foo": 1, "bar": "nope"} → 422 Unprocessable Entity
  • Valid: {"foo": 2} → 201 Created

Object Property Count ​

If an object component has minProperties: 1 and maxProperties: 2:

  • Too few: {} → 422 Unprocessable Entity
  • Too many: {"first": "a", "second": "b", "third": "c"} → 422 Unprocessable Entity
  • Valid: {"first": "a", "second": "b"} → 201 Created

String Validation ​

For strings with pattern and enum:

json
{
  "type": "string",
  "pattern": "^[a-z]+$",
  "enum": ["ok", "good", "fine"]
}
  • Invalid pattern: "ABC" → 422 Unprocessable Entity
  • Invalid enum: "almost" → 422 Unprocessable Entity
  • Valid: "good" → 201 Created

For string length:

  • 255 characters → 201 Created
  • 256 characters → 422 Unprocessable Entity, whatever maxLength the schema declares
  • 256 characters in a format: "text" or format: "richtext" field → 201 Created

The limit is per value. An array of strings holds 255 characters per item, so ten 200-character items are fine.

Position Parameter ​

The position parameter determines where the content is placed in the document:

  • "first" - Add at the beginning
  • "last" - Add at the end
  • Other positions may be supported (check implementation)

Content Versions ​

Every content node can have multiple versions: sibling drafts of the same node, created from an existing one, that stay invisible until explicitly promoted. The node you get back from "Create Content" above is the first of them, and it is a draft: GET /document/{uuid} renders nothing for it until you promote it. Keep its _uuid - or find it again with GET /document/{uuid}/versions, which lists a document's root versions whether or not any is live.

Version Lifecycle ​

draft ──submit──> pending_approval ──approve──> approved ──┐
  │                       │                                 │
  │                     reject                            promote
  │                       │                                 │
  └──discard──> discarded ▼                                 ▼
                      rejected                           promoted ──withdraw──> withdrawn
  • draft - just created, fully editable, invisible. Can be promoted directly (no approval needed) or submitted for review.
  • pending_approval / approved / rejected - the optional review gate. Approving a version you submitted yourself is rejected with 422.
  • promoted - in the "candidate pool". This is what can render, not what necessarily is rendering right now - see Scheduling below.
  • withdrawn / discarded / rejected - terminal. Nothing is ever hard deleted; create a new version to try again.

At any time, whichever promoted version is most recently created and currently within its scheduling window (see below) is the one that actually renders. If no promoted version qualifies, the content renders empty rather than falling back to something stale.

Create a Version ​

Clone an existing content node (by its UUID) into a new sibling draft.

A version is a copy of the block's own values only. Its slots are not copied: they mount the lineage's slots, so every version of a block shows the same children, and a child added, moved or edited through any version is seen by all of them. A version is not a snapshot of the block's arrangement - promote an older version and the current children stay.

Endpoint: POST /api/v1/content/{uuid}/versions

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

Response: 201 Created

json
{
  "message": "version created.",
  "content": {
    "_uuid": "110e8400-e29b-41d4-a716-44665544000b",
    "_component": "660e8400-e29b-41d4-a716-446655440001",
    "_value": { "...": "..." }
  }
}

The new version is a normal content node - PATCH /api/v1/content/{uuid} edits it like any other, with no effect on what's currently live.

List Versions ​

List every sibling version for a lineage, newest first, flagging which one (if any) is currently live. Each entry's _uuid is the version's own identifier - that's what the transition endpoints below take. _component is the same for every sibling: they are all versions of content built from one component schema.

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

Query parameters: locale (optional) - the language is_current is answered for; see "Translations" below.

Starting from a document instead of a version you already hold: GET /document/{uuid}/versions, same response.

Response: 200 OK

json
{
  "data": [
    {
      "_uuid": "110e8400-e29b-41d4-a716-44665544000b",
      "_component": "660e8400-e29b-41d4-a716-446655440001",
      "locale": null,
      "status": "draft",
      "is_current": false,
      "created_at": "2026-10-20T08:12:00+00:00",
      "updated_at": "2026-10-20T08:40: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
    },
    {
      "_uuid": "770e8400-e29b-41d4-a716-446655440002",
      "_component": "660e8400-e29b-41d4-a716-446655440001",
      "locale": null,
      "status": "promoted",
      "is_current": true,
      "created_at": "2026-10-19T09:30:00+00:00",
      "promoted_at": "2026-10-19T10:00:00+00:00"
    }
  ]
}

Submit for Approval ​

Endpoint: POST /api/v1/content/{uuid}/submit

Moves a draft to pending_approval. Requires content.update (or the bare update ability).

Approve / Reject ​

Endpoints: POST /api/v1/content/{uuid}/approve, POST /api/v1/content/{uuid}/reject

Require content.approve (or the bare approve ability). reject accepts an optional body:

json
{ "reason": "Needs another pass on the copy." }

Approving your own submission (same acting identity) returns 422 by default - this exists so a team always has a second reviewer. A project owner can turn this off for their own project on the project settings page in the web UI - useful for a solo project with nobody else to ever approve anything. Off by default, so existing multi-person projects are unaffected.

Rejecting is terminal - there's no un-reject; create a new version.

Schedule ​

Set, change, or clear when a version is eligible to render. Works at any non-terminal status, before or after promotion.

Endpoint: POST /api/v1/content/{uuid}/schedule

json
{
  "reveal_at": "2026-11-01T09:00:00Z",
  "conceal_at": "2026-12-01T09:00:00Z"
}

Both fields are optional and nullable - send null to clear one. Requires content.publish (or the bare publish ability).

Promote ​

Enters the version into the candidate pool. This does not guarantee it renders immediately - it still has to be within its scheduling window (if any was set). Allowed from draft or approved.

Endpoint: POST /api/v1/content/{uuid}/promote

Requires content.publish.

If this content node is a slot item (added via the parent parameter - see Slots & References), it has its own independent draft/promote lifecycle just like any top-level content - promoting the host that contains the slot does not promote the slot's children. Each needs its own promote() call.

Withdraw ​

Pulls a promoted version out of the candidate pool immediately, whether or not it's the one currently rendering. Does not promote a replacement - pair it with promoting the right version if you need a rollback.

Endpoint: POST /api/v1/content/{uuid}/withdraw

Requires content.publish. Only valid from promoted.

Discard ​

Retires an un-submitted draft. Kept for history, marked discarded, never hard deleted.

Endpoint: DELETE /api/v1/content/{uuid}/discard

Requires content.update. Only valid from draft.

Translations ​

A translation is a sibling version in another language, not a separate document or a level of its own. Every language therefore has its own independent draft → promoted lifecycle: German can be live while English is still a draft, and promoting one does nothing to the other.

Configuring a project's languages ​

Until a project declares its languages it is single-language and nothing below applies - rendering is exactly as it always was, with no _locale anywhere in the payload. The languages live in the project's settings:

json
{
  "locales": ["de", "en"],
  "default_locale": "de",
  "translation_mode": "faithful"
}

The default is what content falls back to, and what a version with no language recorded is taken to be - which is every version created before translations existed, so nothing needed migrating.

Creating one ​

Endpoint: POST /api/v1/content/{uuid}/translations

bash
curl -X POST "https://admin.flatnode.net/api/v1/content/660e8400-e29b-41d4-a716-446655440001/translations" \
  -H "Authorization: Bearer your-token-here" \
  -H "Content-Type: application/json" \
  -d '{"locale": "en"}'

Response: 201 Created

The source version's own values are copied as a starting point and the copy is filed under the requested language as a draft - a translation of published content is never itself instantly published. Edit it with PATCH /content/{uuid} and publish it with POST /content/{uuid}/promote, exactly like any other version.

One exception: if the version is a library entry, its library's filterable string fields hold one value in every language, so a translation cannot change them - the PATCH answers 422 naming the field. Change them on the default-language version; the translations follow. See Filtering.

What happens to the block's children depends on the project's translation_mode setting, read at the moment the translation is made:

  • faithful (the default): the translation shares the block's children with every other language, exactly as a new version does. One set of children, in every language; add, move or edit one and every language shows it; translate a child on its own lineage and the translated parent shows the translated child. In the editor's render such a slot is listed in the block's _mounted.
  • detached: the translation copies the children and keeps its own set, which may differ from the default language's from then on. The copies carry no language and are seen only through that translation, so they are edited in place rather than translated.

Changing the setting changes nothing already made; each translation records which kind it is. Translations made before this distinction existed were detached copies; php artisan content:unify-translation-slots brings them into the faithful shape (dry run first - the copies are dropped).

Calling this twice for the same language is not an error: each language has its own version chain, so the second call adds a version to that chain.

POST /content also takes an optional locale, for authoring directly in a language rather than translating from another.

Reading in a language ​

Add ?locale= to a document read:

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

A locale the project does not publish in is a 422 naming the available ones, rather than being ignored - a typo silently serving the default language is the sort of thing that reaches production, because the response looks perfectly fine.

Fallback is per block ​

Resolution happens block by block, not once for the page. A block with no version in the requested language falls back to the default, and the rest of the page is unaffected:

json
{
  "_locale": "en",
  "_value": {
    "hero":   { "_locale": "en", "...": "..." },
    "teaser": { "_locale": "de", "...": "..." }
  },
  "_document": { "title": "...", "slug": "...", "locale": "en" }
}

_locale on each block is the language it actually resolved to, so a consumer can tell a real translation from a fallback - and choose to hide, flag or machine-translate the ones that fell back. It appears only when the project publishes in more than one language.

A draft translation is not a candidate for a reader, so an unfinished English version does not replace the published German one; it becomes visible when it is promoted.

GET /content/{uuid}/versions reports each version's locale alongside its status, as stored - null meaning the project default.

It also takes ?locale=, because is_current is a per-language answer: a lineage can have a live German version and a live English one at the same time. Without it the listing answers for the project's default language, and a language with nothing promoted has no version flagged is_current at all - it is not "falling back to whatever another language published", even though a read of that language would indeed fall back.

Content Permissions ​

Sets who can write to a specific root content node. Every node carries unix-style mode bits plus an owner (a person) and a group (one role in the project), and this is the endpoint that changes them.

Whoever holds content.override_permissions - admins by default - writes any node regardless of its bits, so what follows decides what everybody else may do.

Needs the content.permissions ability, which is not implied by content.update or the bare update - changing who may write somewhere is governance rather than editing, so even a node's own owner cannot do it to themselves unless they hold it.

Endpoint: PATCH /api/v1/content/{uuid}/permissions

Request Body:

FieldTypeNotes
permissionsstringRequired. One of "600", "644", "664".
groupstringOptional. A role slug, or "project" for every member.
owner_idinteger or nullOptional. Reassigns the node's owner.
  • "600" / "644" - only the owner (and admins) can write.
  • "664" - the owner and the group can write.

Groups ​

A node's group is exactly one role, named by its slug. "project" is the group every member is in, and it is what a node gets when it is created - so "664" means "anybody in the project" until somebody narrows it.

groupWho the group bits apply to
"project"Every member of the project. The default.
"admin"Admins.
"editor"Editors.
a role slugHolders of that role (Project → Roles).

"664" with a group is the way to say "this role maintains this block, everybody else reads it" - a contact panel, a legal footer, a price table. Note what it is not: "644" says only the node's owner writes, and an owner is a person, so a lock built that way stops meaning what it was set to mean when that person leaves the project. A group is a role and survives them.

A caller holding more than one role is in the group if any of them matches. A slug that names no role in this project is a 422, never a silent fall back to "project".

bash
curl -X PATCH "https://admin.flatnode.net/api/v1/content/990e8400-e29b-41d4-a716-446655440004/permissions" \
  -H "Authorization: Bearer your-token-here" \
  -H "Content-Type: application/json" \
  -d '{"permissions": "664", "group": "admin"}'

Response: 200 OK

json
{
  "message": "content permissions updated.",
  "data": {
    "_uuid": "990e8400-e29b-41d4-a716-446655440004",
    "permissions": "664",
    "owner_id": 7,
    "group": "admin"
  }
}

group comes back null if the role it named has since been deleted. Such a node stays readable and simply stops being group-writable.

Returns 403 if the caller does not hold content.permissions, regardless of whether their token otherwise has content.update/update.

Reading a lock back ​

A render made with a session token (the admin UI's own) carries the current state on each addressable block, so an editor can be shown a lock rather than discovering it on save:

KeyNotes
_permissionsThe mode, as three octal digits.
_ownerThe id of the user who created the block.
_groupThe group's role slug, or null if unresolved.

A public render deliberately carries none of the three.

Mode bits live on the block's version wrapper, so a lock covers the block and every version of it - including translations, which are sibling versions.

Slots and References ​

For advanced content structures using slots and schema references, see the Slots & References documentation. This includes:

  • Creating content with slots (dynamic, user-added content areas)
  • Using schema references ($ref) for reusable components
  • Stacking multiple schemas together
  • Nested slot hierarchies