Contents

Replace one exact XML fragment as a tracked change

expected_xml must match exactly one fragment of the document's current document.xml (read it with GET .../xml first). Both fragments must be whole runs (w:r) with no revision markup of their own: the engine records a text change as a tracked w:del/w:ins and one run's formatting change as a tracked formatting change. Anything else (paragraph properties, paragraphs, tables, sections, text inside a run, half a field or bookmark, a comment reference, or a run holding anything but text, tabs, breaks and whole fields that only show their result) is refused. So is a run property off a short list (w:rStyle, w:rFonts, w:b, w:bCs, w:i, w:iCs, w:caps, w:smallCaps, w:strike, w:dstrike, w:rtl, w:cs, w:noProof, w:color, w:sz, w:szCs, w:spacing, w:w, w:kern, w:position, w:highlight, w:u, w:shd, w:vertAlign, w:lang) or not in the form Word reads, unless kept identical from expected_xml, and text a reviewer couldn't see: colored too close to what is behind it (run, paragraph or cell shading, else the page), under 4 points, squeezed, condensed or moved off its line, Unicode tag characters or a bidi override, a w:rStyle whose style (through basedOn) hides it or can't be read, or mc:AlternateContent. So is a patch that touches a pending change, the agent's own included, or sits in a paragraph or row whose mark is pending. The change is filed under exactly "Scaffold Assistant for <email>", and its id is the api's.

POST /documents/{documentId}/edits/xml-patch

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

  • target_xpath string Required
  • expected_xml string Required
  • replacement_xml string Required
  • justification string

Returns

  • document object

    The persisted upload/document row, as returned by every route that creates or mutates upload content (create, save draft, rename, delete, new version, revision-apply, redline edits).

    Show 19 fields
    • id string
    • artifactId string | null
    • orgId string
    • createdByUserId string | null
    • fileName string
    • mimeType string
    • sizeBytes integer
    • purpose string

      One of source_doc playbook

    • clientReferenceId string | null
    • documentSeriesId string
    • documentVersion integer
    • parentUploadId string | null
    • versionKind string

      One of original working_draft

    • storageKey string | null
    • contentSha256 string | null
    • hasBinary boolean
    • status string
    • createdAt string
    • updatedAt string
  • agentAuthor string

    The name this caller's agent edits under.

  • targetXpath string
  • createdChangeIds string[]

    The ids of the tracked changes this patch made.

  • createdChangeIdsComplete boolean
  • revisions object[]
    Show 7 fields
    • ordinal integer Required

      The change's position in document order.

    • change_id string Required

      The id to pass in accepted_change_ids or rejected_change_ids.

    • kind string Required

      insert and delete are text changes, paragraph_mark is an inserted or deleted paragraph mark (a paragraph split or join; it carries no text of its own), proposed is a Scaffold change marker, and the -prop-change kinds are tracked formatting or structure changes.

      One of insert delete paragraph_mark proposed r-prop-change p-prop-change tbl-prop-change tr-prop-change tc-prop-change sect-prop-change

    • author string | null
    • date string | null
    • text_preview string Required

      A short excerpt of the changed text.

    • justification string | null

      The reason recorded with the change, shown to the reviewer.