Update/Version document
POST/company/documents/:id
Description
Creates a new version of an existing document in S3 while maintaining full version history.
Access Requirements
- Authentication: Valid JWT token
- Minimum Role: Administrator (isAdmin)
Versioning Behavior
- Version Number: Automatically incremented
- Previous Files: Retained in S3
- New Files: Uploaded with new version
- Status: Reset to
pendingfor review
Restrictions
- Maximum of 6 new files per version (10MB each)
- Same supported formats as creation
- Original document must exist
Usage Example
curl -X POST \
-H Authorization: Bearer \{token\} \
-F name=Service Agreement v2 \
-F files=@updated_contract.pdf \
https://api.example.com/v1/documents/5f8d3b7a9c2d1e0f4a6b5c4d
Technical Flow
- Permission and UTC validation
- Existing document verification
- Upload of new files to S3
- Creation of new version in database
- Reference updates
Request
Responses
- 200
- 412
Document successfully updated
Document versioning error