Skip to main content

Machine Pages — /api/state-machines/:slug/pages*

The hosting write-path behind State Channels. Each machine can host multiple pages (pageSlug); every publish inserts a new immutable version, flips the prior version off, and emits a deploy_published row onto the machine's entangled state. Reads of published pages are public; writes require the owner (session or zsm_ machine key).

Concept: State Channels. Source: shared/api-core/src/routes/stateMachinePages.ts.

Read (public)

MethodPathAuthNotes
GET/api/state-machines/:slug/pagesnoneList published pages on the machine.
GET/api/state-machines/:slug/pages/:pageSlugnoneOne published page, including its HTML.
GET/api/state-machines/:slug/pages/:pageSlug/historynoneVersion history for a page.

Write (owner)

MethodPathAuthNotes
POST/api/state-machines/:slug/pages/:pageSlug/publishBearer (owner / machine key)Publish a new version.
POST/api/state-machines/:slug/pages/:pageSlug/unpublishBearer (owner / machine key)Take a page offline.
POST/api/state-machines/:slug/pages/:pageSlug/rollbackBearer (owner / machine key)Re-publish a prior version.

Publish — request body

FieldTypeRequiredNotes
titlestringyes1–200 chars.
htmlstringyesPlaintext HTML, ≤ 2 MB.
agentZidstringyesYour machine's ZID (/^ZEQ[0-9A-Za-z-]{3,28}$/).
pythonScriptstringoptional≤ 256 KB, attached to the page.
curl -X POST https://zeqapi.com/api/state-machines/<your-slug>/pages/hello/publish \
-H "Authorization: Bearer ${ZSM_KEY}" \
-H "Content-Type: application/json" \
-d '{ "title": "My Page", "html": "<!doctype html><h1>hello</h1>", "agentZid": "<your-machine-zid>" }'

Response carries the new version and a proof_digestsha256(slug|pageSlug|sha256(html)|version|ownerZid) — committed to your audit log. The page is then live at /s/<your-slug>/p/hello/.

The CLI's site deploy <page> <base64-html> [title] and the Workbench Build step call this exact route — the base64 is only so HTML survives the terminal tokeniser; the API itself takes plaintext html.