Contents

Save a person's untracked edit to one paragraph, around its tracked changes (Editing mode)

Editing mode with tracked changes shown: the review pane sends one paragraph's visible text as the person saw it and as they left it. The engine writes the difference into the paragraph's plain text, untracked, and leaves every pending tracked change in it exactly as it was. Each contiguous edit is checked on its own, so edits on both sides of a change go in; an edit that changes or sits right against a change's own text is refused (decide that change first). A line or paragraph break is a structure edit, made with tracked changes hidden. The document is saved in place (same id and version), guarded by expected_content_sha256, and refused if any pending change would be dropped. Each save and its document.direct_edit usage event (the signed-in person, the paragraph, the hashes before and after, never the text) commit in one transaction: if the event can't be recorded, the edit isn't saved. A repeat of a client_edit_id returns the document as it stands, with `replayed: true`, and writes nothing. Its `savedContentSha256` is the hash that save produced: if `document.contentSha256` differs, someone has saved since, and the client must take `contentBase64` before it saves again.

POST /documents/{documentId}/direct-edits

Path parameters

  • documentId string Required

Headers

  • Authorization string Required

    Bearer <session token>: the signed-in user’s Scaffold session token.

  • x-org-id string Required

Body

  • expected_content_sha256 string Required
  • client_edit_id string Required

    Client-generated, one per save and the same on every retry of it. Used for a different save, or by someone else, it is refused (409 DOCUMENT_SAVE_ID_REUSED).

  • block_index integer Required

    Every w:p in body order, table-cell paragraphs included and text-box paragraphs excluded (as for suggestions).

  • before_text string Required
  • after_text string Required

    No line breaks, tabs or paragraph breaks.