API reference

Pens

Playgrounds with HTML (template), CSS and JS – editor and public view under /cms-admin/pen/<uuid> (see manual).

{ "id": 1, "uuid": "bbda7c51-1a00-499b-a75b-39bb374b314b", "title": "Getränke-Test",
  "html": "<h1>{{ page.title }}</h1>", "css": "h1 { color: red }", "js": "", "public": true, "show_code": true,
  "resources": { "css": ["https://cdn.jsdelivr.net/npm/water.css@2/out/water.css"],
                 "js": [{ "url": "https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js", "module": false }],
                 "imports": [{ "name": "vue", "url": "https://cdn.jsdelivr.net/npm/vue@3.5.44/dist/vue.esm-browser.js" }],
                 "lang": "js", "jsx_import_source": "" },
  "created_at": 1791287700, "updated_at": 1791287760 }
Endpoint Access Description
GET /pens 🔑 All pens, most recently changed first
POST /pens ✏️ Create (title, html, css, js, public, show_code – default true; false = publicly only the result as a standalone page; resources see below); the server assigns the uuid
GET /pens/{uuid} · PUT /pens/{uuid} · DELETE /pens/{uuid} 🔑 / ✏️ Read, change (with base_updated_at), delete
POST /pens/{uuid}/preview 🔑 Renders an unsaved state (html, css, js, title, resources) → { "html": "<!doctype html>…" }, 422 on template and JSX errors

resources (PUT without the field = unchanged): css = stylesheets (<link> before your own CSS), js = scripts {url, module} (before your own JS, module → type="module"), imports = import map {name, url} (<script type="importmap"> at the end of <head>), lang = js | jsx | tsx (the server converts JSX/TSX with esbuild, modern runtime <jsx_import_source>/jsx-runtime, default react). Your own JS runs as a module with jsx/tsx or when it contains import/export. Only http(s) addresses, at most 20 per list and 50 import entries; empty rows are dropped. Errors: 400 with pen.urlInvalid, pen.tooManyURLs, pen.tooManyImports, pen.importNameInvalid, pen.importDuplicate, pen.langInvalid, pen.jsxSourceInvalid.

Changes to pens don’t clear the page cache.