Skip to main content

Compare Versions

Compare two versions of a document to see what changed.

GET /v1/documents/:id/versions/compare

Path Parameters

ParameterTypeDescription
idstringDocument ID

Query Parameters

ParameterTypeRequiredDescription
fromintegerYesSource version
tointegerYesTarget 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

FieldTypeDescription
from_versionintegerSource version
to_versionintegerTarget version
summaryobjectChange summary
summary.added_chunksintegerNew chunks added
summary.removed_chunksintegerChunks removed
summary.modified_chunksintegerChunks modified
changesarrayDetailed changes
changes[].typestringadded, removed, or modified
changes[].chunk_indexintegerChunk position
changes[].contentstringChunk content

Errors

CodeDescription
404Document not found
404Version not found
400Invalid version range