# Diff operations

> Snapshot-based document comparison and replay.



3 operations. Names, descriptions, and behavior flags come from the canonical contract.

## Operations

- [`diff.capture`](/document-api/reference/diff/capture) (read): Capture the current document's diffable state as a versioned snapshot. v2 capture requires source-complete state and reports coverage for body, comments, styles, numbering, and header/footers, with extended family coverage carried in the opaque payload. Legacy body-only v2 artifacts remain accepted for compare/apply compatibility.
- [`diff.compare`](/document-api/reference/diff/compare) (read): Compare the current document (base) against a previously captured target snapshot. Returns a versioned diff payload whose summary reports which components changed: body, comments, styles, numbering, header/footers, and parts.
- [`diff.apply`](/document-api/reference/diff/apply) (mutates, tracked): Apply a previously computed diff payload to the current document. The document fingerprint must match the diff base fingerprint. Omitted changeMode applies story content directly; explicit tracked mode governs all four story families (body, header/footer parts, footnotes, endnotes). Comments, styles, and numbering are always applied directly. Supported mixed full-diff payloads apply atomically across body, comments, styles, numbering, and header/footers. Unsupported/deferred families such as package-graph/media/hyperlink closure, settings/theme, and textboxes fail closed before mutation.

