POST/pdf/plaintext

Compare Documents (Plain Text PDF)

Compute a plain-text diff between two PDF documents. Supports both multipart/form-data file uploads and JSON with base64-encoded data URLs.

Parameters

emailquerystring

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

input_typequerystring

Specifies the request content-type. - `form`: multipart/form-data (default) - `json`: application/json

Values: json, form

Default: form

output_typequerystringrequired

Specifies 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_levelquerystring

Specifies 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)required

Left PDF file you want to diff. File extension must be .pdf.

right_pdfstring (binary)required

Right PDF file you want to diff. File extension must be .pdf.

Responses

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

Diff computed successfully. Same response structure as Text diff.

application/json

One of:

creditsUsedintegerrequired

Credits charged for the diff request.

rowsobject[]required
endboolean
startboolean
insideChangedboolean
leftobject
chunksobject[]
valuestring
typestring

Enum: equal, insert, remove

lineinteger
rightobject
chunksobject[]
valuestring
typestring

Enum: equal, insert, remove

lineinteger
addedintegerrequired

Number of added chunks.

removedintegerrequired

Number of removed chunks.

creditsUsedintegerrequired

Credits charged for the diff request.

htmlstringrequired

HTML markup of the diff table.

cssstringrequired

CSS styles for the diff table.

Example: output_type=json
{
  "creditsUsed": 1,
  "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
{
  "creditsUsed": 1,
  "html": "<table class=\"diff-table\">...</table>",
  "css": ".diff-table { font-family: monospace; ... }"
}

text/html

string

Example Request

curl
curl -X POST \
  "https://web.preview.diffchecker.com/api/public//pdf/plaintext?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