diff --git a/docs/api.md b/docs/api.md index 7db6bbc7e..3a648c3e9 100644 --- a/docs/api.md +++ b/docs/api.md @@ -211,6 +211,21 @@ However, querying the tasks endpoint with the returned UUID e.g. `/api/tasks/?task_id={uuid}` will provide information on the state of the consumption including the ID of a created document if consumption succeeded. +## Document Versions + +Document versions are file-level versions linked to one root document. + +- Root document metadata (title, tags, correspondent, document type, storage path, custom fields, permissions) remains shared. +- Version-specific file data (file, mime type, checksums, archive info, extracted text content) belongs to the selected/latest version. + +Version-aware endpoints: + +- `GET /api/documents/{id}/`: returns root document data; `content` resolves to latest version content by default. Use `?version={version_id}` to resolve content for a specific version. +- `PATCH /api/documents/{id}/`: content updates target the selected version (`?version={version_id}`) or latest version by default; non-content metadata updates target the root document. +- `GET /api/documents/{id}/download/`, `GET /api/documents/{id}/preview/`, `GET /api/documents/{id}/thumb/`, `GET /api/documents/{id}/metadata/`: accept `?version={version_id}`. +- `POST /api/documents/{id}/update_version/`: uploads a new version using multipart form field `document` and optional `version_label`. +- `DELETE /api/documents/{root_id}/versions/{version_id}/`: deletes a non-root version. + ## Permissions All objects (documents, tags, etc.) allow setting object-level permissions diff --git a/docs/usage.md b/docs/usage.md index ca57e9018..5269f7556 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -89,6 +89,16 @@ You can view the document, edit its metadata, assign tags, correspondents, document types, and custom fields. You can also view the document history, download the document or share it via a share link. +### Document File Versions + +Think of versions as **file history** for a document. + +- Versions track the underlying file and extracted text content (OCR/text). +- Metadata such as tags, correspondent, document type, storage path and custom fields stay on the "root" document. +- By default, search and document content use the latest version. +- In document detail, selecting a version switches the preview, file metadata and content (and download etc buttons) to that version. +- Deleting a non-root version keeps metadata and falls back to the latest remaining version. + ### Management Lists Paperless-ngx includes management lists for tags, correspondents, document types