Skip to main content
A page is a JSON document — a versioned tree of PageBlocks plus data bindings and capability hooks. Every Builder save creates a new version. Through this resource you fetch the current draft, apply surgical edits as RFC 6902 JSON Patch, roll back to a prior version, and publish the draft live. By the end of this page you will know which endpoints exist, what each scope unlocks, and how draft and live state relate.

A page in shape

{
  "version":  "v0.4",
  "metadata": { "slug": "landing", "title": "Acme Co." },
  "schema":   {},
  "tree": {
    "block": "NavShell",
    "props": { "brand_name": "Acme Co.", "variant": "topbar" },
    "children": [
      {
        "block": "Hero",
        "props": { "headline": "Welcome to Acme", "cta_label": "Sign up", "cta_href": "/signup" }
      }
    ]
  }
}
The root block is always a NavShell; its children are the visible sections. The full block catalogue lives in PageBlocks.

Endpoints

List all pages in the workspace. Fetch the current draft page document. Apply RFC 6902 JSON Patch operations to the draft. Roll back the draft to a prior version. Publish the current draft to live.

Draft vs live

StateWhat it isHow it changes
DraftThe working copy you read with GET /pages/{id}. Patches and rollbacks act on it.Every PATCH produces a new draft version.
LiveThe version your visitors see.Updated only by POST /pages-publish. The publish endpoint promotes every page’s current draft to live in one call.
The decoupling means you can iterate on the draft as long as you like — visitors keep seeing the last published version until you publish again.

Patching the tree

PATCH /pages/{id} accepts an RFC 6902 array. Each operation is { op, path, value? }, where path is a JSON Pointer into the page document. The pointer /tree/children/0/props/headline targets the headline prop of the first child block.
curl -X PATCH https://api.gavai.app/v1/workspaces/acme/pages/page_01H... \
  -H "Authorization: Bearer gak_live_xxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '[
    { "op": "replace", "path": "/tree/children/0/props/headline", "value": "Welcome to Acme" }
  ]'
Fetch the document first to compute the right paths. We chose JSON Patch over a custom diff format because patches are standard, debuggable, and hand-writable in a console without an SDK.

Common errors

PageBlocks overview

The block catalogue, prop shapes, and how to compose a page tree.