Diffing compares two DOCX files and produces a third document as a reviewable redline. The workflow uses Document Engine diff operations:Documentation Index
Fetch the complete documentation index at: https://docs.superdoc.dev/llms.txt
Use this file to discover all available pages before exploring further.
diff.capture, diff.compare, and diff.apply.
The examples below use the Node and Python SDKs because file-to-file comparison usually runs in backend automation, but the feature isn’t SDK-specific: the same operations are available through the Document API and CLI.
File-to-file workflow
You already have a base document,Doc1. A new document, Doc2, arrives later. You want to produce Doc3, which starts from Doc1 and contains all Doc2 changes as tracked changes.
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.

