{"openapi":"3.1.0","info":{"title":"Contenter CMS API","version":"1.1.0","description":"Read API for storefronts. Serves only **published, integrity-verified** live content — pages, layouts, themes and designs. Authoring (create / update / publish) is exclusive to the CMS and is not exposed here.\n\nAuthenticate with your tenant's CMS API key in the `X-CMS-API-Key` header — it is self-identifying (resolves your tenant on its own), read-only, and static, so responses are CDN-cacheable. Generate or rotate it in the CMS under Settings → API key.\n\n**The `/agentic` routes are a second, separate surface.** They are the CMS's AI abstraction — the tool registry an AI agent operates the CMS through, plus the chat entry point the CMS itself uses. They authenticate with a **platform JWT**, not the storefront API key, and they *can* write. The MCP server is a thin proxy over `/agentic/tools`; the tools are executed here, where validation, scope gating and metering live."},"security":[{"cmsApiKey":[]}],"tags":[{"name":"Storefront","description":"Public, integrity-verified live content reads."},{"name":"Agentic","description":"The AI abstraction: the tool registry agents operate the CMS through, and the chat entry point. Platform JWT, not the storefront API key."},{"name":"System","description":"Health and observability."},{"name":"Schema","description":"Emporix mode: provisioning of the tenant's CMS custom entities, IAM scopes and groups, and the one-time data checks that go with them (the page-tree check). What the CMS editor's Settings → Schema and its startup check call. Postgres mode answers every route as already done: there the schema belongs to cms-api's database migrations."},{"name":"Webhooks","description":"Outbound: what the CMS POSTs to a receiver you register under Settings → Webhooks. Signed per Standard Webhooks when signing is on."}],"paths":{"/storefront/pages/{site}/{locale}/{url}":{"get":{"tags":["Storefront"],"summary":"Resolve a page (+ layout + theme)","description":"The primary render call: resolves the live page for (site, locale, url) plus its layout and the site theme in one shot, following one level of the configured site/locale fallbacks. `url` is the page path (leading slash omitted; it may contain slashes) — for the homepage, request the site root (omit the url segment). Returns 404 when nothing verified matches — render your own 404 page. A multi-language page answers here exactly like a page of that language: publishing writes a flat copy per language, so the response never carries per-language variants and its `locale` is the requested language. A separate page of that language always wins over the multi-language page; a language the page is not published in, or excludes, falls through to the site fallbacks or 404.","parameters":[{"name":"site","in":"path","required":true,"schema":{"type":"string"},"example":"main"},{"name":"locale","in":"path","required":true,"schema":{"type":"string"},"example":"de"},{"name":"url","in":"path","required":true,"schema":{"type":"string"},"example":"products/shoes"},{"name":"version","in":"query","required":false,"schema":{"type":"string"},"description":"Which version to resolve. Omit (or 'live') = the published page. 'draft' = the working draft. Any other value = a specific version id (e.g. 'draft-1699887766'). Non-live versions are UNPUBLISHED (preview) — they skip content-hash verification and require the same tenant credential.","example":"draft"}],"responses":{"200":{"description":"Resolved page + layout + theme","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolvedPage"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/UpstreamForbidden"},"404":{"$ref":"#/components/responses/NotFound"},"502":{"$ref":"#/components/responses/UpstreamError"},"503":{"$ref":"#/components/responses/UpstreamUnavailable"}}}},"/storefront/layouts/{site}/{locale}/{name}":{"get":{"tags":["Storefront"],"summary":"Get a layout","description":"A single verified live layout. Usually unnecessary — the page resolve already returns the layout. A multi-language layout is served as its flat copy for the requested language, in the same shape as a layout of that language.","parameters":[{"name":"site","in":"path","required":true,"schema":{"type":"string"}},{"name":"locale","in":"path","required":true,"schema":{"type":"string"}},{"name":"name","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Layout","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CMSLayout"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/UpstreamForbidden"},"404":{"$ref":"#/components/responses/NotFound"},"502":{"$ref":"#/components/responses/UpstreamError"},"503":{"$ref":"#/components/responses/UpstreamUnavailable"}}}},"/storefront/designs/{site}/{locale}":{"get":{"tags":["Storefront"],"summary":"List designs (Saved Designs, Data-Driven Designs)","description":"The site's designs for one language: Component Library entries the Component Builder flagged as a new component type (`design:<slug>`). The CMS stores and validates designs and never expands them: a storefront that renders designs reads this list, offers every design as a component type in its editor palette, and renders a placement by expanding the design's `tree` with the placement's field values (`exposedProps`, each written to its `targets`, `<nodeId>.<propPath>` inside the tree). Level-2 designs carry bound values in props (`{ $bind: 'product.name' }`) and `$repeat` / `$when` props on nodes, resolved by the storefront against its own data-context contract.\n\nOnly published designs are listed, sorted by `type`. Publishing a design the CMS cannot validate (unknown component type, a field targeting a missing node, a binding path outside the storefront's contract, a repeat on a component that holds no components, a design placing itself, nesting deeper than 8) is refused with `422` and code `invalid_design`, the issues in `details.issues`. Same authentication and caching as a layout read; publishing a library entry revalidates the site tag.","parameters":[{"name":"site","in":"path","required":true,"schema":{"type":"string"},"example":"main"},{"name":"locale","in":"path","required":true,"schema":{"type":"string"},"example":"en"},{"name":"version","in":"query","required":false,"schema":{"type":"string"},"description":"Omit (or 'live') = published designs only. Any other value (e.g. 'draft') = the editor preview: a design's working draft wins over its live version and unpublished designs are included, so a design being built renders in the page preview before it is published.","example":"draft"}],"responses":{"200":{"description":"Designs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DesignsResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/UpstreamForbidden"},"502":{"$ref":"#/components/responses/UpstreamError"},"503":{"$ref":"#/components/responses/UpstreamUnavailable"}}}},"/storefront/themes/{site}":{"get":{"tags":["Storefront"],"summary":"Get a theme","description":"The site's verified live theme — CSS custom-property tokens to emit as scoped variables.","parameters":[{"name":"site","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Theme","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CMSTheme"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/UpstreamForbidden"},"404":{"$ref":"#/components/responses/NotFound"},"502":{"$ref":"#/components/responses/UpstreamError"},"503":{"$ref":"#/components/responses/UpstreamUnavailable"}}}},"/agentic/tools":{"get":{"tags":["Agentic"],"summary":"List the tools the caller may use","description":"The single tool registry — the same list the in-app AI assistant runs against and the one the MCP server proxies to `tools/list`. Filtered to the scopes carried by your token, so a read-only caller never sees the authoring tools: the list IS the permission boundary, not a hint about one.\n\nEach entry carries a JSON-Schema `inputSchema` generated from the tool's own validator, so it cannot drift from what the executor accepts. Recursive schemas (a component's children) use `$ref`/`$defs` rather than being inlined.","security":[{"platformJwt":[]}],"responses":{"200":{"description":"Tools available to this caller","content":{"application/json":{"schema":{"type":"object","properties":{"tools":{"type":"array","items":{"$ref":"#/components/schemas/ToolDefinition"}}},"required":["tools"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"405":{"$ref":"#/components/responses/MethodNotAllowed"}}}},"/agentic/tools/{name}":{"post":{"tags":["Agentic"],"summary":"Execute a tool","description":"Run one tool with the caller's tenant and scopes. The request body IS the tool's arguments — the shape published as that tool's `inputSchema` — with no envelope.\n\nScope is re-checked here, not just at listing time. Bad arguments come back as `400` (the caller's mistake, and recoverable by a model reading the message); a scope refusal or a missing entity keeps the status the service layer chose.\n\nWrite tools target the **draft** version of an entity; the `publish_*` tools promote draft → live and archive the previous live version.","security":[{"platformJwt":[]}],"parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string"},"description":"Tool name as returned by `GET /agentic/tools`.","example":"list_pages"}],"requestBody":{"required":true,"description":"The tool's arguments, matching its published `inputSchema`.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true},"example":{"site":"main","locale":"en"}}}},"responses":{"200":{"description":"The tool's result","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid arguments, or the tool refused them","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The caller's scopes do not cover this tool","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such tool","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/agentic/agents":{"get":{"tags":["Agentic"],"summary":"List available agents","description":"The agents this caller can chat with. In postgres/BYOK mode an agent is advertised only when it is both **configured** (a tenant admin assigned it a model) and **scoped** (the caller holds the role's AI scope). In emporix mode the call proxies to Emporix, which enforces its own agent permissions.","security":[{"platformJwt":[]}],"responses":{"200":{"description":"Agents","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Agent"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"502":{"$ref":"#/components/responses/UpstreamError"}}}},"/agentic/chat":{"post":{"tags":["Agentic"],"summary":"Send a turn to an agent","description":"One conversational turn. The content assistant is multi-turn and tool-using — it calls the registry tools in-process with your context, so it can only do what your scopes allow — and returns a `sessionId` to carry into the next turn. Single-turn agents (translation) ignore sessions.\n\nProvider failures surface as `502`; an agent the tenant has not configured is a `409`.","security":[{"platformJwt":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentChatRequest"}}}},"responses":{"200":{"description":"The agent's reply","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AgentChatResponse"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Unknown agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"That agent is not configured for this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"$ref":"#/components/responses/UpstreamError"}}}},"/agentic/chat/step":{"post":{"tags":["Agentic"],"summary":"Advance a tool-using agent by one bounded invocation","description":"A tool-using turn can need more model round-trips than the deployment allows a single request to live for. This route runs the loop under a wall-clock budget and hands it back rather than risking the platform's function timeout: `status: \"continue\" means the run suspended with its transcript persisted — call again with the same `sessionId` and NO `message` to resume — while `status: \"done\" carries the final answer in `message`.\n\nThe caller drives the loop, so a run stays bound to whoever started it instead of continuing unwatched. `iteration`/`maxIterations` are the progress line, and the cap spans invocations. Sending a `message` on a thread whose run is still in flight abandons that run and starts a new turn.\n\nBYOK (postgres) mode only — emporix mode owns its own run lifetime. Single-turn agents (translation) have no stepped form and return `400`.","security":[{"platformJwt":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentStepRequest"}}}},"responses":{"200":{"description":"The run advanced, and finished when `status` is `done`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentStepResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Unknown agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"That agent is not configured for this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"$ref":"#/components/responses/UpstreamError"}}}},"/schema":{"get":{"tags":["Schema"],"summary":"Provisioning status","description":"Which CMS custom-entity types exist on the tenant, how each mixin schema compares with the definition this cms-api ships (missing and extra attributes), and which CMS IAM scopes and default groups exist. Optional types (the component-usage index and the migration ledger) are reported with `optional: true` and never count against `allInitialized`. The schema comparison is only made once every required type exists. A caller who may not read IAM gets the scope and group entries marked with an `error` instead of a failure.","security":[{"platformJwt":[]}],"responses":{"200":{"description":"Provisioning status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaStatusResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"502":{"$ref":"#/components/responses/UpstreamError"}}},"post":{"tags":["Schema"],"summary":"Provision or update","description":"`create` provisions every type, schema, scope and group that is missing. `update` additionally brings existing schemas up to the shipped definition; both are idempotent and never delete instances. Updating a schema is versioning on Emporix: instances written before keep the old definition. Both need `medienwerft.cms.admin`.\n\n`bootstrap-iam` creates only the CMS scopes, access controls and default groups. It does not need `medienwerft.cms.admin` (which cannot exist before it has run): Emporix authorizes it against the caller's own IAM-management permissions. It never adds anybody to a group.\n\nIAM texts are written only in languages the tenant defines; each of them gets our translation, or the English text where we have none, so no language is left empty (this also covers a tenant without `en`). cms-api reads the list from the tenant, which needs `configuration.configuration_view` on the caller; without it, the optional `languages` sent by the admin UI are used, and failing that English.","security":[{"platformJwt":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string","enum":["create","update","bootstrap-iam"]},"languages":{"type":"array","description":"`bootstrap-iam` only, optional: the tenant languages as the admin UI knows them (ids or `{ id, default }`), used when cms-api cannot read them itself.","items":{"oneOf":[{"type":"string"},{"type":"object","properties":{"id":{"type":"string"},"default":{"type":"boolean"}},"required":["id"]}]}}},"required":["action"]},"example":{"action":"update"}}}},"responses":{"200":{"description":"Done. `bootstrap-iam` answers with the scopes it created and per-item errors; the others with `{ ok: true }`.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"ok":{"type":"boolean"}}},{"type":"object","properties":{"scopesCreated":{"type":"array","items":{"type":"string"}},"errors":{"type":"array","items":{"type":"string"}}},"required":["scopesCreated","errors"]}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"502":{"$ref":"#/components/responses/UpstreamError"}}}},"/schema/page-tree":{"get":{"tags":["Schema"],"summary":"Page-tree check: status","description":"The one-time page-tree check repairs damage left by an earlier folder id that contained only the slug: creating `/support/docs` while `/products/docs` existed moved the existing `docs` folder (and the pages in it) under `/support`. This status call does not scan. It says whether the caller may run the repair (`page.write`), whether the tenant has a migration ledger (the optional `STOREFRONT_CMS_MIGRATION` type), and the tenant's recorded outcome, if any. The editor shows its hint only while `record` is null.","security":[{"platformJwt":[]}],"responses":{"200":{"description":"Status of the check for this tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageTreeCheckStatus"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"502":{"$ref":"#/components/responses/UpstreamError"}}}},"/schema/page-tree/scan":{"post":{"tags":["Schema"],"summary":"Page-tree check: scan","description":"Reads every page and folder of the tenant and returns, per site and locale, which folders a repair would re-create and which pages it would move. Changes no content. A POST because a clean scan by a caller with `page.write` records `checked` in the tenant's migration ledger. The scan reads the whole tenant, so the editor runs it only on request.","security":[{"platformJwt":[]}],"responses":{"200":{"description":"The findings, and whether a record was written","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageTreeScanResult"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"502":{"$ref":"#/components/responses/UpstreamError"}}}},"/schema/page-tree/repair":{"post":{"tags":["Schema"],"summary":"Page-tree check: repair","description":"Re-creates each lost folder at its original path (named like the folder that took over its slug, missing parent folders first) and moves the affected pages, every version, back under it. Never changes a page's address, id or published content, never deletes anything, and does nothing on a tree that is already in order. A folder emptied by the repair stays where it is. Raises no webhook events and triggers no storefront revalidation, because nothing a storefront reads changes. Records `applied` (or `checked` when there was nothing to do) in the tenant's migration ledger. Needs `page.write`.","security":[{"platformJwt":[]}],"responses":{"200":{"description":"What was changed, and whether a record was written","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageTreeRepairResult"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"502":{"$ref":"#/components/responses/UpstreamError"}}}},"/schema/page-tree/dismiss":{"post":{"tags":["Schema"],"summary":"Page-tree check: dismiss","description":"Records `dismissed` in the tenant's migration ledger: the hint was acknowledged without running the check. The check stays available in Settings → Schema. Needs `page.write`. Without a ledger nothing is recorded (`recorded: false`); the editor then remembers the dismissal in the browser.","security":[{"platformJwt":[]}],"responses":{"200":{"description":"The record, and whether it was written","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MigrationRecordResult"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"502":{"$ref":"#/components/responses/UpstreamError"}}}},"/health":{"get":{"tags":["System"],"summary":"Liveness / readiness","description":"Public probe. Reports the store mode and, when backed by a database, a cheap round-trip (`dbOk`) and the Service Hub connection (`hub`). 503 if the DB check fails; the Hub does not affect the status.","security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"mode":{"type":"string"},"dbOk":{"type":["boolean","null"]},"hub":{"type":["string","null"],"enum":["ok","unauthorized","unreachable","not_configured",null],"description":"Postgres mode: the Service Hub that answers sites, users and AI configuration. null in emporix mode."},"version":{"type":"string","description":"The deployed build of cms-api."}}}}}},"503":{"description":"Degraded","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"mode":{"type":"string"},"dbOk":{"type":["boolean","null"]},"hub":{"type":["string","null"],"enum":["ok","unauthorized","unreachable","not_configured",null],"description":"Postgres mode: the Service Hub that answers sites, users and AI configuration. null in emporix mode."},"version":{"type":"string","description":"The deployed build of cms-api."}}}}}}}}},"/version":{"get":{"tags":["System"],"summary":"Deployed build","description":"Public. Which build of cms-api is answering — the product version and the short commit hash. Unauthenticated on purpose: the question comes up during a rollout, or from a storefront integrator who holds no credential here.","security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"service":{"type":"string"},"version":{"type":"string","description":"Product version, shared across the CMS deployables."},"commit":{"type":"string","description":"Short commit hash, or `unknown` where the build had neither git nor CI metadata."},"mode":{"type":"string"}}}}}}}}}},"webhooks":{"contentLifecycle":{"post":{"tags":["Webhooks"],"summary":"A content lifecycle event","description":"Sent once per event to every enabled webhook whose events (and sites, if set) match. `type` is `<kind>.<action>` — kind `page | layout | theme | component`, action `created | updated | deleted | submitted | withdrawn | approved | rejected | published | restored` — or `webhook.test` from Send test. Every test send (including a sample of a real type) carries `test: true`, and real events never do. The body is deliberately small; fetch the content itself from the API. Answer 2xx within 3 seconds to acknowledge; anything else, a timeout, or a redirect is retried with backoff for about two days. Retries carry the same `webhook-id`, so de-duplicate on it. Auth is whatever the webhook is configured with: a custom header, `Authorization: Basic`, or `Authorization: Bearer`.","parameters":[{"name":"webhook-id","in":"header","required":true,"schema":{"type":"string"},"description":"The event id; stable across retries."},{"name":"webhook-timestamp","in":"header","required":false,"schema":{"type":"string"},"description":"Unix seconds. Present when signing is on."},{"name":"webhook-signature","in":"header","required":false,"schema":{"type":"string"},"description":"`v1,<base64 HMAC-SHA256>` over `${webhook-id}.${webhook-timestamp}.${body}`, keyed with the `whsec_` secret. Present when signing is on."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Acknowledged. The body is ignored."}}}}},"components":{"securitySchemes":{"cmsApiKey":{"type":"apiKey","in":"header","name":"X-CMS-API-Key","description":"Your tenant's CMS API key (self-identifying, read-only). Generate/rotate it in the CMS under Settings → API key."},"platformJwt":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"The platform JWT, for the `/agentic` and `/schema` surfaces — a user credential, not the storefront key. Tenant and scopes are derived from it. Sent as `Authorization: Bearer …`; the `emporix-token` header is accepted as an alternative name so one deployment serves both auth modes."}},"responses":{"BadRequest":{"description":"Missing or invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"Missing or invalid credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"No verified live content for that request. Only ever means the content is absent: a failure to read it is a 403, 502 or 503, never a 404.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"UpstreamForbidden":{"description":"Emporix mode: the platform refused the token you sent (code `upstream_forbidden`), e.g. a storefront token without the scope to read CMS content. Use a token that has it; retrying will not help.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"UpstreamUnavailable":{"description":"The upstream platform is rate-limiting or temporarily unavailable (code `upstream_rate_limited`). Retry later; keep serving what you have cached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"The caller lacks the scope this route needs (code `forbidden`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"MethodNotAllowed":{"description":"Wrong method for this route","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"UpstreamError":{"description":"The AI provider or the upstream platform failed (on storefront routes: code `upstream_error`). Not a statement about the content: keep serving what you have cached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string","description":"Machine-readable reason, when there is one (e.g. `not_found`, `upstream_error`, `upstream_rate_limited`, `upstream_forbidden`). Match on this, not on the message."},"details":{"type":"object","additionalProperties":true,"description":"Structured facts behind some errors, to build your own message from. A 409 for a path collision in the page tree (`folder_exists`, `page_at_path`, `folder_at_path`) carries `url` and `name` of the node already at that path."}},"required":["error"]},"SchemaStatusResponse":{"type":"object","properties":{"entities":{"type":"object","description":"Per custom-entity type `{ entityType, exists, error?, optional? }`, keyed `cmsPage`, `cmsComponent`, `cmsSettings`, `cmsLayout`, `cmsTheme`, `cmsMedia`, `cmsFolder`, `cmsComponentUsage` (optional), `cmsMigration` (optional), plus `allInitialized`.","additionalProperties":true},"comparison":{"type":"array","items":{"type":"object","properties":{"schemaId":{"type":"string"},"optional":{"type":"boolean"},"isUpToDate":{"type":"boolean"},"missingAttributes":{"type":"array","items":{"type":"string"}},"extraAttributes":{"type":"array","items":{"type":"string"}}}}},"scopes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"exists":{"type":"boolean"},"error":{"type":"string"}}}},"groups":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"exists":{"type":"boolean"},"error":{"type":"string"}}}}}},"MigrationRecord":{"type":"object","description":"One entry of the tenant's data-migration ledger (Emporix: `STOREFRONT_CMS_MIGRATION`).","properties":{"id":{"type":"string","description":"Migration id.","example":"page-tree-repair"},"status":{"type":"string","enum":["checked","applied","dismissed"],"description":"`checked`: nothing to do. `applied`: ran and changed data. `dismissed`: acknowledged without running."},"completedAt":{"type":"string","format":"date-time"},"completedBy":{"type":"string","description":"User id of whoever set the status."},"version":{"type":"string","description":"Version of the migration logic that set the status."},"details":{"type":"object","additionalProperties":true,"description":"Migration-specific results, e.g. `{ foldersCreated, pagesMoved }`."}},"required":["id","status"]},"MigrationRecordResult":{"type":"object","properties":{"recorded":{"type":"boolean","description":"The outcome was written to the tenant's migration ledger. False without a ledger, and for a scan that found something or was run without `page.write`."},"record":{"oneOf":[{"$ref":"#/components/schemas/MigrationRecord"},{"type":"null"}]}},"required":["recorded","record"]},"PageTreeCheckStatus":{"type":"object","properties":{"applies":{"type":"boolean","description":"The check exists for this store: true on Emporix, false on postgres (repaired by a database migration on deploy). Clients show nothing when false."},"canRepair":{"type":"boolean","description":"The caller holds `page.write`."},"ledger":{"type":"boolean","description":"The tenant has the optional migration ledger. Without it nothing can be recorded; run Settings → Schema → Update to add it."},"record":{"oneOf":[{"$ref":"#/components/schemas/MigrationRecord"},{"type":"null"}]}},"required":["applies","canRepair","ledger","record"]},"TreeRepairPlan":{"type":"object","description":"The repair for one site and locale.","properties":{"site":{"type":"string"},"locale":{"type":"string"},"createFolders":{"type":"array","description":"Folders to re-create, parents first.","items":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string","example":"/products/docs"},"slug":{"type":"string"},"name":{"type":"string"},"parent_id":{"type":"string"}},"required":["id","url","slug","name"]}},"moves":{"type":"array","description":"Pages to move; every version of each moves, its url never changes.","items":{"type":"object","properties":{"baseId":{"type":"string"},"url":{"type":"string","example":"/products/docs/manual"},"title":{"type":"string"},"fromParentId":{"type":"string"},"fromUrl":{"type":"string","example":"/support/docs","description":"Where the page hung before; absent when the old folder had no resolvable path."},"toParentId":{"type":"string"}},"required":["baseId","url","title","fromParentId","toParentId"]}}},"required":["site","locale","createFolders","moves"]},"PageTreeScanResult":{"type":"object","properties":{"canRepair":{"type":"boolean"},"plans":{"type":"array","items":{"$ref":"#/components/schemas/TreeRepairPlan"},"description":"Empty when the tree is in order."},"recorded":{"type":"boolean","description":"The outcome was written to the tenant's migration ledger. False without a ledger, and for a scan that found something or was run without `page.write`."},"record":{"oneOf":[{"$ref":"#/components/schemas/MigrationRecord"},{"type":"null"}]}},"required":["canRepair","plans"]},"PageTreeRepairResult":{"type":"object","properties":{"foldersCreated":{"type":"integer"},"pagesMoved":{"type":"integer"},"plans":{"type":"array","items":{"$ref":"#/components/schemas/TreeRepairPlan"},"description":"What the repair applied."},"recorded":{"type":"boolean","description":"The outcome was written to the tenant's migration ledger. False without a ledger, and for a scan that found something or was run without `page.write`."},"record":{"oneOf":[{"$ref":"#/components/schemas/MigrationRecord"},{"type":"null"}]}},"required":["foldersCreated","pagesMoved","plans"]},"CMSComponent":{"type":"object","description":"The render unit. Look up `type` in your storefront component registry and pass `props`.","properties":{"id":{"type":"string"},"type":{"type":"string"},"props":{"type":"object","additionalProperties":true,"description":"Component inputs — including media CDN URLs baked in at edit time."},"children":{"type":"array","items":{"$ref":"#/components/schemas/CMSComponent"}}},"required":["id","type","props"]},"DesignDefinition":{"type":"object","description":"The `design` block of a Component Library entry.","properties":{"type":{"type":"string","description":"Component type in the editor palette, `design:<slug>`.","example":"design:promo-tile"},"label":{"type":"string","description":"Palette label.","example":"Promo Tile"},"level":{"type":"integer","enum":[1,2],"description":"1 = Saved Design (a composition with editable fields). 2 = Data-Driven Design (adds bindings, repeats and conditions)."},"description":{"type":"string"},"exposedProps":{"type":"array","description":"The design's editable fields.","items":{"type":"object","properties":{"name":{"type":"string","description":"Prop name a placement stores the value under.","example":"headline"},"field":{"type":"object","additionalProperties":true,"description":"Editor field definition (label, type, options, defaultValue, ...), copied from the target component type's prop definition."},"targets":{"type":"array","items":{"type":"string"},"description":"Where the value is written inside the tree: `<nodeId>.<propPath>`.","example":["tile-headline.text"]}},"required":["name","field","targets"]}}},"required":["type","label","level","exposedProps"]},"DesignEntry":{"type":"object","properties":{"id":{"type":"string","description":"Entity id of the library entry."},"base_id":{"type":"string"},"design":{"$ref":"#/components/schemas/DesignDefinition"},"tree":{"$ref":"#/components/schemas/CMSComponent","description":"The design's root component. Level-2 nodes carry `$repeat` (`{ path, as, limit? }`) and `$when` (`{ path, op, value? }`, `{ all: [...] }`, `{ any: [...] }` or `{ not }`) in props; a bound prop value is `{ $bind, fallback?, format? }`."}},"required":["id","design","tree"]},"DesignsResponse":{"type":"object","properties":{"designs":{"type":"array","items":{"$ref":"#/components/schemas/DesignEntry"}}},"required":["designs"]},"CMSPage":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"locale":{"type":"string"},"site":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"url":{"type":"string"},"layout_id":{"type":"string"},"parent_id":{"type":"string"},"is_homepage":{"type":"boolean"},"preview_persona":{"type":"string","description":"Editor-only: the preview persona the CMS editor opens this page with — the id of one of the personas your storefront publishes on its component registry (`personas`, e.g. `customer-with-orders`). Never changes what a visitor sees; a storefront may ignore it."},"components":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/CMSComponent"}},"description":"slotId → ordered components."},"version":{"type":"string"}}},"CMSLayout":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"site":{"type":"string"},"locale":{"type":"string"},"preview_persona":{"type":"string","description":"Editor-only: the preview persona the CMS editor opens this layout with — the id of one of the personas your storefront publishes on its component registry (`personas`, e.g. `customer-with-orders`). Never changes what a visitor sees; a storefront may ignore it."},"contentSlots":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"Where page content is injected."},"components":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/CMSComponent"}}}}},"CMSTheme":{"type":"object","properties":{"id":{"type":"string"},"site":{"type":"string"},"base_theme":{"type":"string","description":"CSS class the overrides target; empty ⇒ body[data-cms-site]."},"variables":{"type":"object","additionalProperties":{"type":"string"},"description":"CSS custom properties to emit as scoped variables."}}},"ToolDefinition":{"type":"object","description":"One tool, as an agent sees it.","properties":{"name":{"type":"string","examples":["list_pages","update_page","publish_page"]},"title":{"type":"string","description":"Human-readable label."},"description":{"type":"string","description":"What the tool does — this is the text the model reasons over when choosing it."},"inputSchema":{"type":"object","additionalProperties":true,"description":"JSON Schema (draft-07) for the arguments, generated from the tool's own validator."},"annotations":{"type":"object","additionalProperties":true,"description":"MCP hints, e.g. whether the tool is read-only or destructive."}},"required":["name","inputSchema"]},"Agent":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"stepped":{"type":"boolean","description":"This agent is driven through `POST /agentic/chat/step` instead of one whole-run request. Set only by the BYOK runtime, which runs the tool loop itself under a function timeout; a backend that owns its own run lifetime omits it."}}},"AgentChatRequest":{"type":"object","properties":{"agentId":{"type":"string","description":"From `GET /agentic/agents`."},"message":{"type":"string","description":"The user's turn. Required and non-empty."},"sessionId":{"type":"string","description":"Continues an existing thread; omit to start one. Ignored by single-turn agents."}},"required":["message"]},"AgentChatResponse":{"type":"object","properties":{"agentId":{"type":"string"},"sessionId":{"type":"string","description":"Pass back on the next turn to keep the thread."},"message":{"type":"string"}}},"AgentStepRequest":{"type":"object","properties":{"agentId":{"type":"string","description":"From `GET /agentic/agents`. Must be a multi-turn agent."},"message":{"type":"string","description":"Starts a turn. OMIT to resume a run that came back as `continue`."},"sessionId":{"type":"string","description":"Required to resume; omit it with a `message` to start a new thread."}},"required":["agentId"]},"AgentStepResponse":{"type":"object","properties":{"agentId":{"type":"string"},"sessionId":{"type":"string","description":"Pass back to resume this run, and on the next turn to keep the thread."},"status":{"type":"string","enum":["continue","done"],"description":"`continue` — call again with this `sessionId` and no `message`."},"iteration":{"type":"integer","description":"Tool-calling rounds spent on this turn so far."},"maxIterations":{"type":"integer","description":"Cap the run stops at, however many invocations it takes."},"lastTool":{"type":"string","description":"Last tool the run executed, when it has called one."},"message":{"type":"string","description":"The final answer. Present only when `status` is `done`."},"interrupted":{"type":"boolean","description":"A model call blew its deadline; the next invocation re-runs that round."}}},"ResolvedPage":{"type":"object","properties":{"page":{"$ref":"#/components/schemas/CMSPage"},"layout":{"oneOf":[{"$ref":"#/components/schemas/CMSLayout"},{"type":"null"}]},"theme":{"oneOf":[{"$ref":"#/components/schemas/CMSTheme"},{"type":"null"}]},"resolvedSite":{"type":"string","description":"May differ from requested via one level of fallback."},"resolvedLocale":{"type":"string"}},"required":["page","resolvedSite","resolvedLocale"]},"WebhookEvent":{"type":"object","properties":{"id":{"type":"string","example":"evt_3f2c9a…"},"type":{"type":"string","example":"page.rejected"},"occurredAt":{"type":"string","format":"date-time"},"tenant":{"type":"string"},"actor":{"type":"object","properties":{"id":{"type":"string","description":"The user (or agent) whose action caused the event."}}},"test":{"type":"boolean","const":true,"description":"Only on test sends, whose data is a sample naming nothing that exists. Absent on real events."},"data":{"type":"object","properties":{"kind":{"type":"string","enum":["page","layout","theme","component"]},"id":{"type":"string"},"baseId":{"type":"string","description":"Stable across versions; use it to fetch the entity."},"site":{"type":"string"},"locale":{"type":["string","null"]},"slug":{"type":"string"},"name":{"type":"string"},"approval":{"type":"object","properties":{"status":{"type":"string"},"reason":{"type":"string"}},"description":"On approval events. `reason` on rejections that gave one."}}}},"required":["id","type","occurredAt","tenant","actor","data"]}}}}