Skip to content

API Documentation ​

Welcome to the CMS API documentation. This API provides endpoints for managing documents, components, content, and more.

Base URL ​

All API requests should be made to:

https://admin.flatnode.net/api/v1

Authentication ​

All API requests require authentication using a Bearer token.

Getting a Token ​

A token belongs to one project and is issued by the project's owner in the admin:

  1. Open the project in the admin and choose API tokens in the project's sidebar. The project Overview and Settings link there too.
  2. Give the token a name that says what it is for - the site build, a script, an agent.
  3. Pick an expiry, and the abilities the token needs. For a site that only reads published content, Read everything is enough; an integration that writes wants the narrower abilities under each heading (see Token Abilities).
  4. Click Create. The token is shown once - copy it now, it cannot be shown again. Tokens can be re-scoped or deleted from the same screen at any time.
  5. Send it in the Authorization header of every request, and start with GET /project.

Only the project owner can issue tokens; an editor does not see the screen.

The screen takes its values from the link that opens it, so a tool or an agent that needs access can hand its human a URL and the human only checks the form and clicks Create:

https://admin.flatnode.net/projects/{project}/api-tokens?name=claude-code&abilities=read&expires=30

abilities is a comma-separated list of the ability names under Token Abilities; expires is a number of days from the form's own choices (30, 90, 180, 365) or never. Anything the form does not know is dropped. The one-time reveal also offers a setup snippet - the token and API base as shell exports, plus the first call - to paste where the tool reads it.

Using the Token ​

Include your token in the request headers:

http
Authorization: Bearer your-token-here

Requests are rate limited per project owner, and an owner's plan caps what can be created - see Rate limits and plan limits.

Token Abilities ​

Tokens carry one or more abilities, checked against each endpoint's required verb: create, read, update, delete. A bare verb (e.g. read) grants that action across every resource type.

To scope a token to a single resource instead, grant {resource}.{verb} (e.g. document.read, file.update) rather than the bare verb. An endpoint accepts either form - a token needs the resource-scoped ability or the bare verb, not both.

Resources that can be scoped this way: document, content, component, library, file, file-variant-definition (all four verbs), plus search and validation (read only).

content additionally has approve and publish, used by its version workflow: content.approve gates the review step (approve/reject), and content.publish gates schedule/promote/withdraw. Neither is implied by content.update.

A call the token lacks the ability for answers 403, and the message names the ability it needed. To know beforehand, read GET /project: it lists the token's abilities and the project's publishing workflow, and needs no ability itself.

Example request with authentication:

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

Identifiers are UUIDs ​

Every identifier the API accepts or hands out is a UUID - in a path (/document/{uuid}), in a request body (DocumentId, ComponentId, parent.HostContentId, insertAfter, componentId), and in a reference value ({"id": "<uuid>"} for a file, image or link field).

Responses use the same identifiers: _uuid on every resource and every rendered block, and _component for the component schema a block was built from.

There is no numeric-id form of any of these as input. A request carrying one is rejected - 404 for a path parameter (it doesn't match the route's uuid pattern at all) and 422 for a body field.

Every endpoint that echoes a resource declares its own fields, identifying it by _uuid and naming the rest in lowerCamelCase - the same convention rendered content and webhook payloads already use. A listing is a list of those same resources. The one place a key is not a uuid is a file-variant definition, which is keyed by its own key rather than a row.

Changed

These endpoints previously answered in PascalCase, with an Id field alongside Uuid (POST /document, PATCH /document/{uuid}, POST /document/{uuid}/duplicate, GET /tree/{uuid}, POST /component, POST /file, GET /file/{uuid}, POST /file/{uuid}/variants), and until 2026-11-26 so did the Library endpoints. GET /component answered id and configuration per row, and GET /component/{uuid} answered the bare schema with handle beside data; both now answer the component resource with the schema under data.schema. Until 2026-11-27 GET /document answered {id, title} rows; it now answers the full document resource. A client reading Uuid/Title/id/configuration from one of those now wants _uuid/title/schema. Request bodies are unchanged.

Machine-readable contract ​

Everything on these pages is also one OpenAPI 3.1 document, with the abilities each operation needs and every identifier typed as a uuid: /openapi.yaml. Hand it to a client generator or an agent rather than transcribing the prose.

Response Format ​

All API responses are returned in JSON format, errors included, whether or not the request sends Accept: application/json - a 422, 401 or 404 on an /api/v1/* path is never a redirect or an HTML page. Successful responses typically include:

  • 200 OK - Successful GET, PATCH, PUT, DELETE requests
  • 201 Created - Successful POST requests
  • 422 Unprocessable Entity - Validation errors
  • 404 Not Found - Resource not found
  • 401 Unauthorized - Authentication required

Error Response Format ​

When an error occurs, the response will include a message and optionally an errors object:

json
{
  "message": "The given data was invalid.",
  "errors": {
    "field_name": [
      "The field name is required."
    ]
  }
}

Rate Limiting ​

Two limits apply, both counted per project owner across all of that owner's projects and tokens: a per-minute burst, and a monthly request quota. Every successful response carries X-Quota-Limit, X-Quota-Remaining and X-Quota-Reset, so a client can see where it stands without a separate call, and exceeding either limit is a 429 with Retry-After.

Back off on 429. See Rate and plan limits for the numbers, what counts against the quota, and the separate caps on how much can be created.

Where to start ​

With a token and nothing else, call GET /project. It answers the project's languages and its root document, and the root's _uuid is the first identifier every other call needs:

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

# Response: {"message":"OK","data":{"title":"...","locales":["en","nb"],
#            "defaultLocale":"en","root":{"_uuid":"550e8400-...", ...}}}

Building a site rather than a client? The Astro starter does the above and everything after it - routes per page and locale, blocks dispatched by handle, images pulled at build time - and is meant to be cloned and changed: npm create astro@latest -- --template flatnode/astro-starter.

Quick Start Example ​

Here's a complete example of creating a document with content:

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

# Response: {"document": {"_uuid": "550e8400-e29b-41d4-a716-446655440000", ...}}

# 2. Create a component (string type)
#    Or skip this: a new project already has a `Page` component, and
#    GET /component lists it. Step 3 takes any component's uuid.
curl -X POST "https://admin.flatnode.net/api/v1/component" \
  -H "Authorization: Bearer your-token-here" \
  -H "Content-Type: application/json" \
  -d '{"type": "string", "title": "A single string"}'

# Response: {"data": {"_uuid": "660e8400-e29b-41d4-a716-446655440001", ...}}

# 3. Create content using the document and component
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": "Hello, World!"
  }'

# Response: {"message":"OK","data":{"_uuid":"770e8400-e29b-41d4-a716-446655440002", ...}}

# 4. Publish it. New content starts as a draft, so until this runs the
#    fetch below returns only {"_document": {...}} with no body - see
#    Content Versions in the Content docs. Needs `content.publish`.
curl -X POST "https://admin.flatnode.net/api/v1/content/770e8400-e29b-41d4-a716-446655440002/promote" \
  -H "Authorization: Bearer your-token-here"

# 5. Retrieve the document to see the content
curl -X GET "https://admin.flatnode.net/api/v1/document/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer your-token-here"

# Response: {"_uuid": "770e8400-...", "_type": "component",
#            "_component": "660e8400-...", "_value": "Hello, World!",
#            "_document": {"title": "My Document", "slug": "my-document"}}

Endpoints Overview ​

  • Project - Where to start: the project behind the token, its languages and its root document
  • Documents - Create and manage documents
  • Components - Define component schemas
  • Content - Create and manage content instances, including versions and translations
  • Slots & References - Build complex nested structures with slots and schema references
  • Files - Upload and manage files, and organize them into folders
  • Libraries - Filterable collections of entries sharing one component schema
  • Search - Search and query content
  • Validation - Validate data against schemas
  • Webhooks - Get told when content changes, instead of polling for it