Skip to main content

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 pending for 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

  1. Permission and UTC validation
  2. Existing document verification
  3. Upload of new files to S3
  4. Creation of new version in database
  5. Reference updates

Request

Responses

Document successfully updated