Compare Versions
Compare two versions of a document to see what changed.
GET /v1/documents/:id/versions/compare
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Document ID |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
from | integer | Yes | Source version |
to | integer | Yes | Target version |
Example Request
curl "https://api.inherent.systems/v1/documents/doc_abc123/versions/compare?from=1&to=3" \
-H "Authorization: Bearer $INHERENT_API_KEY"
Response
{
"document_id": "doc_abc123",
"from_version": 1,
"to_version": 3,
"summary": {
"added_chunks": 12,
"removed_chunks": 2,
"modified_chunks": 3,
"size_change_bytes": 16384,
"token_change": 4096
},
"changes": [
{
"type": "added",
"chunk_index": 5,
"content": "## Rate Limiting\n\nRate limits vary by plan..."
},
{
"type": "modified",
"chunk_index": 0,
"old_content": "# API Authentication\n\nAll requests require...",
"new_content": "# API Authentication\n\nAll API requests require authentication using a Bearer token..."
},
{
"type": "removed",
"chunk_index": 10,
"content": "## Deprecated: Basic Auth\n\nBasic authentication is no longer supported..."
}
]
}
Response Fields
| Field | Type | Description |
|---|---|---|
from_version | integer | Source version |
to_version | integer | Target version |
summary | object | Change summary |
summary.added_chunks | integer | New chunks added |
summary.removed_chunks | integer | Chunks removed |
summary.modified_chunks | integer | Chunks modified |
changes | array | Detailed changes |
changes[].type | string | added, removed, or modified |
changes[].chunk_index | integer | Chunk position |
changes[].content | string | Chunk content |
Errors
| Code | Description |
|---|---|
404 | Document not found |
404 | Version not found |
400 | Invalid version range |