- Developer home
- Embed editors
- Document compare
Document compare
This page is not yet translated into your language; it is shown in English.
Document compare
POST /api/v1/embed/compare compares two .docx versions as Word's Review > Compare > Compare Documents does and answers the revised document with every difference recorded as a tracked change (insertions and deletions, attributed to options.author), plus a JSON summary. Open it in Word or in the embedded editor to accept or reject each change; output_format "json" answers the summary alone.
curl https://mroffice.ai/api/v1/embed/compare \
-H "Authorization: Bearer $MROFFICE_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"original": { "url": "https://files.example.com/signed/msa-v1.docx" },
"revised": { "url": "https://files.example.com/signed/msa-v2.docx" },
"options": { "author": "Legal review" }
}'- Both documents' own tracked changes are taken as accepted first (Word asks the same).
- Paragraphs and tables are matched by their text; a paragraph only in the original is a deleted paragraph, one only in the revised document an inserted one, and a paragraph changed in place is compared word by word (options.granularity "character": character by character).
- Unchanged and inserted words keep the revised document's formatting, deleted words the original's; a deleted picture is carried over with its image.
- Tables are compared row by row and cell by cell; a row only in one version is an inserted or deleted row.
- Not compared: formatting-only changes, moves (shown as a deletion and an insertion), headers, footers, footnotes and comments.
| Option | Meaning |
|---|---|
original, revised | { url | upload_id | data_base64, name? }, both .docx. |
options.author | Who the changes are attributed to (default MR Office). |
options.date | Their date, ISO 8601 (default now). |
options.granularity | word (default, Word's) or character. |
output_format | docx (default) or json. |
result.comparison counts the insertions and deletions (and their words) and lists each change with its location; the job keeps the first 200, the json output all of them (up to 1,000).
"result": {
"filename": "msa-v2-comparison.docx",
"comparison": {
"identical": false,
"insertions": 4, "deletions": 3, "words_inserted": 11, "words_deleted": 7,
"author": "Legal review", "date": "2026-11-21T09:00:00Z", "granularity": "word",
"changes": [
{ "type": "replace", "location": "paragraph 3", "original_text": "30 days", "text": "45 days" },
{ "type": "delete", "location": "paragraph 9", "original_text": "This clause survives termination." },
{ "type": "insert", "location": "paragraph 12 (table row)", "text": "Support\tIncluded" }
],
"changes_truncated": false
}
}