/pdfCompare Documents (PDF)
Compute a diff between two PDF documents. Supports both multipart/form-data file uploads and JSON with base64-encoded data URLs.
Parameters
emailquerystringYour email address. Required if not using an API key.
input_typequerystringSpecifies the request content-type. - `form`: multipart/form-data (default) - `json`: application/json
Values: json, form
Default: form
output_typequerystringrequiredSpecifies the type of output you receive in the response body. - `json`: Row metadata generated from PDF-text diff computation (Content-Type: application/json) - `html`: Same HTML/CSS you see on the Diffchecker site for PDF-text diffs (Content-Type: text/html) - `html_json`: Same HTML/CSS, but split up and embedded in JSON (Content-Type: application/json)
Values: json, html, html_json
diff_levelquerystringSpecifies whether you want to diff by word or character. Default is `word`. Should only be used with PDF-text diff related output types.
Values: word, character
Default: word
Request Bodyrequired
left_pdfstring (binary)requiredLeft PDF file you want to diff. File extension must be .pdf.
right_pdfstring (binary)requiredRight PDF file you want to diff. File extension must be .pdf.
Responses
Diff computed successfully. Same response structure as Text diff.
application/json
One of:
rowsobject[]endbooleanstartbooleaninsideChangedbooleanleftobjectchunksobject[]valuestringtypestringEnum: equal, insert, remove
lineintegerrightobjectchunksobject[]valuestringtypestringEnum: equal, insert, remove
lineintegeraddedintegerNumber of added chunks.
removedintegerNumber of removed chunks.
htmlstringHTML markup of the diff table.
cssstringCSS styles for the diff table.
Example: output_type=json
{
"rows": [
{
"end": false,
"left": {
"chunks": [
{
"value": "The quick brown fox ",
"type": "equal"
},
{
"value": "jumps",
"type": "remove"
}
],
"line": 1
},
"right": {
"chunks": [
{
"value": "The quick brown fox ",
"type": "equal"
},
{
"value": "leaps",
"type": "insert"
}
],
"line": 1
},
"insideChanged": true,
"start": true
},
{
"end": true,
"left": {
"chunks": [
{
"value": "",
"type": "remove"
},
{
"value": "over the lazy dog.",
"type": "equal"
}
],
"line": 2
},
"right": {
"chunks": [
{
"value": "",
"type": "insert"
},
{
"value": "over the lazy dog.",
"type": "equal"
}
],
"line": 2
},
"insideChanged": false
}
],
"added": 1,
"removed": 1
}Example: output_type=html_json
{
"html": "<table class=\"diff-table\">...</table>",
"css": ".diff-table { font-family: monospace; ... }"
}text/html
stringExample Request
curl -X POST \
"https://api.diffchecker.com/public/pdf?email=your%40email.com&input_type=json&output_type=json&diff_level=word" \
-H "Content-Type: application/json" \
-d '{
"left_pdf": "{left_pdf}",
"right_pdf": "{right_pdf}"
}'Try It
Click or drag to upload
Click or drag to upload