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
| Parameter | Type | Description |
|---|---|---|
id | string | Document ID |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
target_version | integer | Yes | Version to restore |
reason | string | No | Rollback 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
- Creates a new version - Rollback creates version 4 with content from version 2
- Preserves history - Version 3 remains accessible
- Re-processes content - New version is chunked and embedded
- Audit trail - Rollback action is logged with reason
Response Fields
| Field | Type | Description |
|---|---|---|
previous_version | integer | Version before rollback |
new_version | integer | New version number |
restored_from | integer | Source version |
status | string | Processing status |
reason | string | Rollback reason |
Errors
| Code | Description |
|---|---|
404 | Document not found |
404 | Target version not found |
400 | Cannot rollback to current version |