For developers

Build and manage a CubeSites website with JSON

Generate a site outside the visual editor, validate it against the same renderer contract, then import it or apply updates to a draft.

The renderer is the contract

The schema and assistant guide are generated from CubeSites's block, field, layout, theme and settings definitions. The file format is version 2; version 1 export files remain importable.

A small site file

Each page contains renderer-defined sections. See the guide for all fields, allowed values, layouts and limits.

{
  "format": "cubesites-site",
  "version": 2,
  "name": "Your Company",
  "pages": [
    {
      "title": "Home",
      "slug": "",
      "sections": [
        {
          "type": "hero",
          "props": {
            "heading": "Your Company",
            "intro": "[Add a truthful description of your business]"
          },
          "style": {
            "padding": "lg"
          }
        }
      ]
    }
  ]
}

Validate before applying

Validation returns JSON Pointer paths for errors and warnings for values the renderer would change. Use a personal API token from a workspace with API access, or make the same requests while signed in to the app.

curl -X POST "https://api.cubesites.co.uk/api/v1/workspaces/$WORKSPACE_ID/sites/validate" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  --data-binary @site.json

API endpoints

POST /api/v1/workspaces/{workspaceId}/sites/validate
Validate JSON without writing.
POST /api/v1/workspaces/{workspaceId}/sites/import?dryRun=1
Preview an import without creating a site.
POST /api/v1/workspaces/{workspaceId}/sites/import
Create a site from a JSON file.
GET /api/v1/workspaces/{workspaceId}/sites/{siteId}/json
Get the current editable site as JSON.
PUT /api/v1/workspaces/{workspaceId}/sites/{siteId}/json
Apply JSON to a draft. Add ?prune=1 to remove pages absent from the file.

Applying JSON changes the draft, not the published site. Review the result in CubeSites and publish separately.