Skip to main content

Create new document

POST 

/company/documents

Description

Endpoint for creating new corporate documents with their associated files in Amazon S3.

Access Requirements

  • Authentication: Valid JWT Token
  • Minimum Role: Company Manager (isGestor)

File Configuration

  • Maximum: 6 files per document
  • Maximum size: 10MB per file
  • Supported formats:
    • Documents: PDF, DOCX, XLSX
    • Images: JPG, PNG
  • Storage: Files are saved in S3 with the structure: documents/{companyId}/{timestamp_filename.ext}

Validations

  • All timestamps must be in UTC
  • The document type must exist (/documents/types)
  • The name must be between 3-100 characters

Technical Flow

  1. Metadata and UTC validation
  2. Parallel file upload to S3
  3. Database record creation
  4. Automatic association with the company
  5. Initial status: pending

Usage Example

curl -X POST \
-H Authorization: Bearer {token} \
-F name=Service Contract \
-F documentType=5f8d3b7a9c2d1e0f4a6b5c4f \
-F files=@contract.pdf \
-F files=@addendum.pdf \
https://api.example.com/v1/documents

Request

Responses

Document successfully created