POST/document/redline

Compare Documents (Redline)

Upload an original DOCX (left_docx) and a revised DOCX (right_docx) as multipart/form-data. By default the response is a DOCX based on the revised document with differences represented as Microsoft Word tracked changes. Set output_type to get a readable change list instead of, or as well as, the DOCX. Every output type costs the same number of credits. Page numbers in the change list come from Diffchecker's own layout of the redline and can differ from Word's, especially when a document uses fonts that are not available on the server.

Parameters

Diffchecker-Versionheaderstring

API version to serve the request with. Defaults to the newest version, currently 1, when omitted. An unsupported version is rejected with 400 UNSUPPORTED_API_VERSION. See Versioning and Deprecation in the getting started guide.

Values: 1

Default: 1

emailquerystring

Your email address. Required if not using an API key.

output_typequerystring

Specifies the type of output you receive in the response body. - docx: The tracked-changes DOCX (Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document) - markdown: A readable change list, with a stable ID for each change, followed by the full document text with the changes marked (Content-Type: text/markdown) - json: Change counts, comment changes, the same Markdown, and the DOCX as a base64 data URL (Content-Type: application/json)

Values: docx, markdown, json

Default: docx

diff_levelquerystring

Specifies how finely changed text is compared. smart chooses between word and character changes. Default is smart.

Values: smart, word, character

Default: smart

compare_formattingquerystring

Whether to report formatting changes. Default is true.

Values: true, false

Default: true

compare_tablesquerystring

Whether to compare tables. When false, tables are taken from the revised document unchanged. Default is true.

Values: true, false

Default: true

compare_headersquerystring

Whether to compare headers and footers. When false, they are taken from the revised document unchanged. Default is true.

Values: true, false

Default: true

compare_footnotesquerystring

Whether to compare footnotes and endnotes. Default is true.

Values: true, false

Default: true

compare_textboxesquerystring

Whether to compare text inside text boxes. When false, text boxes are taken from the revised document unchanged. Default is true.

Values: true, false

Default: true

compare_fieldsquerystring

Whether to compare field codes such as cross-references and page numbers. When false, field codes are taken from the revised document, and their displayed text is still compared as plain text. Default is true.

Values: true, false

Default: true

compare_commentsquerystring

Whether to compare Word comments. When false, comments are taken from the revised document unchanged and no comment changes are reported. Default is true.

Values: true, false

Default: true

show_movesquerystring

Whether to report relocated text as moves. When false, it is reported as a deletion and an insertion. Default is true.

Values: true, false

Default: true

pre_existing_revisionsquerystring

How to treat tracked changes already in the uploaded documents. accept applies them before comparing, and reject undoes them. When omitted, they stay in the documents and can appear in the output mixed with the changes this comparison finds, so setting a value is recommended for documents that may contain tracked changes.

Values: accept, reject

Request Bodyrequired

left_docxstring (binary)required

Original Word document. The uploaded filename must end in .docx.

right_docxstring (binary)required

Revised Word document. The uploaded filename must end in .docx.

Responses

Every response includes the X-Credits-Used header. In JSON responses, the same value is also available in the creditsUsed field.

The requested output. Usage has committed before delivery starts.

application/vnd.openxmlformats-officedocument.wordprocessingml.document

string (binary)

text/markdown

string

application/json

creditsUsedintegerrequired

Credits charged for the diff request.

countsobjectrequired

Number of changes found. total is the sum of the others.

totalintegerrequired
insertionsintegerrequired
deletionsintegerrequired
movesintegerrequired
formattingintegerrequired
commentsintegerrequired
commentChangesobject[]required

Added, removed and edited Word comments. Empty when compare_comments=false.

kindstringrequired

Enum: added, removed, edited

commentIdintegerrequired

The comment's w:id in the returned DOCX. When anchorUnsupported is true, the comment is not in the returned DOCX and this is its w:id in the original document, which can match an unrelated comment's id in the returned DOCX.

parentCommentIdinteger

The w:id in the returned DOCX of the comment this one replies to, when that comment is in the returned DOCX.

durableIdstring

Word's durable identifier for the comment, when the document has one.

authorstringrequired
initialsstring
datestring

The date as written in the document.

dateUtcstring

The date in UTC, when the document records one.

textstringrequired

The comment's text. For a removed comment, its text in the original document.

oldTextstring

The original text of an edited comment.

anchorTextstring

The document text the comment is attached to.

resolvedbooleanrequired
anchorScopestring

The part of the document the comment is attached to. Absent when no anchor was found.

Enum: body, footnote, endnote, header, footer

anchorApproximateboolean

Present when the comment's position in the returned DOCX is approximate, because its original anchor has no exact place in the document body.

Enum:

anchorUnsupportedboolean

Present when the comment is reported here but not included in the returned DOCX, because it is attached to a part of the document this request did not compare, such as footnotes with compare_footnotes=false.

Enum:

markdownstringrequired

The same change list returned by output_type=markdown.

docxstringrequired

The tracked-changes DOCX as a base64 data URL.

Example Request

curl
curl -X POST \
  "https://api.staging.diffchecker.com/public/document/redline?email=your@email.com&output_type=docx&diff_level=smart&compare_formatting=true&compare_tables=true&compare_headers=true&compare_footnotes=true&compare_textboxes=true&compare_fields=true&compare_comments=true&show_moves=true&pre_existing_revisions=accept" \
  -F "left_docx=@/path/to/left_docx.docx" \
  -F "right_docx=@/path/to/right_docx.docx" \
  --output "redline.docx"

Try It