Get Document Versions
GET /api/writing/documents/{document_id}/versions
π Get version history for a document
Retrieves complete version history with timestamps, authors, and change descriptions. Enables version comparison and rollback for document recovery and change tracking.
Path Parameters:
document_id: Unique identifier of the document
Dependencies:
writing_service: Injected IshvanaWritingModule instance
Returns:
- VersionHistory object with all versions and current version number
Raises:
HTTPException 500: If version history retrieval fails
Example Response:
{
"document_id": "doc_123",
"versions": [
{"version": 1, "timestamp": "...", "changes": "Initial version"},
{"version": 2, "timestamp": "...", "changes": "Added chapter 2"}
],
"current_version": 2
}Parameters
Section titled β Parameters βPath Parameters
Section titled βPath Parameters βResponses
Section titled β Responses βSuccessful Response
Complete document version history model.
Provides the complete version history for a document including all versions with their metadata for history browsing and version management.
Fields: document_id: Document identifier versions: Ordered list of all document versions (newest first) total_versions: Total count of versions
Used By: - GET /api/writing/documents/{document_id}/versions endpoint - Version history browser UI - Version comparison selection - Rollback operation source
object
Individual document version model.
Represents a single version in a documentβs version history with metadata for version tracking, comparison, and rollback operations.
Fields: version_number: Version identifier (incremental integer) created_at: Timestamp when this version was created word_count: Word count at this version content_hash: SHA256 hash for content integrity verification version_id: Optional unique version identifier created_by: Optional author/creator of this version content_preview: Optional preview snippet of version content change_description: Optional description of changes in this version
Used By: - VersionHistory for version listing - Version comparison operations - Version rollback functionality - Document history timeline
object
Version creation timestamp
Word count at this version
Validation Error