Documents

Create-or-reuse the draft and replace app content

Changed on

Alpha. The app sub-resource may change shape without a deprecation cycle while apps mature. The document routes are stable.

Create (or reuse) the document's main draft and replace the app on it in one call — the app-side counterpart of PATCH …/draft's create-or-reuse behavior, with the same body, validation, and gates as PUT …/draft/{draftIdentifier}/app. No auto-publish; the response carries the draftIdentifier for POST …/draft/publish. Removing the app has no create-or-reuse counterpart — DELETE stays draft-explicit.

Last-write-wins, like every app write in the UI: the body is applied as given, with no expected-version precondition.

app is a reserved literal under …/draft/ — the router ranks it above the dynamic {draftIdentifier} segment. A draft named app would be unaddressable on the draft-scoped app routes; avoid it.

A document carries at most one of a dashboard or an app — never both; workbook-only is valid. The app HTML and settings live only at the app sub-resource routes; the document read carries an app slice pointing here, and the whole-document PATCH accepts that slice back only as it was read.

An organization key may pass userId to act as that member: reads answer with their access, and writes are authorized and recorded as them. A user-scoped key may only name its own user (403); a user outside the organization is a 404, as is a write naming a member who has not accepted their invitation. Naming an embed user who has no live embed session is a 403. Only the operations that document userId take it — the draft-explicit …/draft/{draftIdentifier}/… routes act as the key itself.

put/api/v2/documents/{identifier}/draft/app

Request

  • Base URL
    https://omniapp.co (the document declares no server; this is the origin it was published from)
  • URL
    https://omniapp.co/api/v2/documents/{identifier}/draft/app
  • Auth
    HTTP bearer

Path parameters

identifierstring required

Document identifier — either the URL slug (e.g. abc123) or the canonical workbook UUID.

Example:abc123

Query parameters

userIdstring uuid

Target user ID (for org-scoped API keys)

Request body

htmlstring required

The complete app HTML document. Replaces the current HTML; capped at 2 MiB of UTF-8 (maxLength counts characters — the byte cap is what the server enforces). Every write appends an immutable revision.

Response

Draft created (or reused) and app written; the response carries the draftIdentifier. warnings names any resource hosts the app’s iframe CSP will block until an org admin allows them, a map-provider or print-and-dialogs setting the organization turns off, and navigation domains the organization’s navigation policy refuses.

descriptionstring nullable required

Document description.

draftIdentifierstring required

Identifier of the draft the patch was applied to.

identifierstring required

Published document identifier the draft targets.

namestring required

Document name.

warningsstring[]

Non-blocking warnings — present only when there are any. Currently: external resource hosts the app's iframe CSP will block until an org admin allows them, a map-provider, print-and-dialogs, fullscreen, clipboard, or downloads setting the organization's app policy turns off for every app, and navigation domains outside the organization's navigation policy (links to them are refused). The write itself succeeded. Advisory prose, not a contract: the wording is deliberately volatile, there are no per-warning codes, and consumers must not branch on the content. The render-time CSP is the enforcement.

Changes

    • info

      added the new optional query request parameter userId

    • info

      added the new optional request property /////

    • info

      added the optional property /// to the response with the status

    • info

      api operation id documentsV2PutAppAutoDraft removed and replaced with documentsPutAppAutoDraft