Diffchecker API

At the moment there exists 3 HTTP endpoints for computing text diffs, PDF diffs, and Image diffs, all with varying output types. We plan to gradually add more input and output types as we move forward with the API (e.g. Excel, etc).
You may find the following resources helpful when dealing with PDF and image diffs:
Authentication

There are two ways of interacting with the Diffchecker API:
  • Email: just pass your email as a query string parameter. This method does not require you to have a Diffchecker account and will allow you to make as many diffs as free tier limits allow.
  • API Key: every paid subscriber gets their own API key, which needs to be passed as the request's X-Api-Key header. This will allow you to make as many diffs as your paid plan allows.
When both are provided, email gets ignored in favor of the API key. The examples in these docs assume you are authenticating via email.
Text Diff
Usage
POST https://api.diffchecker.com/public/text
Parameters
Name          Type    In     Required    Description
-------------------------------------------------------------------------------------------------------------
output_type   string  query  yes         Specifies the type of output you receive in the response body.
                                         Value must be one of 'json', 'html', or 'html_json'.
                                           - json: (Content-Type: application/json)
                                                   Row metadata generated from diff computation
                                           - html: (Content-Type: text/html)
                                                   Same html/css you see on Diffchecker site
                                           - html_json: (Content-Type: application/json)
                                                   Same html/css you see on Diffchecker site, but split up
                                                   and embedded in JSON
diff_level    string  query  no          Specifies whether you want to diff by word or character.
                                         Value must be one of 'word' or 'character'. Default is 'word'.
left          string  body   yes         Left text you want to diff.
right         string  body   yes         Right text you want to diff.
Examples
curl --location --request POST 'https://api.diffchecker.com/public/text?output_type=html&email=YOUR_EMAIL' \
--header 'Content-Type: application/json' \
--data-raw '{
    "left": "roses are red\nviolets are blue",
    "right": "roses are green\nviolets are purple",
    "diff_level": "word"
}'
JSON Responses
output_type=json
{
  "rows": [
    {
      "end": false,
      "left": {
        "chunks": [
          {
            "value": "roses are ",
            "type": "equal"
          },
          {
            "value": "red",
            "type": "remove"
          }
        ],
        "line": 1
      },
      "right": {
        "chunks": [
          {
            "value": "roses are ",
            "type": "equal"
          },
          {
            "value": "green",
            "type": "insert"
          }
        ],
        "line": 1
      },
      "insideChanged": true,
      "start": true
    },
    {
      "end": true,
      "left": {
        "chunks": [
          {
            "value": "",
            "type": "remove"
          },
          {
            "value": "violets are ",
            "type": "equal"
          },
          {
            "value": "blue",
            "type": "remove"
          }
        ],
        "line": 2
      },
      "right": {
        "chunks": [
          {
            "value": "",
            "type": "insert"
          },
          {
            "value": "violets are ",
            "type": "equal"
          },
          {
            "value": "purple",
            "type": "insert"
          }
        ],
        "line": 2
      },
      "insideChanged": true
    }
  ],
  "added": 3,
  "removed": 3
}
output_type=html_json
{
  "html": "<table class=\"diff-table\"><thead><tr><td class=\"line-number-header\"></td><td class=\"side-content-header\"></td><td class=\"line-number-header\"></td><td class=\"side-content-header\"></td></tr></thead><tbody><tr class=\"diff-row\"><td data-content=\"1\" class=\"diff-line-number\"></td><td class=\"diff-line start diff-line-modified diff-line-with-removes\"><span class=\"diff-chunk diff-chunk-equal diff-chunk-modified\">roses are </span><span class=\"diff-chunk diff-chunk-removed diff-chunk-modified\">red</span></td><td data-content=\"1\" class=\"diff-line-number\"></td><td class=\"diff-line start diff-line-modified diff-line-with-inserts\"><span class=\"diff-chunk diff-chunk-equal diff-chunk-modified\">roses are </span><span class=\"diff-chunk diff-chunk-inserted diff-chunk-modified\">green</span></td></tr><tr class=\"diff-row\"><td data-content=\"2\" class=\"diff-line-number\"></td><td class=\"diff-line end diff-line-modified diff-line-with-removes\"><span class=\"diff-chunk diff-chunk-removed diff-chunk-modified\"></span><span class=\"diff-chunk diff-chunk-equal diff-chunk-modified\">violets are </span><span class=\"diff-chunk diff-chunk-removed diff-chunk-modified\">blue</span></td><td data-content=\"2\" class=\"diff-line-number\"></td><td class=\"diff-line end diff-line-modified diff-line-with-inserts\"><span class=\"diff-chunk diff-chunk-inserted diff-chunk-modified\"></span><span class=\"diff-chunk diff-chunk-equal diff-chunk-modified\">violets are </span><span class=\"diff-chunk diff-chunk-inserted diff-chunk-modified\">purple</span></td></tr></tbody></table>",
  "css": "\n.diff-table {\n  font-family: monospace;\n  background: #FFFFFF;\n  font-size: 0.8125rem;\n  border-collapse: collapse;\n}\n.side-content-header {\n  width: 50%;\n}\n.diff-row {\n}\n.diff-line-number {\n  color: #999;\n  padding: 0 8px 0 5px;\n  text-align: right;\n  vertical-align: top;\n}\n.diff-line-number:before {\n  content: attr(data-content);\n}\n.diff-line {\n  white-space: pre-wrap;\n  word-break: break-all;\n  overflow-wrap: break-word;\n  line-height: 1rem;\n  padding-right: 20px;\n}\n.diff-line-inserted {\n  background: #B5EFDB;\n}\n.diff-line-removed {\n  background: #FFC4C1;\n}\n.diff-line-empty {\n  background: #EAEEF0;\n}\n.diff-line-modified.diff-line-with-inserts {\n  background: #B5EFDB;\n}\n.diff-line-modified.diff-line-with-removes {\n  background: #FFC4C1;\n}\n.diff-chunk-inserted {\n  background: #6BDFB8;\n}\n.diff-chunk-removed {\n  background: #FF8983;\n}\n"
}
PDF Diff
Usage
POST https://api.diffchecker.com/public/pdf
Parameters
Name          Type    In     Required    Description
-------------------------------------------------------------------------------------------------------------
output_type   string  query  yes         Specifies the type of output you receive in the response body.
                                         Value must be one of 'json', 'html', or 'html_json'.
                                           - json: (Content-Type: application/json)
                                                   Row metadata generated from PDF-text diff computation
                                           - html: (Content-Type: text/html)
                                                   Same html/css you see on Diffchecker site for PDF-text diffs
                                           - html_json: (Content-Type: application/json)
                                                   Same html/css you see on Diffchecker site for PDF-text diffs,
                                                   but split up and embedded in JSON
diff_level    string  query  no          Specifies whether you want to diff by word or character.
                                         Value must be one of 'word' or 'character'. Default is 'word'.
                                         Should only be used with PDF-text diff related output types.
left_pdf      file    body   yes         Left pdf file you want to diff. File extension must be .pdf
right_pdf     file    body   yes         Right pdf file you want to diff. File extension must be .pdf
Examples
curl --location --request POST 'https://api.diffchecker.com/public/pdf?output_type=json&email=YOUR_EMAIL' \
--form 'left_pdf=@"/Users/user_name/Documents/example-1.pdf"' \
--form 'right_pdf=@"/Users/user_name/Documents/example-2.pdf"'
JSON Responses
output_type=json
Same structure as Text diff response with output_type=json
output_type=html_json
Same structure as Text diff response with output_type=html_json
Image Diff
Usage
POST https://api.diffchecker.com/public/image
Parameters
Name          Type    In     Required    Description
-------------------------------------------------------------------------------------------------------------
input_type    string            query  yes         Specifies the request content-type. Value must be one of 'json' or 'form'
                                                     - json: application/json
                                                     - form: multipart/form-data
output_type   string            query  yes         Specifies the type of output you receive in the response body.
                                                   Value must be one of 'json' or 'png'.
                                                     - json: (Content-Type: application/json)
                                                             Same PNG you see on Diffchecker site for image diffs, but
                                                             embedded in JSON as a data url 
                                                     - png: (Content-Type: image/png)
                                                             Same PNG you see on Diffchecker site for image diffs
left_image    file or string    body   yes         If input_type=json:
                                                     string containing data url of left image you want to diff (link)
                                                   If input_type=form:
                                                     file of left image you want to diff. Accepted file extensions include .png, .jpg, .jpeg
right_image    file or string    body   yes         If input_type=json:
                                                     string containing data url of right image you want to diff (link)
                                                   If input_type=form:
                                                     file of right image you want to diff. Accepted file extensions include .png, .jpg, .jpeg
Examples
Form Input:
curl --location --request POST 'https://api.diffchecker.com/public/image?input_type=form&output_type=png&email=YOUR_EMAIL' \
--form 'left_image=@"/Users/user_name/Documents/example-1.png"' \
--form 'right_image=@"/Users/user_name/Documentsr/example-2.png"'

JSON Input:
curl --location --request POST 'https://api.diffchecker.com/public/image?input_type=json&output_type=png&email=YOUR_EMAIL' \
--header 'Content-Type: application/json' \
--data-raw '{
    "left_image": <left image data url>,
    "right_image": <right image data url>,
}'
JSON Responses
output_type=json
{
  "dataUrl": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABVAAAAS8CAYAAABqj6EFAAAABmJLR0QA/wD/AP..."
}

Pricing

Free

$0/ month

250 text diffs, (2 MB input size)
20 image diffs, (0.2 MB input size)
20 PDF diffs, (0.2 MB input size)
The default plan

Basic

$99/ month

10 000 text diffs, (10 MB input size)
1 000 image diffs, (10 MB input size)
100 PDF diffs, (1 MB input size)
Buy now

Premium

$299/ month

100 000 text diffs, (100 MB input size)
10 000 image diffs, (25 MB input size)
1 000 PDF diffs, (10 MB input size)
Buy now