CMS API documentation

The CMS has an HTTP API for creating and editing everything a site is made of: pages, headers, footers, stylesheets, scripts, forms, error pages and redirects. It is designed to be driven by scripts and by AI agents, so these pages are plain, semantic HTML with no content hidden behind scripts.

Documents

Page What it covers
API reference Authentication, every endpoint and action, request and response formats, status codes, and working clients in Python, Node.js and PHP.
Site building guide How pages are assembled from headers, footers, CSS and JS; naming and linking rules; HTML, CSS and JavaScript conventions; assets; search, tables of contents and footnotes.
Form schema The JSON document that defines a form's fields, validation and conditional visibility.
Styling forms The HTML a form publishes as, its classes and ids, and what must not be restyled.
Styling email addresses How mailto: links are published as encrypted buttons, and how to style them.
AI prompt playbook A prompt builder and ready-made prompts for having an AI agent build, clone or edit a site on the CMS.

For AI agents

If you were pointed here to work with the CMS, read the API reference and the Site building guide in full before making any request. Read the form and email pages when the site has forms or mailto: links. Every page is complete in its HTML; nothing needs JavaScript to read.

The essentials:

  1. Credentials are a JSON file (usually credentials.json) with domain, user and an Ed25519 key. Never print or log the key.
  2. Every request is authenticated by a JWT you sign yourself with alg: EdDSA, claims aud = domain, sub = user, iat, and a short exp. Mint a new one per request.
  3. All parameters go inside the JWT: the command in the action claim, its arguments URL-encoded in the query claim. The HTTP request carries only token.
  4. GET reads, POST writes. POST sends token as an application/x-www-form-urlencoded body.
  5. Objects and content are separate. Create an object with /cms/api/cms (the new id is in the X-ID response header), then write its HTML, CSS or JS with /cms/api/content, passing the current revision id as contentId.
  6. Content is the inside only: never send <header>, <main> or <footer> tags, <script>, <style>, inline styles or inline SVG.
  7. Create headers, footers, CSS and JS before pages.
  8. Nothing goes live until a person publishes it from staging (see Reviewing and publishing). Check your work locally first, and run links_broken after uploading.
  9. Some Ed25519 libraries cannot parse the key as given. Extract the 32-byte seed that follows the bytes 04 22 04 20 in the DER (see §1.1), or sign tokens with the jwtsign command-line tool, which reads credentials.json as given (see §7.1).
  10. If anything is ambiguous, ask the person you are working for before guessing.

Endpoints at a glance

Endpoint GET POST
/cms/api/cms Read actions: pages, headers, footers, css, js, forms, error-pages, redirects, links_broken, *-history, … Write actions: page_new, page_save, page_duplicate, page_delete, header_new, css_new, js_new, form_new, error-page_save, redirect_new, links_add, …
/cms/api/content Read an object's content and revision id Write an object's content
/cms/api/form Read a form's field schema Write a form's field schema

Quick start

1. GET  /cms/api/cms      action=headers_footers_css_js          → see what exists
2. POST /cms/api/cms      action=header_new  query=name=Main      → X-ID: 1
3. POST /cms/api/content  query=type=header&file=1&contentId=0&content=…
4. POST /cms/api/cms      action=css_new     query=name=nav&media=   → X-ID: 1
5. POST /cms/api/content  query=type=css&file=1&contentId=0&content=…
6. POST /cms/api/cms      action=page_new    query=name=index&title=…&header=1&footer=&css=1&js=&…   → X-ID: 1
7. POST /cms/api/content  query=type=page&file=1&contentId=0&content=…
8. GET  /cms/api/cms      action=links_broken

Working code for signing tokens and making these calls is in API reference §7.