This article covers API Self-Hosted v3. The endpoint behaves the same way on API Self-Hosted v2 and on the Draftable cloud API.
Endpoint
- your-self-hosted-domain: The base URL of your API Self-Hosted v3 instance — the same host you use for all other API calls (the load balancer or ingress in front of the
apish-webservice). - 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:The key is named
s3_links regardless of which storage backend your instance uses. On a default v3 deployment, which stores comparison files on a local volume, the values are relative paths on your own instance, not AWS presigned URLs. See Storage links.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:Storage links
Thes3_links object contains links for downloading the documents and viewer data files associated with the comparison.
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.).Link format depends on your storage backend
The form these links take depends on how your instance is configured to store comparison files.- Local volume storage (default)
- S3 object storage
A v3 instance stores comparison files on a local volume unless you configure object storage. In this mode each value is a relative path on your own instance, under Prepend your instance’s base URL to download the file:These paths do not expire on their own — they remain valid until the comparison itself expires and its files are deleted.
/api/v1/content/: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 these HTTP status codes in your code:
202 Accepted— The comparison is still processing. The response body advises checking the comparison endpoint for its status before retrying. Treat this as “not ready yet”, not as success, and note that a202carries no change data.401 Unauthorized— Invalid or missing API token404 Not Found— The comparison ID does not exist, has expired, belongs to a different account, or the comparison failed
- 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.
- Link expiry: How long the values in
s3_linksremain usable depends on your storage backend. See Link format depends on your storage backend.

