Contents

Apply a bounded structural DOCX operation batch

Language edits use {find, replace}; structured edits use {op, ...}. By default, valid items are applied even when another item fails, with a 207 response containing appliedEditIndexes, failedEdits, and retryArguments for only the failed items. Set atomic=true for all-or-nothing behavior. Every edit is a tracked change: structured ops are limited to replace_text_tracked, replace_text, insert_paragraph, delete_paragraph, set_paragraph_format, apply_list and format_text_range, and every change is filed under exactly "Scaffold Assistant for <email>" (an edit's own author is ignored). The api names every change: an edit's own change_id is ignored. No edit may touch a pending change, the agent's own included, nor rework what an earlier edit in the same batch made, nor cross the edge of a comment's range; formatting wholly inside the agent's own pending insertion is allowed. Text a reviewer couldn't see is refused, whichever edit wrote it. For insert_paragraph, prefer before_text or after_text containing a unique nearby paragraph excerpt. Otherwise send target_block_index together with position=before or position=after. format_text_range offsets are zero-based and end-exclusive; expected_text guards the complete selected range, while expected_text_prefix guards a long range's start.

POST /documents/{documentId}/edits/batch

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

  • edits object[]

    At most 64 edits a request; more is refused (DOCUMENT_EDIT_OPERATIONS_INVALID). One edit's replace_all may change more paragraphs than that, up to 1,000 places across the request; more is refused the same way, with nothing saved.

  • operations object[]

    Backward-compatible alias for edits.

  • changes object[]

    Accepted natural-language alias for edits.

  • atomic boolean

    Default false