OPENAPI 3.1
api
9 min read

Agent REST API v1 & Recursive AST

For CI pipelines, content importers, or custom agent runtimes that speak plain HTTP rather than MCP, OpenDash provides a versioned /api/v1/* REST surface backed by a live OpenAPI 3.1.0 specification, strict optimistic concurrency, and surgical Recursive AST operations.

OpenAPI 3.1 discovery & authentication

Download the machine-readable schema at GET /api/v1/openapi.json using a token holding site:read. Every /api/v1/* response includes Cache-Control: no-store and returns uniform ApiV1Error payloads ({ "error": { "code", "message", "hint", "details" } }) across status codes 400, 401, 403, 404, 409, 412, 422, 428, 429, and 503.

fetch-openapi.sh bash
curl -sS \
  -H "Authorization: Bearer $OPENDASH_TOKEN" \
  "https://example.com/api/v1/openapi.json" | head -n 20

Optimistic concurrency with If-Match

Automated writes never overwrite human work blindly. Mutating endpoints require an If-Match: "vN" header matching the latest integer version returned by GET. Omitting the header returns 428 Precondition Required; sending an outdated version triggers 412 Precondition Failed.

Recursive Block AST operations

Instead of rewriting entire layout blobs, agents inspect compact node trees and send surgical patch operations under /api/v1/entries/{type_key}/{id}/builder/*. Every submitted AST enforces Unified Recursive AST V1 invariants: max 512 nodes, max depth 8, max 256 KiB JSON, max 16 pattern instances, and max 1024 expanded nodes.

  • GET .../builder/outline — lightweight tree of OutlineNode entries (id, block_id, name, summary, children).
  • POST .../builder/compose — composes a full page from theme pattern keys plus targeted PatternSlotOverride prop replacements.
  • PATCH .../builder/nodes — applies atomic BlockPatchOp variants tagged by "op": update_props, insert_block, insert_pattern, move_node, duplicate_node, and delete_node.
  • POST .../builder/preview — renders sanitized C-SEC preview HTML without persisting changes to DB.
patch-builder-nodes.sh bash
curl -sS -X PATCH \
  -H "Authorization: Bearer $OPENDASH_TOKEN" \
  -H "If-Match: \"v3\"" \
  -H "Content-Type: application/json" \
  -d '{
    "ops": [
      {
        "op": "update_props",
        "id": "hero-heading-id",
        "props": { "text": "Launch faster with OpenDash" }
      },
      {
        "op": "move_node",
        "id": "cta-card-id",
        "new_index": 0
      }
    ]
  }' \
  "https://example.com/api/v1/entries/page/12/builder/nodes"

Core endpoint groups & SEO safety

Beyond entries and AST builder routes, /api/v1/* organizes site administration into resource endpoints: /site/overview, /blocks, /patterns, /theme-options, /design-tokens, /template-overrides, /template-document, /menus*, /settings/general, /settings/reading, /media*, /locales, /taxonomies/{kind}/terms, /redirects, /themes*, /options-pages*, /contact/submissions*, and the /api/v1/seo/* authoring endpoints.

Declarative Site Blueprints (SiteBlueprintV1)

SiteBlueprintV1 provisions site identity, theme activation and design tokens, CPTs, field groups, taxonomies, terms, entries, menus, and reading settings idempotently in a single JSON document (up to 4 MiB) via POST /api/admin/blueprint/apply?dry_run=true&mode=upsert or opendash blueprint apply.

blueprint.json json
{
  "blueprint_version": 1,
  "site": {
    "title": "Acme Docs",
    "timezone": "UTC"
  },
  "theme": {
    "activate": "opendash-starter-theme"
  },
  "content_types": [
    {
      "key": "changelog",
      "label": "Changelog",
      "public": true,
      "publication": "draft_publish"
    }
  ]
}

Next steps

Consult CLI Reference for all flags, storage subcommands, localization extractors, and environment variable precedence.

Edit Source URL:

Search OpenDash

Use Arrow keys & Enter to navigate Full search page →