Skip to main content
The change-details endpoint returns a detailed JSON breakdown of every change detected between two compared documents. This includes the type of change, the affected text, positional coordinates on each page, font and style information, and a statistical summary.

Endpoint

  • Comparison_ID: The unique identifier for the comparison (returned when you create a comparison via the API).

Authentication

Include your API token in the Authorization header:

Example request

Response structure

The JSON response contains three top-level keys:

Change objects

Each object in the changes array represents a segment of text that was either matched, inserted, deleted, or replaced between the left (older) and right (newer) documents.

Change kinds

Common fields on all change objects

Additional fields by kind

Examples by change kind

Match

A match change represents text that is identical in both documents.

Insert

An insert change represents text that exists only in the right (newer) document.

Delete

A delete change represents text that exists only in the left (older) document.

Replace

A replace change represents text that was changed between the left and right documents.

Move detection

When Draftable detects that a block of text was moved (cut from one location and pasted to another), the individual insert and delete changes that make up the move are linked together using the moveId field. This allows you to distinguish a true move from unrelated insertions and deletions.

The moveId format

The moveId is a string in the format "{moveGroup}-{subIndex}": Changes that are not part of a move operation will not have a moveId field.

How moves appear in the changes array

A move is represented as paired delete and insert entries:
  • A delete change with moveId — the text was removed from this location in the left document
  • An insert change with the same moveId — the text was placed at this location in the right document

Gaps in the sub-index sequence

When a moved block also contains edits (text that was changed within the moved content), the sub-index sequence will have gaps. For example, you might see moveId values of "0-0" and "0-2" but no "0-1". The gap positions represent portions of the moved text that were edited — those edits appear as regular replace, insert, or delete changes without a moveId. Example sequence for a move with internal edits:

Reconstructing move regions

Each individual change that is part of a move still carries its own leftRegion or rightRegion with full bounding box coordinates. To get the complete regions for an entire move operation, group changes by their moveGroup and collect the regions:
The moveId field is only present on delete and insert changes that Draftable has identified as part of a move operation. Not all deletions and insertions are moves — only those where the comparison engine has matched the removed text to inserted text elsewhere in the document.

Region objects

Region objects describe the physical location of text on a page. They appear as leftRegion and rightRegion on change objects. These regions correspond directly to the colored highlight boxes visible in the Draftable viewer and in the highlighted PDF exports available via s3_links.
Coordinates are measured in points (1 point = 1/72 of an inch) from the top-left corner of the page. A standard A4 page is approximately 595 x 842 points. A US Letter page is approximately 612 x 792 points.

Marker objects

Marker objects (deletionMark and insertionMark) indicate where change markers appear in the document margin. These correspond to the small indicators shown alongside changes in the Draftable viewer and highlighted PDF exports — they allow you to identify which margin marker corresponds to which change.

Styles info

The stylesInfo object provides font, color, and emphasis data for the text in a change. It allows you to understand the formatting of the text and detect style-only changes.

Style objects

Each style object in leftStyles or rightStyles describes the formatting for a range of characters in the original source document:
The color field represents the text color from the original document, not the comparison highlight color. For example, if a PDF contains a red annotation comment, its color will be "#FF0000" because that is the original text color — not because Draftable highlighted it.

Style map format

The leftStyleMap and rightStyleMap arrays map character ranges in the text to entries in the corresponding styles array. Each entry is a string in the format "start-end", where start and end are zero-based character indices (inclusive). When a text segment has a single style, the style map contains one entry:
When a text segment has multiple styles (e.g., mixed font sizes), the style map contains multiple comma-separated ranges per entry or multiple entries:
This means characters 0 through 25 use the first style in leftStyles, and character 26 uses the second style.

Summary object

The summary object provides an overview of the comparison results.

Summary fields

Change summary fields

Document summary fields

Both leftDocumentSummary and rightDocumentSummary contain:

How the JSON maps to the visual comparison

The change-details JSON provides the same underlying data that powers the Draftable viewer and highlighted PDF exports. Here is how the key fields relate to what you see visually:
You can use the rectangles coordinates to programmatically draw your own highlight overlays on the original PDFs, or to build custom change navigation (e.g., “jump to change on page 5”).
The s3_links object contains presigned URLs for downloading documents and viewer data files associated with the comparison. These URLs are temporary and will expire.
The left_highlighted and right_highlighted PDFs are the same highlighted documents used in the Draftable combined comparison export. The combined export interleaves them page-by-page (left page 1, right page 1, left page 2, right page 2, etc.).

Fetching change-details via code (Python)

You can access the change-details endpoint programmatically. Below is an example using Python.
The change-details endpoint is not part of any existing Draftable client library. You will need to call it directly using an HTTP client.

Important considerations

  1. Authentication: You must include a valid API token in the Authorization header. Ensure your token has access to the comparison you are querying.
  2. Comparison must be complete: The change-details endpoint is only available after a comparison has finished processing. Check the comparison status via the main comparisons endpoint before requesting change details.
  3. Error handling: Handle common HTTP status codes in your code:
    • 401 Unauthorized — Invalid or missing API token
    • 404 Not Found — Comparison ID does not exist or has expired
  4. Data privacy: The response contains the full text content of both compared documents. Ensure appropriate security measures are in place when storing or transmitting this data.
  5. Presigned URL expiry: The URLs in s3_links are temporary presigned URLs. Retrieve fresh URLs by calling the endpoint again if they have expired.
For more information on other API endpoints, refer to the Draftable API Documentation. If you encounter any issues accessing the endpoint or need assistance, reach out to our support team.