Upload API
Learn how to upload files using the FlowDrive API
Last updated: March 15, 2024
Upload API
File Upload
Upload one or multiple files to FlowDrive.
Endpoint
http
POST /v1/files/upload
Content-Type: multipart/form-data
X-API-Key: YOUR_API_KEYRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
file | File | Yes | The file(s) to upload |
folder | String | No | Target folder path |
metadata | Object | No | Custom metadata for the file |
Example Requests
Basic Upload:
bash
curl -X POST \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@/path/to/file.jpg" \
https://api.tryflowdrive.com/v1/files/uploadUpload to Folder:
bash
curl -X POST \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@/path/to/file.jpg" \
-F "folder=images/profile" \
https://api.tryflowdrive.com/v1/files/uploadUpload with Metadata:
javascript
const formData = new FormData();
formData.append('file', file);
formData.append('folder', 'images/profile');
formData.append('metadata', JSON.stringify({
userId: '123',
type: 'avatar'
}));
fetch('https://api.tryflowdrive.com/v1/files/upload', {
method: 'POST',
headers: {
'X-API-Key': apiKey
},
body: formData
})
.then(response => response.json())
.then(data => console.log(data));Success Response
json
{
"message": "File uploaded successfully",
"fileId": "file-123456",
"originalName": "profile.jpg",
"storagePath": "images/profile/file-123456_profile.jpg",
"fileUrl": "https://files.tryflowdrive.com/id/file-123456_profile.jpg",
"metadata": {
"userId": "123",
"type": "avatar"
}
}Error Responses
json
{
"error": "Storage limit exceeded",
"code": "STORAGE_LIMIT_EXCEEDED",
"limit": "10GB"
}json
{
"error": "Invalid file type",
"code": "INVALID_FILE_TYPE",
"allowedTypes": ["image/jpeg", "image/png", "..."]
}Supported File Types
FlowDrive supports a wide range of file types including:
Images
- JPEG (
image/jpeg) - PNG (
image/png) - WebP (
image/webp) - GIF (
image/gif) - AVIF (
image/avif) - SVG (
image/svg+xml)
Documents
- PDF (
application/pdf) - Plain Text (
text/plain) - CSV (
text/csv)
Archives
- ZIP (
application/zip) - GZIP (
application/gzip)
Media
- MP4 (
video/mp4) - MP3 (
audio/mpeg)
View full list of supported types
Best Practices
File Size
- Keep files under the plan limits
- Consider compression for large files
- Use chunked upload for large files (coming soon)
Folders
- Use descriptive folder names
- Organize files logically
- Don't create deeply nested structures
Error Handling
- Always handle upload errors
- Implement retry logic for failed uploads
- Check file type before uploading
Security
- The upload key is upload-only and safe to expose publicly — no need to hide it
- Browsers can upload with the key only from the domains on it, so add your site's domain first (Webflow sites get theirs automatically through the Flowdrive app)
- File size, type, and storage limits are enforced server-side on every upload