openapi: 3.1.0 # The Flatnode API, as a machine-readable contract. Written by hand next # to the code it describes (ADR 0027); tests/Feature/OpenApiContractTest.php # fails when a route, an ability or a resource's fields drift from it. # # Conventions: # - x-abilities lists the token abilities that satisfy an operation, in # both spellings. A token needs one of them, not all. # - Every identifier is a uuid (ADR 0004). `owner_id` is the one numeric # exception and says so where it appears. # - PUT is an alias of PATCH on document, library, component and content. # The operations are spelled out twice through YAML anchors. info: title: Flatnode API version: "1" summary: An API-first CMS for composable nested content. description: | A project's content is a tree of nodes. Each node is an instance of a **component** (a JSON Schema), and a **document** is a composed page of them. Everything is read and written over this JSON API with a Bearer token that belongs to one project. Most responses share one envelope: `{"message": "...", "data": ...}`, with a `pager` beside them on a paged listing. The reads that answer a rendered content tree (`GET /document/{uuid}`, `GET /document/by-slug/{slug}`, `GET /content/{uuid}`) answer the tree itself, and `PATCH /document/{uuid}` and `GET /tree/{uuid}` answer a bare resource. Each is spelled out. Every successful response carries `X-Quota-Limit`, `X-Quota-Remaining` and `X-Quota-Reset`. A `429` carries them too, plus `Retry-After`. The prose documentation is at https://docs.flatnode.net. contact: url: https://docs.flatnode.net license: name: Proprietary url: https://admin.flatnode.net/terms externalDocs: description: Flatnode API documentation url: https://docs.flatnode.net/api/ servers: - url: https://admin.flatnode.net/api/v1 description: Production security: - bearerAuth: [] tags: - name: Project description: The entry point. What the token's project is, which languages it publishes in, and where its page tree starts. - name: Documents description: The page tree. A document is a node with a slug and a position among its siblings, and holds exactly one content root. - name: Content description: Nodes holding values against a component, with a version workflow and translations. - name: Components description: Schemas, as JSON Schema over a closed vocabulary, with drafts, published versions and handles. - name: Files description: Uploads, on-the-fly image rendering, named variants and downloads. - name: Folders description: The asset tree's folders. Gated by the `file` abilities. - name: Variant definitions description: A project's named crop and transform rules, keyed by name. - name: Libraries description: Filterable collections of entries sharing one component, and the relations derived between them. - name: Search description: Full-text search across the project. - name: Validation description: Ask whether a content write would be accepted, without writing. paths: # ------------------------------------------------------------------ Project /project: get: tags: [Project] operationId: getProject summary: The project behind the token description: | Where to start: the one call that needs nothing but a token. It answers the project's title, the locales it publishes in with the default first, the root of its page tree as a full document (`null` on an empty project, or when the caller may not read it), the publishing `workflow` a writer has to follow, and the `token`'s own abilities. Walk down from `root` with `GET /tree/{uuid}`. No ability is required: a write-only integration has to be able to ask what it may do before it writes. The root is a document, so it alone needs `document.read` or `read`, and is `null` otherwise. x-abilities: [] responses: "200": description: The project. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: { $ref: "#/components/schemas/Project" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "429": { $ref: "#/components/responses/TooManyRequests" } # ---------------------------------------------------------------- Documents /document: get: tags: [Documents] operationId: listDocuments summary: List documents description: | Every document the caller may read, each in the same shape as every other document endpoint answers: the root is the row whose `parent` is null, and `slug`, `parent`, `published` and the tree bounds are there so a consumer need not walk `GET /tree/{uuid}` to learn them. Pass `offset` or `limit` to page. Library container documents are left out. x-abilities: [document.read, read] parameters: - $ref: "#/components/parameters/offset" - $ref: "#/components/parameters/limit" responses: "200": description: The listing. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: pager: { $ref: "#/components/schemas/Pager" } data: type: array items: { $ref: "#/components/schemas/Document" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } post: tags: [Documents] operationId: createDocument summary: Create a document description: | A new document is empty: which component sits at its root is decided by the first `POST /content` that names it without a `parent`. A project's documents form one tree with a single root; omit `parent` for the very first document, or to append under that root. x-abilities: [document.create, create] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/DocumentCreate" } responses: "201": description: The document, under `document`. content: application/json: schema: type: object required: [message, document] properties: message: { type: string, examples: ["document created"] } document: { $ref: "#/components/schemas/Document" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /document/{uuid}: parameters: - $ref: "#/components/parameters/uuid" get: tags: [Documents] operationId: getDocument summary: Render a document description: | The document's live content tree, resolved for the caller: an API token sees promoted versions inside their reveal/conceal window, block by block. An empty document, or one whose root has nothing live, answers only `_document`. x-abilities: [document.read, read] parameters: - $ref: "#/components/parameters/locale" - $ref: "#/components/parameters/richtext" - name: includeConfiguration in: query schema: { type: boolean } description: Accepted for the editor; a public token's render never carries a schema. responses: "200": description: The rendered tree. content: application/json: schema: { $ref: "#/components/schemas/DocumentRender" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } patch: &updateDocument tags: [Documents] operationId: updateDocument summary: Rename, move or re-permission a document description: | Any subset of the fields. `parent` with `position` moves the document under another; `insertBefore` / `insertAfter` moves it next to a sibling. The two forms cannot be combined. `group` needs the `content.permissions` ability on top of `document.update`. x-abilities: [document.update, update] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/DocumentUpdate" } responses: "200": description: The updated document - the resource itself, with no envelope. content: application/json: schema: { $ref: "#/components/schemas/Document" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } put: <<: *updateDocument operationId: updateDocumentPut summary: Alias of PATCH delete: tags: [Documents] operationId: deleteDocument summary: Delete a document and everything under it description: | A hard, cascading delete of the document and every content row beneath it. Deleting the project's root document wipes the whole tree. Needs the node's own write bits as well as the ability. x-abilities: [document.delete, delete] responses: "200": description: Deleted. The body is empty. "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": description: No such document. content: application/json: schema: { $ref: "#/components/schemas/ValidationError" } "429": { $ref: "#/components/responses/TooManyRequests" } /document/by-slug/{slug}: get: tags: [Documents] operationId: getDocumentBySlug summary: Render a document by slug description: Same answer as `GET /document/{uuid}`, addressed by the document's slug - one leaf segment, unique per project. To resolve a whole path, use `GET /document/by-path`. x-abilities: [document.read, read] parameters: - name: slug in: path required: true schema: { type: string } - $ref: "#/components/parameters/locale" - $ref: "#/components/parameters/richtext" - name: includeConfiguration in: query schema: { type: boolean } responses: "200": description: The rendered tree. content: application/json: schema: { $ref: "#/components/schemas/DocumentRender" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /document/by-path: get: tags: [Documents] operationId: getDocumentByPath summary: Render a document by path description: Same answer as `GET /document/{uuid}`, addressed by the document's `path` - its ancestors' slugs and its own, joined with `/`. The empty path is the project root. An unknown path and a document the token may not read both answer 404. x-abilities: [document.read, read] parameters: - name: path in: query required: true allowEmptyValue: true schema: { type: string, maxLength: 255 } description: "Slash-joined path from the root, as every Document resource answers it under `path`, e.g. `about/team`. Empty for the root. Leading and trailing slashes are ignored." - $ref: "#/components/parameters/locale" - $ref: "#/components/parameters/richtext" - name: includeConfiguration in: query schema: { type: boolean } responses: "200": description: The rendered tree. content: application/json: schema: { $ref: "#/components/schemas/DocumentRender" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /document/{uuid}/versions: parameters: - $ref: "#/components/parameters/uuid" get: tags: [Documents, Content] operationId: listDocumentVersions summary: List a document's root versions description: | Every version of the document's root content, newest first, whatever its status - the way back to a draft when the uuid from `POST /content` was not kept. Gated like `GET /content/{uuid}/versions`, because what is listed is content. x-abilities: [content.read, read] parameters: - $ref: "#/components/parameters/locale" responses: "200": description: The versions. An empty document answers an empty `data`. content: application/json: schema: { $ref: "#/components/schemas/VersionListingEnvelope" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /document/{uuid}/duplicate: parameters: - $ref: "#/components/parameters/uuid" post: tags: [Documents] operationId: duplicateDocument summary: Duplicate a document and its subtree description: Deep-copies the document, its descendants and their content, with fresh uuids and slugs, as a new last sibling. The project root cannot be duplicated. x-abilities: [document.create, create] responses: "201": description: The copy, under `document`. content: application/json: schema: type: object required: [message, document] properties: message: { type: string, examples: ["document duplicated"] } document: { $ref: "#/components/schemas/Document" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /tree/{uuid}: parameters: - $ref: "#/components/parameters/uuid" get: tags: [Documents] operationId: getDocumentChildren summary: List a document's direct children description: | The direct children only, each a full document resource, as a bare array. Walk down by calling this again for a child whose `treeRight - treeLeft > 1`; skip one whose `published` is false. x-abilities: [document.read, read] responses: "200": description: The children. An empty array means none. content: application/json: schema: type: array items: { $ref: "#/components/schemas/Document" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "429": { $ref: "#/components/responses/TooManyRequests" } # ------------------------------------------------------------------ Content /content: get: tags: [Content] operationId: listContent summary: Not a listing deprecated: true description: | Answers an empty array and nothing else. Content is reached through a document (`GET /document/{uuid}`, `GET /document/{uuid}/versions`) or a library (`GET /library/{uuid}/entries`); a project-wide listing is open work (backlog 0052). x-abilities: [content.read, read] responses: "200": description: Always an empty array. content: application/json: schema: { type: array, maxItems: 0, items: {} } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "429": { $ref: "#/components/responses/TooManyRequests" } post: tags: [Content] operationId: createContent summary: Create content description: | A new node built from `ComponentId`, in `DocumentId`. Without `parent` it becomes the document's root - allowed once per document. With `parent` it is composed into a slot of an existing node. `data` is the value, validated against the component's published schema. New content is a **draft**: it renders nowhere until `POST /content/{uuid}/promote`. Keep the `_uuid` from the response. x-abilities: [content.create, create] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/ContentCreate" } responses: "201": description: The new node, rendered - or, when adding an item to an array-of-slots field without a `ComponentId`, the new empty slot. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: oneOf: - $ref: "#/components/schemas/RenderedNode" - $ref: "#/components/schemas/NewSlot" parent: type: object description: >- Present only when the slot asked for mounts another and the child was inserted there instead: the slot it actually landed in, addressed the way a request addresses one. required: [HostContentId] properties: HostContentId: { type: string, format: uuid } Slot: { type: string } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /content/{uuid}: parameters: - $ref: "#/components/parameters/uuid" get: tags: [Content] operationId: getContent summary: Render one version description: | The version the uuid names, rendered. An API token reads a version's values only once it is published - a draft, a scheduled, a withdrawn or a discarded version is a `404`, indistinguishable from a uuid that does not exist (ADR 0025). The editor's own session reads any version. x-abilities: [content.read, read] parameters: - $ref: "#/components/parameters/richtext" responses: "200": description: The rendered node, with no envelope. content: application/json: schema: { $ref: "#/components/schemas/RenderedNode" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "429": { $ref: "#/components/responses/TooManyRequests" } patch: &updateContent tags: [Content] operationId: updateContent summary: Update a version's value description: | The body carries the new value under `_value` (or the whole payload under `data`). **A body with neither key saves nothing and still answers 200.** Validated against the component version the content was created under. x-abilities: [content.update, update] requestBody: required: true content: application/json: schema: type: object properties: _value: description: The new value, in the shape the component's schema declares. data: description: Alternative spelling of `_value`. examples: - { _value: "updated text" } - { _value: { title: "Home", intro: "…" } } responses: "200": description: Updated. content: application/json: schema: { $ref: "#/components/schemas/Message" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } put: <<: *updateContent operationId: updateContentPut summary: Alias of PATCH delete: tags: [Content] operationId: deleteContent summary: Hard-delete one version description: | Removes exactly the version the uuid names, with everything composed into it, and nothing else (ADR 0023). Sibling versions stay. The workflow's own way to retire something is `discard` or `withdraw`; this bypasses it, which is why it needs `content.delete`. x-abilities: [content.delete, delete] responses: "200": description: Deleted. content: application/json: schema: { $ref: "#/components/schemas/Message" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": description: No such content. content: application/json: schema: { $ref: "#/components/schemas/ValidationError" } "429": { $ref: "#/components/responses/TooManyRequests" } /content/{uuid}/translations: parameters: - $ref: "#/components/parameters/uuid" post: tags: [Content] operationId: createTranslation summary: Start a translation description: | Copies the version as a draft filed under `locale`, a sibling version in another language (ADR 0008). The project must publish in that locale. Calling it twice for one locale adds a second version to that language's chain. x-abilities: [content.create, create] requestBody: required: true content: application/json: schema: type: object required: [locale] properties: locale: { type: string, examples: [en] } responses: "201": description: The new draft. content: application/json: schema: type: object required: [message, locale, content] properties: message: { type: string, examples: ["translation created."] } locale: { type: string } content: { $ref: "#/components/schemas/RenderedNode" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /content/{uuid}/versions: parameters: - $ref: "#/components/parameters/uuid" get: tags: [Content] operationId: listContentVersions summary: List a lineage's versions description: Every sibling version of the lineage the uuid belongs to, newest first. `is_current` is answered per language, so pass `locale` on a multilingual project. x-abilities: [content.read, read] parameters: - $ref: "#/components/parameters/locale" responses: "200": description: The versions. content: application/json: schema: { $ref: "#/components/schemas/VersionListingEnvelope" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } post: tags: [Content] operationId: createContentVersion summary: Clone a version into a new draft x-abilities: [content.create, create] responses: "201": description: The new draft, an ordinary node to edit and promote. content: application/json: schema: type: object required: [message, content] properties: message: { type: string, examples: ["version created."] } content: { $ref: "#/components/schemas/RenderedNode" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /content/{uuid}/submit: parameters: - $ref: "#/components/parameters/uuid" post: tags: [Content] operationId: submitContentVersion summary: Submit a draft for approval description: "`draft` → `pending_approval`." x-abilities: [content.update, update] responses: "200": { $ref: "#/components/responses/VersionTransition" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /content/{uuid}/approve: parameters: - $ref: "#/components/parameters/uuid" post: tags: [Content] operationId: approveContentVersion summary: Approve a submitted version description: "`pending_approval` → `approved`. Approving your own submission is a `422` unless the project allows self-approval." x-abilities: [content.approve, approve] responses: "200": { $ref: "#/components/responses/VersionTransition" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /content/{uuid}/reject: parameters: - $ref: "#/components/parameters/uuid" post: tags: [Content] operationId: rejectContentVersion summary: Reject a submitted version description: "`pending_approval` → `rejected`. Terminal; create a new version to try again." x-abilities: [content.approve, approve] requestBody: content: application/json: schema: type: object properties: reason: { type: [string, "null"], maxLength: 500 } responses: "200": { $ref: "#/components/responses/VersionTransition" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /content/{uuid}/schedule: parameters: - $ref: "#/components/parameters/uuid" post: tags: [Content] operationId: scheduleContentVersion summary: Set or clear a version's reveal and conceal window description: Works at any non-terminal status, before or after promotion. Send `null` to clear a bound. x-abilities: [content.publish, publish] requestBody: content: application/json: schema: type: object properties: reveal_at: { type: [string, "null"], format: date-time } conceal_at: { type: [string, "null"], format: date-time, description: "Must be after `reveal_at`." } responses: "200": { $ref: "#/components/responses/VersionTransition" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /content/{uuid}/promote: parameters: - $ref: "#/components/parameters/uuid" post: tags: [Content] operationId: promoteContentVersion summary: Publish a version description: "`draft` or `approved` → `promoted`. The newest promoted version inside its window is what renders. A slot child has its own lifecycle; promoting its host does not promote it." x-abilities: [content.publish, publish] responses: "200": { $ref: "#/components/responses/VersionTransition" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /content/{uuid}/withdraw: parameters: - $ref: "#/components/parameters/uuid" post: tags: [Content] operationId: withdrawContentVersion summary: Unpublish a version description: "`promoted` → `withdrawn`. Does not promote a replacement." x-abilities: [content.publish, publish] responses: "200": { $ref: "#/components/responses/VersionTransition" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /content/{uuid}/discard: parameters: - $ref: "#/components/parameters/uuid" delete: tags: [Content] operationId: discardContentVersion summary: Retire an unsubmitted draft description: "`draft` → `discarded`. Kept on record, never hard-deleted." x-abilities: [content.update, update] responses: "200": { $ref: "#/components/responses/VersionTransition" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /content/{uuid}/permissions: parameters: - $ref: "#/components/parameters/uuid" patch: tags: [Content] operationId: updateContentPermissions summary: Change who may write a node description: | Sets the node's mode bits, and optionally its group (one role, by slug) and owner. Governance rather than editing, so it needs `content.permissions`, which `content.update` does not imply (ADR 0017, 0019). x-abilities: [content.permissions, permissions] requestBody: required: true content: application/json: schema: type: object required: [permissions] properties: permissions: { $ref: "#/components/schemas/Mode" } group: type: string description: A role slug, or `project` for every member. owner_id: type: [integer, "null"] description: The one numeric identifier in the API - a user id. Predates ADR 0004. responses: "200": description: The lock as written, on the version wrapper. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: type: object required: [_uuid, permissions, owner_id, group] properties: _uuid: type: string format: uuid description: The wrapper's uuid - what a render reports as `_entry`. permissions: { $ref: "#/components/schemas/Mode" } owner_id: { type: [integer, "null"] } group: { type: [string, "null"], description: "Null if the role it named has been deleted." } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } # --------------------------------------------------------------- Components /component: get: tags: [Components] operationId: listComponents summary: List components description: Every component in the project, each with its published schema under `schema`. Library container components are left out. x-abilities: [component.read, read] responses: "200": description: The listing. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: type: array items: { $ref: "#/components/schemas/ComponentWithSchema" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "429": { $ref: "#/components/responses/TooManyRequests" } post: tags: [Components] operationId: createComponent summary: Create a component description: | The body **is** the JSON Schema document; its `title` doubles as the component's name and must be unique in the project. It is checked against the closed vocabulary and published as version 1. A handle is set afterwards with `PATCH /component/{uuid}/metadata`. x-abilities: [component.create, create] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/JsonSchema" } responses: "201": description: The component. The schema is not echoed back; `GET /component/{uuid}` serves it. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: { $ref: "#/components/schemas/Component" } "200": description: A component with this title already exists. Nothing was created. content: application/json: schema: { $ref: "#/components/schemas/Message" } "401": { $ref: "#/components/responses/Unauthorized" } "402": { $ref: "#/components/responses/PlanLimit" } "403": { $ref: "#/components/responses/Forbidden" } "422": { $ref: "#/components/responses/SchemaInvalid" } "429": { $ref: "#/components/responses/TooManyRequests" } /component/{uuid}: parameters: - $ref: "#/components/parameters/uuid" get: tags: [Components] operationId: getComponent summary: Get a component and its published schema x-abilities: [component.read, read] responses: "200": description: The component, with `schema` carrying the published document plus a `$id` naming it. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: { $ref: "#/components/schemas/ComponentWithSchema" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "429": { $ref: "#/components/responses/TooManyRequests" } patch: &updateComponent tags: [Components] operationId: saveComponentDraft summary: Save a schema draft description: | The body is the whole JSON Schema document. It is saved as a new version and **not** published - content keeps validating against the live version until `POST /component/{uuid}/versions/{version}/publish`. x-abilities: [component.update, update] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/JsonSchema" } responses: "200": description: Saved. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: type: object required: [version, publishedVersion] properties: version: { type: integer, description: "The draft's version number." } publishedVersion: { type: integer } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/SchemaInvalid" } "429": { $ref: "#/components/responses/TooManyRequests" } put: <<: *updateComponent operationId: saveComponentDraftPut summary: Alias of PATCH delete: tags: [Components] operationId: deleteComponent summary: Delete a component description: Refused with `409` while any content or library is built from it; there is no cascade, because the content *is* the component. x-abilities: [component.delete, delete] responses: "200": description: Deleted. content: application/json: schema: { $ref: "#/components/schemas/Message" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "409": description: Still in use. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: { $ref: "#/components/schemas/ComponentInUse" } "422": description: No such component. content: application/json: schema: { $ref: "#/components/schemas/ValidationError" } "429": { $ref: "#/components/responses/TooManyRequests" } /component/{uuid}/metadata: parameters: - $ref: "#/components/parameters/uuid" patch: tags: [Components] operationId: updateComponentMetadata summary: Rename, describe or set the handle description: Applies immediately to the live schema and any draft, with no publish step - none of this reshapes stored data. x-abilities: [component.update, update] requestBody: required: true content: application/json: schema: type: object required: [title] properties: title: { type: string, maxLength: 255, description: "Must stay unique in the project." } description: { type: [string, "null"] } handle: type: [string, "null"] maxLength: 64 pattern: "^[a-z][a-z0-9]*(-[a-z0-9]+)*$" description: Omit to leave the handle alone; send `""` to clear it. Unique per project. responses: "200": description: The component, same shape as `GET /component/{uuid}`. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: { $ref: "#/components/schemas/ComponentWithSchema" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /component/{uuid}/versions: parameters: - $ref: "#/components/parameters/uuid" get: tags: [Components] operationId: listComponentVersions summary: List a component's schema versions x-abilities: [component.read, read] responses: "200": description: Every saved snapshot, with whether it is the published one and how much content is pinned to it. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: type: array items: { $ref: "#/components/schemas/ComponentVersion" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "429": { $ref: "#/components/responses/TooManyRequests" } /component/{uuid}/versions/{version}/publish: parameters: - $ref: "#/components/parameters/uuid" - $ref: "#/components/parameters/version" post: tags: [Components] operationId: publishComponentVersion summary: Publish or restore a schema version description: Makes that snapshot the live schema. Content created before stays pinned to the version it was created under. x-abilities: [component.update, update] responses: "200": description: Published. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: type: object required: [publishedVersion] properties: publishedVersion: { type: integer } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/SchemaInvalid" } "429": { $ref: "#/components/responses/TooManyRequests" } /component/{uuid}/publish: parameters: - $ref: "#/components/parameters/uuid" post: tags: [Components] operationId: saveAndPublishComponent summary: Save a schema and publish it in one step description: | The body is the full schema, as for `PATCH /component/{uuid}`. While nothing uses the component - no content, no library built on it, no other component referencing it - the schema is written in place over the one published version and the version counter does not move. Once something does use it, this is a draft save followed by a publish: a new version, published, with existing content pinned to its own. The response's `mode` says which happened. x-abilities: [component.update, update] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/JsonSchema" } responses: "200": description: Saved and live. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: type: object required: [version, publishedVersion, mode] properties: version: { type: integer } publishedVersion: { type: integer } mode: type: string enum: [replaced, versioned, unchanged] description: "`replaced` rewrote the published version in place; `versioned` created and published a new one; `unchanged` means the body was already the published schema." "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/SchemaInvalid" } "429": { $ref: "#/components/responses/TooManyRequests" } /component/{uuid}/usage: parameters: - $ref: "#/components/parameters/uuid" get: tags: [Components] operationId: getComponentUsage summary: Where a component is used description: | Whether anything holds the component, and what: blocks per page, entries per library, libraries built on it, and other components whose schema references it. `inUse` is the verdict `POST /component/{uuid}/publish` takes. x-abilities: [component.read, read] responses: "200": description: The usage. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: type: object required: [inUse, blockCount, usages, libraries, referencedBy] properties: inUse: { type: boolean } blockCount: { type: integer, description: "Blocks authored from the component, in any version." } usages: type: array items: type: object properties: kind: { type: string, enum: [content, libraryEntry, orphanedLibraryEntry] } documentUuid: { type: [string, "null"], format: uuid } documentTitle: { type: [string, "null"] } blockCount: { type: integer } libraryUuid: { type: [string, "null"], format: uuid } libraryTitle: { type: [string, "null"] } entryCount: { type: integer } libraries: type: array items: type: object properties: uuid: { type: string, format: uuid } title: { type: string } referencedBy: type: array items: type: object properties: uuid: { type: string, format: uuid } title: { type: string } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "429": { $ref: "#/components/responses/TooManyRequests" } /component/{uuid}/versions/{version}: parameters: - $ref: "#/components/parameters/uuid" - $ref: "#/components/parameters/version" delete: tags: [Components] operationId: deleteComponentVersion summary: Delete a schema version description: Prunes an unneeded snapshot. The published version cannot be deleted, nor one that content is pinned to. x-abilities: [component.update, update] responses: "200": description: Deleted. content: application/json: schema: { $ref: "#/components/schemas/Message" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "409": description: Content is pinned to this version. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: type: object properties: usageCount: { type: integer } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } # -------------------------------------------------------------------- Files /file: get: tags: [Files] operationId: listFiles summary: List files description: | Every file, or the files in one folder. Pass `offset` to page; a paged row carries more fields than an unpaged one. `id` is the file's uuid. x-abilities: [file.read, read] parameters: - $ref: "#/components/parameters/offset" - $ref: "#/components/parameters/limit" - name: folder in: query schema: { type: string } description: A folder uuid, or `root` for the top level. Omitted, every file in the project is listed. - name: recursive in: query schema: { type: boolean } description: With `folder`, include its subfolders. - name: only in: query schema: { type: string, enum: [images] } description: Only files an `image` field accepts. responses: "200": description: The listing. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: pager: { $ref: "#/components/schemas/Pager" } data: type: array items: { $ref: "#/components/schemas/FileListingRow" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } post: tags: [Files] operationId: uploadFile summary: Upload a file description: | The bytes go in `data`, as a multipart part (preferred) or base64 in a JSON body. Omit `data` to create the record now and upload the bytes later with `PATCH /file/{uuid}`. The stored type is detected from the bytes, not from `filename`. The ceiling is 64 MB of decoded bytes. x-abilities: [file.create, create] requestBody: required: true content: multipart/form-data: schema: { $ref: "#/components/schemas/FileUploadMultipart" } application/json: schema: { $ref: "#/components/schemas/FileUploadJson" } responses: "201": description: The file. Variants passed inline are created but not listed here. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: { $ref: "#/components/schemas/File" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "413": description: The body was too large for the server to accept at all. "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /file/{uuid}: parameters: - $ref: "#/components/parameters/uuid" get: tags: [Files] operationId: getFile summary: Get a file's metadata and variants x-abilities: [file.read, read] responses: "200": description: The file, with every variant under `variants`. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: allOf: - $ref: "#/components/schemas/File" - type: object required: [variants] properties: variants: type: array items: { $ref: "#/components/schemas/FileVariant" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "429": { $ref: "#/components/responses/TooManyRequests" } patch: &updateFile tags: [Files] operationId: updateFile summary: Update a file's metadata or replace its bytes description: | `title` is required on every call. Sending `data` replaces the original and regenerates the preview and every existing variant. Omit `folder` to leave the file where it is; `null` or `root` moves it to the top level. x-abilities: [file.update, update] requestBody: required: true content: multipart/form-data: schema: { $ref: "#/components/schemas/FileUpdateMultipart" } application/json: schema: { $ref: "#/components/schemas/FileUpdateJson" } responses: "200": description: Updated. content: application/json: schema: { $ref: "#/components/schemas/Message" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } put: <<: *updateFile operationId: updateFilePut summary: Alias of PATCH delete: tags: [Files] operationId: deleteFile summary: Delete a file x-abilities: [file.delete, delete] responses: "200": description: Deleted, bytes and variants included. content: application/json: schema: { $ref: "#/components/schemas/Message" } "400": description: The file is still referenced by content. content: application/json: schema: { $ref: "#/components/schemas/Message" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "429": { $ref: "#/components/responses/TooManyRequests" } /file/{uuid}/download: parameters: - $ref: "#/components/parameters/uuid" get: tags: [Files] operationId: downloadFilePreview summary: Download the 300×300 preview description: "**Not the original.** Without a variant this serves the square `preview.jpg` generated on upload. Use `/original` for the upload itself, or `/render` for a size of your choosing." x-abilities: [file.read, read] responses: "200": description: The preview's bytes. content: image/jpeg: schema: { type: string, format: binary } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "429": { $ref: "#/components/responses/TooManyRequests" } /file/{uuid}/download/{variant}: parameters: - $ref: "#/components/parameters/uuid" - name: variant in: path required: true schema: { type: string, format: uuid } description: A variant's `_uuid`, not its name. For a name, use `/file/{uuid}/variants/{variantKey}`. get: tags: [Files] operationId: downloadFileVariant summary: Download a variant at its stored size description: The second uuid is a variant's `_uuid` - a `POST /file/{uuid}/variants` response, or an image field's `variant_id`. To size that crop, pass it to `/render` as `variant` instead. x-abilities: [file.read, read] responses: "200": description: The variant's bytes, with its resolved `Content-Type`. content: "*/*": schema: { type: string, format: binary } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "429": { $ref: "#/components/responses/TooManyRequests" } /file/{uuid}/original: parameters: - $ref: "#/components/parameters/uuid" get: tags: [Files] operationId: downloadFileOriginal summary: Download the original bytes x-abilities: [file.read, read] responses: "200": description: The upload, unmodified, with its resolved `Content-Type`. content: "*/*": schema: { type: string, format: binary } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "429": { $ref: "#/components/responses/TooManyRequests" } /file/{uuid}/render: parameters: - $ref: "#/components/parameters/uuid" get: tags: [Files] operationId: renderImage summary: Resize, crop or convert an image per request description: | What a responsive `srcset` wants. These six parameters are the only ones accepted; anything else on the URL, including a misspelt one, is a `422`. Out-of-range values are a `422`, never clamped. Each parameter set is rendered once and cached; responses are `immutable` with a long `max-age`. x-abilities: [file.read, read] parameters: - name: w in: query schema: { type: integer, minimum: 1, maximum: 4000 } description: Width in pixels. Required unless `h` is given. - name: h in: query schema: { type: integer, minimum: 1, maximum: 4000 } description: Height in pixels. Required unless `w` is given. - name: fit in: query schema: { type: string, enum: [contain, cover], default: contain } description: "`cover` crops to fill the box exactly and needs both `w` and `h`." - name: format in: query schema: { type: string, enum: [jpg, png, webp] } description: Defaults to the source's format. - name: q in: query schema: { type: integer, minimum: 1, maximum: 100, default: 85 } - name: variant in: query schema: { type: string, format: uuid } description: Render this variant of the file - an editor's crop - instead of the original. Must belong to this file. responses: "200": description: The image bytes. headers: Cache-Control: schema: { type: string } description: "`public, max-age=, immutable`." X-Flatnode-Render: schema: { type: string, enum: [hit, miss] } description: Whether this request did the work or read an earlier result. content: image/jpeg: { schema: { type: string, format: binary } } image/png: { schema: { type: string, format: binary } } image/webp: { schema: { type: string, format: binary } } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": description: Not an image, an unknown parameter, or a value out of range. content: application/json: schema: oneOf: - $ref: "#/components/schemas/Message" - $ref: "#/components/schemas/ValidationError" "429": { $ref: "#/components/responses/TooManyRequests" } /file/{uuid}/variants: parameters: - $ref: "#/components/parameters/uuid" post: tags: [Files] operationId: createFileVariants summary: Create named or ad-hoc renditions description: Each entry names a variant definition by `key`, gives an ad-hoc pixel `crop`, or both (the crop overrides the definition). Images only. x-abilities: [file.update, update] requestBody: required: true content: application/json: schema: type: object required: [variants] properties: variants: type: array minItems: 1 items: { $ref: "#/components/schemas/VariantRequest" } responses: "200": description: The variants, ready to download. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: type: array items: { $ref: "#/components/schemas/FileVariant" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /file/{uuid}/variants/{variantKey}: parameters: - $ref: "#/components/parameters/uuid" - name: variantKey in: path required: true schema: { type: string } description: The `name` of a variant created from a definition `key`. Ad-hoc crops have generated names and are reached by uuid. get: tags: [Files] operationId: downloadFileVariantByKey summary: Download a variant by its definition key x-abilities: [file.read, read] responses: "200": description: The variant's bytes. content: "*/*": schema: { type: string, format: binary } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "429": { $ref: "#/components/responses/TooManyRequests" } # ------------------------------------------------------------------ Folders /file-folder: get: tags: [Folders] operationId: listFileFolders summary: List the whole folder tree description: Parents before children, not paginated. x-abilities: [file.read, read] responses: "200": description: Every folder. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: type: array items: { $ref: "#/components/schemas/FileFolder" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "429": { $ref: "#/components/responses/TooManyRequests" } post: tags: [Folders] operationId: createFileFolder summary: Create a folder x-abilities: [file.create, create] requestBody: required: true content: application/json: schema: type: object required: [title] properties: title: { type: string, maxLength: 255 } parent: { type: [string, "null"], format: uuid, description: "Omit or `null` for the top level." } responses: "201": description: The folder. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: { $ref: "#/components/schemas/FileFolder" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /file-folder/{uuid}: parameters: - $ref: "#/components/parameters/uuid" get: tags: [Folders] operationId: getFileFolder summary: Get a folder with its trail and children x-abilities: [file.read, read] responses: "200": description: The folder, its rootline, its direct subfolders, and how many files sit directly in it. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: allOf: - $ref: "#/components/schemas/FileFolder" - type: object required: [trail, children, assetCount] properties: trail: type: array items: { $ref: "#/components/schemas/FileFolder" } children: type: array items: { $ref: "#/components/schemas/FileFolder" } assetCount: { type: integer } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "429": { $ref: "#/components/responses/TooManyRequests" } patch: tags: [Folders] operationId: updateFileFolder summary: Rename or move a folder description: Moving takes the subtree along. Moving a folder into itself or its own descendant is a `422`. x-abilities: [file.update, update] requestBody: required: true content: application/json: schema: type: object properties: title: { type: string, maxLength: 255 } parent: { type: [string, "null"], format: uuid, description: "Omit to leave it where it is; `null` moves it to the top level." } responses: "200": description: The folder. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: { $ref: "#/components/schemas/FileFolder" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } delete: tags: [Folders] operationId: deleteFileFolder summary: Delete a folder, keeping its contents description: Its files and subfolders move up into its parent, or to the top level. x-abilities: [file.delete, delete] responses: "200": description: Deleted. content: application/json: schema: { $ref: "#/components/schemas/Message" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "429": { $ref: "#/components/responses/TooManyRequests" } # ------------------------------------------------------ Variant definitions /file-variant-definitions: get: tags: [Variant definitions] operationId: listVariantDefinitions summary: List the project's variant definitions x-abilities: [file-variant-definition.read, read] responses: "200": description: The definitions. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: type: array items: { $ref: "#/components/schemas/VariantDefinition" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "429": { $ref: "#/components/responses/TooManyRequests" } post: tags: [Variant definitions] operationId: createVariantDefinition summary: Create or replace a definition description: Keyed by `key`; posting an existing key replaces it. x-abilities: [file-variant-definition.create, create] requestBody: required: true content: application/json: schema: allOf: - $ref: "#/components/schemas/VariantDefinitionInput" - type: object required: [key] responses: "201": description: The definition. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: { $ref: "#/components/schemas/VariantDefinition" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /file-variant-definitions/{key}: parameters: - name: key in: path required: true schema: { type: string, maxLength: 64, pattern: "^[A-Za-z0-9_-]+$" } patch: tags: [Variant definitions] operationId: updateVariantDefinition summary: Change a definition x-abilities: [file-variant-definition.update, update] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/VariantDefinitionInput" } responses: "200": description: The definition. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: { $ref: "#/components/schemas/VariantDefinition" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } delete: tags: [Variant definitions] operationId: deleteVariantDefinition summary: Delete a definition x-abilities: [file-variant-definition.delete, delete] responses: "200": description: Deleted. content: application/json: schema: { $ref: "#/components/schemas/Message" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "429": { $ref: "#/components/responses/TooManyRequests" } # ---------------------------------------------------------------- Libraries /library: get: tags: [Libraries] operationId: listLibraries summary: List libraries x-abilities: [library.read, read] parameters: - $ref: "#/components/parameters/offset" - $ref: "#/components/parameters/limit" responses: "200": description: The listing. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: pager: { $ref: "#/components/schemas/Pager" } data: type: array items: { $ref: "#/components/schemas/Library" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } post: tags: [Libraries] operationId: createLibrary summary: Create a library description: | Over an existing component whose published schema is `"type": "object"`. `filterableFields` names the top-level scalar properties to index - only these can be filtered or sorted on. `labelField` names the string property that labels an entry on one line. x-abilities: [library.create, create] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/LibraryCreate" } responses: "201": description: The library. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: { $ref: "#/components/schemas/Library" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /library/{uuid}: parameters: - $ref: "#/components/parameters/uuid" get: tags: [Libraries] operationId: getLibrary summary: Get a library x-abilities: [library.read, read] responses: "200": description: The library. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: { $ref: "#/components/schemas/Library" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "429": { $ref: "#/components/responses/TooManyRequests" } patch: &updateLibrary tags: [Libraries] operationId: updateLibrary summary: Rename a library or change its indexed fields description: The slug never changes on rename - schemas bind to it. A field added to `filterableFields` indexes each existing entry on its next promote, withdraw or edit. x-abilities: [library.update, update] requestBody: required: true content: application/json: schema: type: object properties: title: { type: string, maxLength: 255 } filterableFields: type: array items: { type: string } labelField: { type: [string, "null"], maxLength: 255, description: "`null` goes back to the first string property." } responses: "200": description: The library. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: { $ref: "#/components/schemas/Library" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } put: <<: *updateLibrary operationId: updateLibraryPut summary: Alias of PATCH delete: tags: [Libraries] operationId: deleteLibrary summary: Delete a library description: | A library with entries, or with fields elsewhere pointing into it, answers `409` until `confirm=true` is passed. Then its entries are withdrawn (never hard-deleted), referencing fields are unbound, and the library goes. x-abilities: [library.delete, delete] parameters: - name: confirm in: query schema: { type: boolean } responses: "200": description: Deleted. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: type: object required: [entriesWithdrawn, referencesUnbound, containerRemoved] properties: entriesWithdrawn: { type: integer } referencesUnbound: { type: integer } containerRemoved: { type: boolean, description: "False when entries survive inside the hidden container document." } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "409": description: Still in use and not confirmed. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: { $ref: "#/components/schemas/LibraryInUse" } "429": { $ref: "#/components/responses/TooManyRequests" } /library/{uuid}/entries: parameters: - $ref: "#/components/parameters/uuid" get: tags: [Libraries] operationId: listLibraryEntries summary: List and filter live entries description: | Only entries with something promoted inside its window. Filter with `filter[field][operator]=value` on declared filterable fields - the operators are `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`, `contains` (strings only) and `null`; several combine with AND. Sort with `sort=field` or `sort=-field`, comma-separated. Narrow by a relation with `related[relationUuid]=anchorEntryUuid`. Filters compare against the default language's values, and a filterable string field holds one value in every language. An empty result whose value does exist in a translation carries a `warnings` list saying so. x-abilities: [library.read, read] parameters: - name: offset in: query schema: { type: integer, minimum: 1, default: 1 } description: The page number, 1-based. - name: limit in: query schema: { type: integer, minimum: 1, maximum: 100, default: 20 } - name: sort in: query schema: { type: string } examples: newestFirst: { value: "-publishedAt,title" } - name: filter in: query style: deepObject explode: true schema: type: object additionalProperties: type: object description: Operator to value. additionalProperties: { type: string } examples: press: { value: { category: { eq: press }, publishedAt: { gte: "2026-01-01" } } } - name: related in: query style: deepObject explode: true schema: type: object additionalProperties: { type: string, format: uuid } description: Relation uuid to anchor entry uuid. - $ref: "#/components/parameters/locale" - $ref: "#/components/parameters/richtext" responses: "200": description: The page of entries, each rendered as `GET /content/{uuid}` would. content: application/json: schema: { $ref: "#/components/schemas/EntryListingEnvelope" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } post: tags: [Libraries] operationId: createLibraryEntry summary: Create an entry description: "`data` matches the library's component schema. The entry starts as a draft; promote it with `POST /content/{uuid}/promote`. `_entry` in the response is the entry's stable identity across versions." x-abilities: [library.create, create] requestBody: required: true content: application/json: schema: type: object required: [data] properties: data: type: object description: The entry's value, an object matching the component's schema. responses: "201": description: The new draft, rendered. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: { $ref: "#/components/schemas/RenderedNode" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /library/{uuid}/pending-entries: parameters: - $ref: "#/components/parameters/uuid" get: tags: [Libraries] operationId: listPendingLibraryEntries summary: List entries that are not live description: Drafts and withdrawn entries, each carrying `_status`. An editor's view - to an API token the page is always empty, because every entry here is unpublished. x-abilities: [library.read, read] parameters: - name: offset in: query schema: { type: integer, minimum: 1, default: 1 } - name: limit in: query schema: { type: integer, minimum: 1, maximum: 100, default: 20 } - $ref: "#/components/parameters/locale" - $ref: "#/components/parameters/richtext" responses: "200": description: The page. content: application/json: schema: { $ref: "#/components/schemas/EntryListingEnvelope" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } /library/{uuid}/relations: parameters: - $ref: "#/components/parameters/uuid" get: tags: [Libraries] operationId: listLibraryRelations summary: List a library's relations description: Every relation the library is either side of. Relations are derived from the source library's published schema - every top-level array-of-libraryEntry property is one - and reconciled on publish (ADR 0009). Nothing to create or delete. x-abilities: [library.read, read] responses: "200": description: The relations. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: type: array items: { $ref: "#/components/schemas/LibraryRelation" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "404": { $ref: "#/components/responses/NotFound" } "429": { $ref: "#/components/responses/TooManyRequests" } # ------------------------------------------------------------------- Search /query: post: tags: [Search] operationId: search summary: Full-text search description: Across the project's documents, content, components, files, folders and libraries. At most 20 hits, no paging. Indexing is near-real-time, about a second behind a write. x-abilities: [search.read, read] requestBody: required: true content: application/json: schema: type: object required: [query] properties: query: { type: string, minLength: 1 } responses: "200": description: The hits. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: type: array maxItems: 20 items: { $ref: "#/components/schemas/SearchHit" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } # --------------------------------------------------------------- Validation /validation: post: tags: [Validation] operationId: validateContent summary: Ask whether a content write would be accepted description: | Runs the write path's own validator (ADR 0024) against either an inline `configuration` or an existing `component`. The answer is in `data.valid`; a refused payload is still a `200`. A `422` means the question could not be put - a schema this API cannot run, an unknown component or version. x-abilities: [validation.read, read] requestBody: required: true content: application/json: schema: type: object required: [data] properties: configuration: $ref: "#/components/schemas/JsonSchema" description: The schema to check against. Required unless `component` is given. component: type: string format: uuid description: A component of this project. Required unless `configuration` is given. componentVersion: type: integer minimum: 1 description: With `component` only - check against this version rather than the published one. data: type: object description: The payload to judge. May be empty. responses: "200": description: The verdict. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: { $ref: "#/components/schemas/ValidationResult" } "401": { $ref: "#/components/responses/Unauthorized" } "403": { $ref: "#/components/responses/Forbidden" } "422": { $ref: "#/components/responses/Unprocessable" } "429": { $ref: "#/components/responses/TooManyRequests" } components: securitySchemes: bearerAuth: type: http scheme: bearer description: A project API token, issued in the admin under Project → API tokens. It carries abilities; each operation says which satisfy it under `x-abilities`. parameters: uuid: name: uuid in: path required: true schema: { type: string, format: uuid } description: The resource's uuid. A value that is not uuid-shaped is a `404` before any lookup. version: name: version in: path required: true schema: { type: integer, minimum: 1 } description: A schema version number, from `GET /component/{uuid}/versions`. offset: name: offset in: query schema: { type: integer, minimum: 1 } description: The page number, 1-based. Either this or `limit` turns paging on; with neither the whole listing is answered and there is no `pager`. Defaults to 1 when only `limit` is sent. limit: name: limit in: query schema: { type: integer, minimum: 1, default: 10 } description: Page size. On its own it answers the first page. locale: name: locale in: query schema: { type: string } description: The language to resolve in. Only meaningful on a project that publishes in more than one; a locale the project does not publish in is a `422` naming the available ones. richtext: name: richtext in: query schema: { type: string, enum: [document, html, text], default: document } description: How Rich text values are served - the block tree (ADR 0026), rendered HTML, or plain text. headers: X-Quota-Limit: schema: { type: integer } description: The owner's monthly request quota. X-Quota-Remaining: schema: { type: integer } X-Quota-Reset: schema: { type: integer } description: Unix timestamp of the first second of next month. responses: Unauthorized: description: No token, or a token that was revoked or has expired. content: application/json: schema: $ref: "#/components/schemas/Message" example: { message: "Unauthenticated." } Forbidden: description: The token lacks every ability listed under the operation's `x-abilities`, or the node's mode bits refuse the caller. For a missing ability the message names it, and `GET /project` lists what the token holds. content: application/json: schema: { $ref: "#/components/schemas/Message" } example: { message: "This token lacks content.publish (or the bare publish). Grant it on the token under API tokens in the admin, or issue a new one; GET /project lists what a token holds." } NotFound: description: No such resource in this project - or one the caller may not read, or a version that is not published to a public token. The three are deliberately the same answer. content: application/json: schema: { $ref: "#/components/schemas/Message" } example: { message: "Record not found." } Unprocessable: description: A field failed validation. `errors` maps each field to its messages. content: application/json: schema: { $ref: "#/components/schemas/ValidationError" } SchemaInvalid: description: The schema document is not one this API can run - a keyword outside the closed vocabulary, an unbounded plain string, or a meta-schema violation. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: message: { type: string, examples: ["data invalid."] } data: description: The violations, keyed by JSON pointer into the schema, or a single message. PlanLimit: description: The owner's plan caps how many schemas a project may have. content: application/json: schema: { $ref: "#/components/schemas/PlanLimitExceeded" } TooManyRequests: description: The per-minute burst limit or the monthly quota, both counted per project owner. A refused request is not counted. headers: Retry-After: schema: { type: integer } description: Seconds until the limit resets. X-Quota-Limit: { $ref: "#/components/headers/X-Quota-Limit" } X-Quota-Remaining: { $ref: "#/components/headers/X-Quota-Remaining" } X-Quota-Reset: { $ref: "#/components/headers/X-Quota-Reset" } X-RateLimit-Limit: schema: { type: integer } description: On a burst refusal. X-RateLimit-Remaining: schema: { type: integer } description: On a burst refusal. content: application/json: schema: oneOf: - $ref: "#/components/schemas/Message" - $ref: "#/components/schemas/QuotaExceeded" VersionTransition: description: The version after the transition. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: { $ref: "#/components/schemas/ContentVersion" } schemas: # ---------------------------------------------------------- envelopes Envelope: type: object description: The common response envelope. required: [message, data] properties: message: { type: string } data: {} Pager: type: object description: Present on a paged listing. required: [results, paginate, first, last] properties: results: { type: integer, description: "Total rows across every page." } paginate: { type: boolean, description: "Whether there is more than one page." } first: { type: integer, description: "1-based index of this page's first row." } last: { type: integer } Message: type: object required: [message] properties: message: { type: string } ValidationError: type: object required: [message, errors] properties: message: { type: string } errors: type: object description: Field name to its messages. Under `data`, a JSON Schema violation arrives as a nested list and a storage check as a plain string. additionalProperties: type: array items: {} QuotaExceeded: type: object required: [message, code, limit, used, max, resetsAt, upgradeUrl] properties: message: { type: string, examples: ["Monthly API request quota exceeded."] } code: { type: string, const: api_quota_exceeded } limit: { type: string, const: api_requests_per_month } used: { type: integer } max: { type: integer } resetsAt: { type: string, format: date-time } upgradeUrl: { type: [string, "null"], format: uri } PlanLimitExceeded: type: object required: [message, code, limit, used, max, plan, upgradeUrl] properties: message: { type: string } code: { type: string, const: plan_limit_exceeded } limit: { type: string, examples: [schemas_per_project] } used: { type: integer } max: { type: integer } plan: { type: string, examples: [Free] } upgradeUrl: { type: [string, "null"], format: uri } # ----------------------------------------------------------- building blocks Mode: type: string enum: ["600", "644", "664"] description: "Unix-style mode bits, three octal digits (ADR 0017). `600`/`644`: only the owner and admins write. `664`: the group writes too." Timestamp: type: [string, "null"] format: date-time description: ISO 8601 with offset. JsonSchema: type: object description: | A component's schema: plain JSON Schema over a closed vocabulary (ADR 0007). `title` is required and names the component. What may appear inside is defined by the meta-schema at https://admin.flatnode.net/component.schema.json and described at https://docs.flatnode.net/api/components.html#supported-json-schema-types; `$ref` targets live in the `http://access.flatnode.net/` namespace. A `format: "richtext"` field may carry a `richtext` keyword naming the marks, blocks and heading levels it allows (ADR 0028). required: [title] properties: title: { type: string } description: { type: string } type: description: One JSON Schema type, or a list of them - a kind beside `null` is nullable (ADR 0034). oneOf: - type: string - type: array items: { type: string } additionalProperties: true examples: - title: Page type: object properties: title: { type: string } body: { $ref: "http://access.flatnode.net/slot/body#" } # ------------------------------------------------------------ documents Document: type: object description: A node in the page tree, as every document endpoint answers it. required: [_uuid, title, slug, path, published, type, parent, permissions, group, revealAt, concealAt, createdAt, updatedAt, treeLeft, treeRight, treeLevel] properties: _uuid: { type: string, format: uuid } title: { type: string } slug: { type: string, description: "One segment of the path. Generated from the title once, at create, unless supplied; a rename never changes it. Set it with `slug` on PATCH, or send `slug: null` to regenerate it from the title. Unique per project." } path: { type: string, description: "The document's path from the project root: its ancestors' slugs and its own, joined with `/`. Empty for the root. What a consumer builds a URL from, and what `GET /document/by-path` resolves." } published: { type: boolean, description: "Whether the document has a live root version right now, in any language." } type: { type: [string, "null"], enum: [document, library, null] } parent: { type: [string, "null"], format: uuid, description: "Null for the project root." } permissions: { $ref: "#/components/schemas/Mode" } group: { type: [string, "null"], description: "A role slug, `project` for every member, or null if the role was deleted." } revealAt: { $ref: "#/components/schemas/Timestamp" } concealAt: { $ref: "#/components/schemas/Timestamp" } createdAt: { $ref: "#/components/schemas/Timestamp" } updatedAt: { $ref: "#/components/schemas/Timestamp" } treeLeft: { type: [integer, "null"], description: "Nested-set bound. `treeRight - treeLeft == 1` means a leaf. Read-only." } treeRight: { type: [integer, "null"] } treeLevel: { type: [integer, "null"], description: "Depth; the project root is 0." } DocumentCreate: type: object required: [title] properties: title: { type: string, maxLength: 255 } slug: { type: [string, "null"], maxLength: 255, description: "Optional. Normalised like a generated slug (ASCII, lowercase, non-word runs to `-`). Omit or send null to derive it from the title. A slug another document in the project already has, or one with no usable characters, is a 422." } parent: { type: [string, "null"], format: uuid } position: { type: string, enum: [first, last], default: last, description: "Only with `parent`." } revealAt: { type: [string, "null"], format: date-time } concealAt: { type: [string, "null"], format: date-time } permissions: { $ref: "#/components/schemas/Mode" } group: { type: string, description: "A role slug, or `project`. Needs `content.permissions`." } DocumentUpdate: type: object properties: title: { type: string, maxLength: 255, description: "A rename. Leaves the slug, and so the path, alone." } slug: { type: [string, "null"], maxLength: 255, description: "Set the slug, normalised like a generated one; null regenerates it from the title. Omitted, it stays. Changing it rewrites every descendant's path and every link pointing into the subtree. A collision within the project is a 422." } parent: { type: string, format: uuid, description: "Move under this document. Not with `insertAfter`/`insertBefore`." } position: { type: string, enum: [first, last], description: "Only with `parent`." } insertAfter: { type: string, format: uuid, description: "Move to just after this sibling." } insertBefore: { type: string, format: uuid, description: "Move to just before this sibling." } revealAt: { type: [string, "null"], format: date-time } concealAt: { type: [string, "null"], format: date-time } permissions: { $ref: "#/components/schemas/Mode" } group: { type: string, description: "Needs `content.permissions`." } Project: type: object description: | The project a token belongs to. It carries no identifier: a project has no uuid, and the token already names it. required: [title, locales, defaultLocale, root, workflow, token] properties: title: { type: string } locales: type: array items: { type: string } minItems: 1 description: Every locale the project publishes in, default first. A project that never configured languages has one. defaultLocale: { type: string, description: "The locale content falls back to, and the one an untranslated version is in." } root: oneOf: - $ref: "#/components/schemas/Document" - type: "null" description: The page tree's root, or null when the project has no documents yet, or the caller may not read it, or the token holds neither `document.read` nor `read`. workflow: type: object description: | The publishing workflow a writer has to follow, named as the project settings screen names them. With `requireApproval` on and `allowSelfApproval` off, one token can never make a version live on its own: it may submit, and approving the version it submitted itself is refused. Check this before writing anything. required: [requireApproval, allowSelfApproval] properties: requireApproval: { type: boolean, description: "`POST /content/{uuid}/promote` refuses a draft with a 422; a version has to be submitted and approved first." } allowSelfApproval: { type: boolean, description: "Whether the identity that submitted a version may also approve it." } token: type: object description: What the calling token may do. required: [abilities] properties: abilities: type: array items: { type: string } description: | Every ability the token holds, from the vocabulary under `x-abilities`. A bare verb (`read`, `publish`) stands for that verb on every resource, so a token holding `publish` satisfies an operation listing `content.publish`. An internal session token answers for its human's role. # -------------------------------------------------------------- content RenderedNode: type: object description: | A content node as a render answers it. `_value` is the node's value in the shape its component declares; composed children appear inside it as rendered nodes of their own, and a slot as `{_type: "slot", _items: [...]}`. The editor's own session additionally sees `_permissions`, `_owner`, `_group`, `_configuration` and `_mounted` - the names of the slots that are the lineage's, shared by every version, rather than this version's own. required: [_uuid, _type, _component, _value] properties: _uuid: { type: string, format: uuid, description: "This version's uuid - what every `/content/{uuid}` endpoint takes." } _type: { type: string, enum: [component] } _component: { type: string, format: uuid, description: "The component schema it was built from." } _entry: { type: string, format: uuid, description: "The version wrapper above it - the same for every version of this node, and what a single-entry reference stores." } _handle: { type: string, description: "The component's handle, when it has one." } _locale: { type: string, description: "The language this node actually resolved to. Only on a multilingual project." } _status: { type: string, description: "Only on `GET /library/{uuid}/pending-entries`." } _value: description: The value, in the component's shape. additionalProperties: true NewSlot: type: object required: [_uuid, _type, _items] properties: _uuid: { type: string, format: uuid } _type: { type: string, enum: [slot] } _items: { type: array, maxItems: 0, items: {} } DocumentRender: type: object description: "`GET /document/{uuid}` answers the root node's render with `_document` beside it - or only `_document` when nothing is live." required: [_document] properties: _document: type: object required: [title, slug, path] properties: title: { type: string } slug: { type: string } path: { type: string, description: "The document's path from the project root; empty for the root." } locale: { type: string, description: "The language asked for. Only on a multilingual project." } _uuid: { type: string, format: uuid } _type: { type: string, enum: [component] } _component: { type: string, format: uuid } _entry: { type: string, format: uuid } _handle: { type: string } _locale: { type: string } _value: {} additionalProperties: true ContentCreate: type: object required: [DocumentId, data] properties: DocumentId: { type: string, format: uuid } ComponentId: type: string format: uuid description: Required, except when adding an item to an array-of-slots field. componentVersion: type: integer description: Create against this unpublished schema version. Needs `content.component_version`. parent: type: object description: Compose into a slot of an existing node. required: [HostContentId] properties: HostContentId: { type: string, format: uuid } Slot: { type: string, description: "The slot's name. Optional when `HostContentId` already names a slot." } position: { type: string, enum: [first, last, after], default: last } insertAfter: { type: string, format: uuid, description: "With `position: after` - the sibling to follow." } locale: { type: string, description: "Author directly in this language." } data: description: The value, in the component's shape. ContentVersion: type: object description: One version of a lineage, as the listings and the workflow transitions answer it. required: [_uuid, _component, locale, status, is_current, created_at, updated_at] properties: _uuid: { type: string, format: uuid } _component: { type: string, format: uuid } locale: { type: [string, "null"], description: "As stored; null means the project default." } status: { $ref: "#/components/schemas/VersionStatus" } is_current: { type: boolean, description: "Whether this is the version rendering right now, for the language asked about." } created_at: { $ref: "#/components/schemas/Timestamp" } updated_at: { $ref: "#/components/schemas/Timestamp" } reveal_at: { $ref: "#/components/schemas/Timestamp" } conceal_at: { $ref: "#/components/schemas/Timestamp" } submitted_at: { $ref: "#/components/schemas/Timestamp" } submitted_by_owner_id: { type: [integer, "null"] } approved_at: { $ref: "#/components/schemas/Timestamp" } approved_by_owner_id: { type: [integer, "null"] } rejected_at: { $ref: "#/components/schemas/Timestamp" } rejected_by_owner_id: { type: [integer, "null"] } rejection_reason: { type: [string, "null"] } promoted_at: { $ref: "#/components/schemas/Timestamp" } promoted_by_owner_id: { type: [integer, "null"] } withdrawn_at: { $ref: "#/components/schemas/Timestamp" } withdrawn_by_owner_id: { type: [integer, "null"] } discarded_at: { $ref: "#/components/schemas/Timestamp" } discarded_by_owner_id: { type: [integer, "null"] } VersionStatus: type: string enum: [draft, pending_approval, approved, rejected, promoted, withdrawn, discarded] VersionListingEnvelope: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: type: array items: { $ref: "#/components/schemas/ContentVersion" } EntryListingEnvelope: allOf: - $ref: "#/components/schemas/Envelope" - type: object required: [pager] properties: pager: { $ref: "#/components/schemas/Pager" } data: type: array items: { $ref: "#/components/schemas/RenderedNode" } warnings: type: array items: { type: string } description: | Only on an empty result, and only when a filter value exists in a translation: filters compare against the default language's values. Absent otherwise. # ----------------------------------------------------------- components Component: type: object required: [_uuid, title, handle, isGroup, publishedVersion, version, createdAt, updatedAt] properties: _uuid: { type: string, format: uuid } title: { type: string } handle: { type: [string, "null"], description: "An admin-set name to find the component by; what a render reports as `_handle`." } isGroup: { type: boolean } publishedVersion: { type: integer, description: "The version content is validated against." } version: { type: integer, description: "The latest saved version; ahead of `publishedVersion` while a draft is iterated on." } createdAt: { $ref: "#/components/schemas/Timestamp" } updatedAt: { $ref: "#/components/schemas/Timestamp" } ComponentWithSchema: allOf: - $ref: "#/components/schemas/Component" - type: object required: [schema] properties: schema: allOf: - $ref: "#/components/schemas/JsonSchema" - type: object properties: $id: { type: string, description: "`/uuid/`, stamped on, not stored." } description: The published schema document verbatim, plus `$id`. Send it back to `PATCH /component/{uuid}` or as `configuration` to `POST /validation` as it is. ComponentVersion: type: object required: [version, isPublished, title, description, savedAt, usageCount] properties: version: { type: integer } isPublished: { type: boolean } title: { type: [string, "null"] } description: { type: [string, "null"] } savedAt: { type: [string, "null"], description: "`Y-m-d H:i:s`." } usageCount: { type: integer, description: "Content blocks pinned to this version." } ComponentInUse: type: object required: [usageCount, libraryCount, usages, libraries] properties: usageCount: { type: integer, description: "Blocks authored from it." } libraryCount: { type: integer } usages: type: array items: type: object properties: kind: { type: string, enum: [content, libraryEntry, orphanedLibraryEntry] } documentUuid: { type: [string, "null"], format: uuid } documentTitle: { type: [string, "null"] } blockCount: { type: integer } libraryUuid: { type: [string, "null"], format: uuid } libraryTitle: { type: [string, "null"] } entryCount: { type: integer } libraries: type: array items: type: object required: [uuid, title] properties: uuid: { type: string, format: uuid } title: { type: string } # ---------------------------------------------------------------- files File: type: object required: [_uuid, title, caption, name, extension, mimeType, byteSize, isImage, folder, folderPath, createdAt, updatedAt] properties: _uuid: { type: string, format: uuid } title: { type: string } caption: { type: [string, "null"] } name: { type: string, description: "The stored name, from `filename` without its extension." } extension: { type: [string, "null"], description: "Resolved from the bytes; null until bytes are uploaded." } mimeType: { type: [string, "null"] } byteSize: { type: [integer, "null"] } isImage: { type: boolean } folder: { type: [string, "null"], format: uuid, description: "Null at the top level." } folderPath: { type: [string, "null"], description: "`Press/2026` - assembled, for display." } createdAt: { $ref: "#/components/schemas/Timestamp" } updatedAt: { $ref: "#/components/schemas/Timestamp" } FileListingRow: type: object description: A paged row carries every field; an unpaged one only `id`, `title`, `size`, `folder` and `folderPath`. required: [id, title, size, folder, folderPath] properties: id: { type: string, format: uuid, description: "The file's uuid." } title: { type: string } size: { type: string, description: "Human-readable, e.g. `1.2 MB`." } folder: { type: [string, "null"], format: uuid } folderPath: { type: [string, "null"] } mimeType: { type: [string, "null"] } extension: { type: [string, "null"] } isImage: { type: boolean } FileUploadMultipart: type: object required: [title, filename] properties: title: { type: string, maxLength: 255 } filename: { type: string, description: "Seeds the display name. The type is detected from the bytes." } data: { type: string, format: binary, description: "The file's bytes. Omit to create the record without them." } folder: description: "A folder uuid, `root`, or absent for the top level." anyOf: - { type: string, format: uuid } - { type: string, const: root } - { type: "null" } variants: type: array items: { $ref: "#/components/schemas/VariantRequest" } FileUploadJson: type: object required: [title, filename] properties: title: { type: string, maxLength: 255 } filename: { type: string } data: { type: string, contentEncoding: base64, description: "The bytes, base64. Larger on the wire than multipart." } folder: description: "A folder uuid, `root`, or `null`." anyOf: - { type: string, format: uuid } - { type: string, const: root } - { type: "null" } variants: type: array items: { $ref: "#/components/schemas/VariantRequest" } FileUpdateMultipart: type: object required: [title] properties: title: { type: string, maxLength: 255 } caption: { type: [string, "null"], maxLength: 255, description: "`\"\"` clears it." } data: { type: string, format: binary, description: "Replaces the original and regenerates every variant." } folder: description: "Omit to leave the file where it is; `null` or `root` moves it to the top level." anyOf: - { type: string, format: uuid } - { type: string, const: root } - { type: "null" } variants: type: array items: { $ref: "#/components/schemas/VariantRequest" } FileUpdateJson: type: object required: [title] properties: title: { type: string, maxLength: 255 } caption: { type: [string, "null"], maxLength: 255 } data: { type: string, contentEncoding: base64 } folder: description: "A folder uuid, `root`, or `null`." anyOf: - { type: string, format: uuid } - { type: string, const: root } - { type: "null" } variants: type: array items: { $ref: "#/components/schemas/VariantRequest" } VariantRequest: type: object description: One of `key`, `crop`, or both. properties: key: { type: string, description: "A variant definition's key." } crop: type: object required: [x, y, w, h] properties: x: { type: integer, minimum: 0 } y: { type: integer, minimum: 0 } w: { type: integer, minimum: 1 } h: { type: integer, minimum: 1 } FileVariant: type: object required: [_uuid, title, caption, name, extension, mimeType, byteSize, processed, processingInstructions, createdAt, updatedAt] properties: _uuid: { type: string, format: uuid } title: { type: [string, "null"] } caption: { type: [string, "null"] } name: { type: string, description: "The definition `key` it was made from, or a generated `custom-N` for an ad-hoc crop." } extension: { type: [string, "null"] } mimeType: { type: [string, "null"] } byteSize: { type: [integer, "null"] } processed: { type: boolean } processingInstructions: description: The decoded crop/transform it was produced from. createdAt: { $ref: "#/components/schemas/Timestamp" } updatedAt: { $ref: "#/components/schemas/Timestamp" } FileFolder: type: object required: [_uuid, title, parent, path, createdAt, updatedAt, treeLeft, treeRight, treeLevel] properties: _uuid: { type: string, format: uuid } title: { type: string } parent: { type: [string, "null"], format: uuid, description: "Null for a top-level folder." } path: { type: string, description: "`Press/2026`." } createdAt: { $ref: "#/components/schemas/Timestamp" } updatedAt: { $ref: "#/components/schemas/Timestamp" } treeLeft: { type: [integer, "null"] } treeRight: { type: [integer, "null"] } treeLevel: { type: [integer, "null"], description: "A top-level folder is 1." } VariantDefinitionInput: type: object properties: key: { type: string, maxLength: 64, pattern: "^[A-Za-z0-9_-]+$" } title: { type: [string, "null"], maxLength: 255 } output: type: [object, "null"] properties: format: { type: string, enum: [jpg, jpeg, png, webp, gif] } quality: { type: integer, minimum: 1, maximum: 100 } transform: type: [object, "null"] properties: mode: { type: string, enum: [cover, contain, resize] } width: { type: integer, minimum: 1 } height: { type: integer, minimum: 1 } focus: { type: string, maxLength: 32 } rules: type: [object, "null"] properties: mimeTypes: type: array items: { type: string, maxLength: 128 } allowAnimated: { type: boolean } enabled: { type: boolean, default: true } VariantDefinition: allOf: - $ref: "#/components/schemas/VariantDefinitionInput" - type: object description: Keyed by `key`; a definition is not a row and has no uuid. required: [key, title, output, transform, rules, enabled] # ------------------------------------------------------------ libraries Library: type: object required: [_uuid, title, slug, component, filterableFields, labelField, createdAt, updatedAt] properties: _uuid: { type: string, format: uuid } title: { type: string } slug: { type: string, description: "What a schema's `library/#` and `library-entry/#` refs bind to. Never changes on rename." } component: { type: [string, "null"], format: uuid, description: "The entry component's uuid." } filterableFields: type: object description: Field name to its JSON Schema type as snapshotted when declared. additionalProperties: { type: string, enum: [string, integer, number, boolean] } labelField: { type: [string, "null"], description: "The string property that labels an entry; resolved to the first string property when none was declared." } createdAt: { $ref: "#/components/schemas/Timestamp" } updatedAt: { $ref: "#/components/schemas/Timestamp" } LibraryCreate: type: object required: [title, componentId] properties: title: { type: string, maxLength: 255 } componentId: { type: string, format: uuid, description: "A component whose published schema is `\"type\": \"object\"`." } filterableFields: type: array items: { type: string } description: Top-level scalar property names. Six names are reserved and refused. labelField: { type: [string, "null"], maxLength: 255 } LibraryRelation: type: object required: [_uuid, sourceLibrary, targetLibrary, sourceField, createdAt, updatedAt] properties: _uuid: { type: string, format: uuid, description: "The handle for `related[...]`. Stable across republishes; a renamed field is a new relation." } sourceLibrary: { type: [string, "null"], format: uuid, description: "The library holding the picks." } targetLibrary: { type: [string, "null"], format: uuid } sourceField: { type: string } createdAt: { $ref: "#/components/schemas/Timestamp" } updatedAt: { $ref: "#/components/schemas/Timestamp" } LibraryInUse: type: object required: [entryCount, referenceCount, references] properties: entryCount: { type: integer } referenceCount: { type: integer } references: type: array items: type: object properties: field: { type: string } kind: { type: string, enum: [libraryEntry, libraryQuery] } componentUuid: { type: [string, "null"], format: uuid } componentTitle: { type: [string, "null"] } documentUuid: { type: [string, "null"], format: uuid } documentTitle: { type: [string, "null"] } # --------------------------------------------------------------- search SearchHit: type: object description: One shape for every hit type; the fields that do not apply to a type are null. There is no listing key besides `_uuid` - the index's own key is a row id and stays inside (ADR 0004). required: [_uuid, type, title, document, documentTitle, library, libraryTitle, folder, folderPath] properties: _uuid: { type: [string, "null"], format: uuid, description: "The hit's own identifier, for that resource's own endpoint. Null for a hit indexed before uuids were stored, until it is saved again - skip those." } type: { type: string, enum: [document, content, component, file, file-folder, library] } title: { type: [string, "null"], description: "Null on a content hit, which has no title of its own." } document: { type: [string, "null"], format: uuid, description: "On a content hit: the document it was found in." } documentTitle: { type: [string, "null"] } library: { type: [string, "null"], format: uuid, description: "On a content hit that is a library entry: the library, which is where it is edited." } libraryTitle: { type: [string, "null"] } folder: { type: [string, "null"], format: uuid, description: "On a file hit: the folder it is filed in, null at the top level." } folderPath: { type: [string, "null"], description: "On a file hit, the path of its folder; on a file-folder hit, its own path." } # ----------------------------------------------------------- validation ValidationResult: type: object required: [valid, errors] properties: valid: { type: boolean } errors: description: Exactly the `errors` object `POST /content` would answer in its `422`. An empty array when `valid` is true. oneOf: - type: array maxItems: 0 items: {} - type: object additionalProperties: type: array items: {}