doc.diff.capture, doc.diff.compare, and doc.diff.apply.
This page covers the main file-to-file workflow:
- You already have a base document,
Doc1 - A new document,
Doc2, arrives later - You want to produce
Doc3, which starts fromDoc1and contains allDoc2changes as tracked changes
Recommended workflow
Use two sessions:- Open
Doc1as the base session - Open
Doc2as a temporary target session - Capture a diff snapshot from the target session
- Compare the base session against that snapshot
- Apply the diff back onto the base session with
changeMode: 'tracked' - Save the base session to a new output path as
Doc3
Tracked diff apply requires a user identity. Set
user on the SDK client so tracked changes are attributed correctly.Doc1 open, keep using that session as the base session and only open the uploaded document as the temporary target session.
Node.js
Python
What this produces
Doc3is based onDoc1, notDoc2- Body edits from
Doc2are replayed ontoDoc1as tracked changes - Comments, styles, and numbering changes are replayed directly
- The output stays as a reviewable redline until someone accepts or rejects the tracked changes
Current v1 limits
- Header and footer content is not diffed in v1
- The diff payload is opaque and intended for replay, not semantic inspection
diff.applychecks that the current base document fingerprint still matches the diff’sbaseFingerprint
diff.compare and before diff.apply, re-run the compare step against the current base document state.

