Docs menuFeatures

DOCS / FEATURES

File uploads

Each organization gets a shared file area. The browser sends bytes straight to S3-compatible or local-disk storage through short-lived presigned URLs, and the API only signs requests and keeps the index. With S3, file bytes never pass through the API at all. Code: api/src/uploads/ (feature), api/src/storage/ (backends), web/src/features/files/.

The three-step flow

  1. Start: POST /api/orgs/{org_id}/uploads with {filename, content_type, size_bytes}. The API validates the declaration, records a pending row, and answers with upload_request: {method: "PUT", url, headers} valid for 15 minutes.
  2. Send: the browser PUTs the file to that URL itself.
  3. Complete: POST /api/orgs/{org_id}/uploads/{id}/complete. The API checks the object exists and is within the limit, records the size that arrived (not the declared one), marks the row ready, and writes a file.uploaded audit event.

Downloads work the same way: GET .../uploads/{id}/download returns a five-minute link that always downloads as an attachment.

Access is permission-based (api/src/domain/permission.rs). All of these endpoints need use_files, which each built-in role holds. Finishing or deleting someone else's file also needs manage_all_files, which owners and admins hold. A custom role holds only the ones it grants.

Endpoint Who
GET /api/orgs/{org_id}/uploads use_files (ready files, newest first, up to 200)
POST /api/orgs/{org_id}/uploads use_files
POST /api/orgs/{org_id}/uploads/{id}/complete the uploader, or manage_all_files
GET /api/orgs/{org_id}/uploads/{id}/download use_files
DELETE /api/orgs/{org_id}/uploads/{id} the uploader, or manage_all_files (file.deleted audit event for a ready file)

[ full guide ]

The rest of this guide comes with the repo.

  • Storage backends
  • Safety rules
  • Cleanup
Get LaunchCrate