Alpha: Document API is currently alpha and subject to breaking changes.
Summary
Apply a previously computed diff payload to the current document. The document fingerprint must match the diff base fingerprint. Tracked mode governs body content only; styles, numbering, and comments are always applied directly.- Operation ID:
diff.apply - API member path:
editor.doc.diff.apply(...) - Mutates document:
yes - Idempotency:
conditional - Supports tracked mode:
yes - Supports dry run:
no - Deterministic target resolution:
yes
Expected result
Returns a DiffApplyResult with applied operation count and diagnostics.Input fields
| Field | Type | Required | Description |
|---|---|---|---|
diff | object(version=“sd-diff-payload/v1”) | yes | |
diff.baseFingerprint | string | yes | |
diff.coverage | object | yes | |
diff.coverage.body | true | yes | Constant: true |
diff.coverage.comments | boolean | yes | |
diff.coverage.headerFooters | false | yes | Constant: false |
diff.coverage.numbering | boolean | yes | |
diff.coverage.styles | boolean | yes | |
diff.engine | enum | yes | "super-editor" |
diff.payload | object | yes | |
diff.summary | object | yes | |
diff.summary.body | object | yes | |
diff.summary.body.hasChanges | boolean | yes | |
diff.summary.changedComponents | enum[] | yes | |
diff.summary.comments | object | yes | |
diff.summary.comments.hasChanges | boolean | yes | |
diff.summary.hasChanges | boolean | yes | |
diff.summary.numbering | object | yes | |
diff.summary.numbering.hasChanges | boolean | yes | |
diff.summary.styles | object | yes | |
diff.summary.styles.hasChanges | boolean | yes | |
diff.targetFingerprint | string | yes | |
diff.version | "sd-diff-payload/v1" | yes | Constant: "sd-diff-payload/v1" |
Example request
Output fields
| Field | Type | Required | Description |
|---|---|---|---|
appliedOperations | integer | yes | |
baseFingerprint | string | yes | |
coverage | object | yes | |
coverage.body | true | yes | Constant: true |
coverage.comments | boolean | yes | |
coverage.headerFooters | false | yes | Constant: false |
coverage.numbering | boolean | yes | |
coverage.styles | boolean | yes | |
diagnostics | string[] | yes | |
summary | object | yes | |
summary.body | object | yes | |
summary.body.hasChanges | boolean | yes | |
summary.changedComponents | enum[] | yes | |
summary.comments | object | yes | |
summary.comments.hasChanges | boolean | yes | |
summary.hasChanges | boolean | yes | |
summary.numbering | object | yes | |
summary.numbering.hasChanges | boolean | yes | |
summary.styles | object | yes | |
summary.styles.hasChanges | boolean | yes | |
targetFingerprint | string | yes |
Example response
Pre-apply throws
INVALID_INPUTCAPABILITY_UNSUPPORTEDPRECONDITION_FAILEDCAPABILITY_UNAVAILABLE
Non-applied failure codes
- None
Raw schemas
Raw input schema
Raw input schema
Raw output schema
Raw output schema
Raw success schema
Raw success schema
Raw failure schema
Raw failure schema

