Overview
The File Management API allows you to handle file uploads to S3 with automatic user isolation, deduplication, and integrity verification. All files are scoped to individual users, ensuring data privacy and security.Key Features
- Direct S3 Uploads: Generate presigned URLs for client-side uploads
 - Automatic Deduplication: MD5-based file detection
 - User Isolation: Files are automatically scoped to authenticated users
 - Integrity Verification: MD5 hash validation
 - Flexible MD5 Format: Accepts both hex and base64 formats
 
Complete Upload Flow
Here’s a complete example of uploading a file:1
Calculate MD5 Hash
Calculate the MD5 hash of your file. You can use code or an online MD5 generator:
- Node.js
 - Online Tool
 
2
Request Presigned URL
Call the presigned URL endpoint with file metadata:
3
Upload to S3
Use the presigned URL to upload directly to S3:
4
Use the File
The file is now stored in S3 and can be referenced by its 
s3Key in your application.You can verify your uploaded files using the List Files endpoint.Using s3Key with Connector Actions
You can use thes3Key as file content in connector actions. For example, uploading to Google Drive:Security
All files are automatically scoped to the authenticated user. Users cannot access or delete files belonging to other users.
User Isolation
- List endpoint only returns files for the authenticated user
 - Delete endpoint validates file ownership before deletion
 
File Validation
- MD5 verification ensures file integrity
 - S3 validates Content-MD5 header during upload
 - Invalid MD5 results in upload rejection
 
Best Practices
Use MD5 for Deduplication
Always provide MD5 hashes to avoid uploading duplicate files and verify integrity
Handle Presigned URL Expiry
Presigned URLs expire after 1 hour. Generate a new one if needed
Store S3 Keys
Save the returned 
s3Key in your database for future referenceCheck File Existence
Use the 
type field to detect if a file already exists before uploadingLimits
| Feature | Limit | 
|---|---|
| Presigned URL Expiry | 1 hour | 
| Maximum File Size | 5 GB (standard PUT) | 
| S3 Bucket | alloy-user-files | 
| File Name Pattern | {userId}_{sanitized_filename}.{extension} | 
FAQs
What MD5 format should I use?
What MD5 format should I use?
You can provide MD5 in either hex (32 characters) or base64 (24 characters) format. The system automatically converts hex to base64 if needed.Example:
- Hex: 
2942bfabb3d05332b66eb128e0842cff - Base64: 
KUK/q7PQUzK2brEo4IQs/w== 
What happens if I upload the same file twice?
What happens if I upload the same file twice?
The system detects duplicate files using MD5 hashes and returns 
type: "existing". This helps you avoid re-uploading identical files.Can I upload files larger than 5GB?
Can I upload files larger than 5GB?
For files larger than 5GB, you’ll need to use multipart uploads. Contact support for implementation details.
How do I calculate MD5 in the browser?
How do I calculate MD5 in the browser?
Use the browser’s native crypto API or libraries like 
spark-md5:Are files automatically deleted?
Are files automatically deleted?
No, files persist until explicitly deleted via the delete endpoint. Implement your own cleanup logic as needed.

