Appearance
Direct Upload Presigned URL
Summary
POST /documents/upload prepares a direct-upload form post for one file. The command validates the selected route type and file metadata, generates the presigned upload first, and only registers the document after the presign succeeds.
Business Rules
- The route type must resolve to a known storage config or the command returns
STORAGE.INVALID_FILE_ROUTE_TYPE. - The requested file size must be less than or equal to the route max file size.
- The presign request uses the client-provided file size as the upload size cap.
- The document is registered only after the presigned form is generated successfully.
- Storage stats are incremented with the document's requested file size through
RegisterDocumentCommand.
Failure Modes
- Invalid route types, content types, and oversize files fail before any presign call.
- If presign generation fails, the command returns the signer error and skips document registration entirely.
Change Log
- 2026-03-27: Updated single-file direct upload to presign against the requested file size instead of the route max size.