Endpoint
- Comparison_ID: The unique identifier for the comparison (returned when you create a comparison via the API).
Authentication
Include your API token in theAuthorization header:
Example request
Response structure
The JSON response contains three top-level keys:Change objects
Each object in thechanges 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
Amatch change represents text that is identical in both documents.
Insert
Aninsert change represents text that exists only in the right (newer) document.
Delete
Adelete change represents text that exists only in the left (older) document.
Replace
Areplace 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 individualinsert 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
ThemoveId 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 paireddelete and insert entries:
- A
deletechange withmoveId— the text was removed from this location in the left document - An
insertchange with the samemoveId— 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 seemoveId 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 ownleftRegion 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 asleftRegion 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
ThestylesInfo 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 inleftStyles or rightStyles describes the formatting for a range of characters in the original source document:
Style map format
TheleftStyleMap 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:
leftStyles, and character 26 uses the second style.
Summary object
Thesummary object provides an overview of the comparison results.
Summary fields
Change summary fields
Document summary fields
BothleftDocumentSummary 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:S3 links
Thes3_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
- Authentication: You must include a valid API token in the
Authorizationheader. Ensure your token has access to the comparison you are querying. - 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.
- Error handling: Handle common HTTP status codes in your code:
401 Unauthorized— Invalid or missing API token404 Not Found— Comparison ID does not exist or has expired
- 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.
- Presigned URL expiry: The URLs in
s3_linksare temporary presigned URLs. Retrieve fresh URLs by calling the endpoint again if they have expired.