Skip to main content

Rollback Version

Restore a document to a previous version. This creates a new version with the content from the target version.

POST /v1/documents/:id/rollback

Path Parameters

ParameterTypeDescription
idstringDocument ID

Request Body

FieldTypeRequiredDescription
target_versionintegerYesVersion to restore
reasonstringNoRollback reason (for audit)

Example Request

curl -X POST https://api.inherent.systems/v1/documents/doc_abc123/rollback \
-H "Authorization: Bearer $INHERENT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"target_version": 2,
"reason": "Reverting breaking changes from v3"
}'

Response

{
"id": "doc_abc123",
"previous_version": 3,
"new_version": 4,
"restored_from": 2,
"status": "processing",
"reason": "Reverting breaking changes from v3",
"created_at": "2024-01-20T10:00:00Z"
}

How It Works

  1. Creates a new version - Rollback creates version 4 with content from version 2
  2. Preserves history - Version 3 remains accessible
  3. Re-processes content - New version is chunked and embedded
  4. Audit trail - Rollback action is logged with reason

Response Fields

FieldTypeDescription
previous_versionintegerVersion before rollback
new_versionintegerNew version number
restored_fromintegerSource version
statusstringProcessing status
reasonstringRollback reason

Errors

CodeDescription
404Document not found
404Target version not found
400Cannot rollback to current version