File Upload
Secure file storage for handling large images and documents. Files are automatically organized based on their purpose (like user profiles or WhatsApp media) and seamlessly processed in the background.
When to use this module
- Upload images or documents for contacts or WhatsApp messages
- Attach WhatsApp message media → upload, then use
fileIdin the message payload - Upload a CSV import file →
Mode=Import, passfileIdto the import endpoint
Endpoints
| Method | Route | Auth | Description |
|---|---|---|---|
| POST | /api/v1/Files | Single-shot direct file upload | |
| POST | /api/v1/Files/chunk | Upload large files securely in chunks |
Direct Upload — Form Fields
For standard files (like profile pictures or standard attachments), you can upload the entire file in a single request using the /api/v1/Files endpoint.
| Field | Type | Required | Description |
|---|---|---|---|
File | IFormFile | required | The file binary to upload |
Mode | enum | required | Firm / Profile / Contact / Message / Template / Import |
ObjId | Guid? | optional | Optional owning entity ID (e.g. linking to a specific record) |
IsPublic | boolean | optional | True to store in public container and return a resolvable FullPath (default is False) |
Chunk Upload — Form Fields
You can safely upload both small profile pictures and massive documents. For very large files, our system automatically breaks them down into smaller pieces to ensure a reliable upload.
| Field | Type | Required | Description |
|---|---|---|---|
File | IFormFile | required | The binary file chunk to upload |
BlockIndex | int | required | Zero-based chunk index (0 for first chunk) |
TotalBlocks | int | required | Total number of chunks for this file |
Mode | enum | required | Firm / Profile / Contact / Message / Template / Import |
FileId | Guid? | optional | Required for chunks after the first (BlockIndex > 0) to correlate parts |
Single-Chunk Upload Flow
For small files (like profile pictures or logos), you can upload the entire file in a single, fast request.
Multi-Chunk Upload Flow
For large files, the upload happens in smaller parts to prevent failures. Once all parts are received, we automatically combine them back together for you.
FileId from the first response and pass it in all subsequent chunk requests. The server uses it to group blocks before committing.Upload Response
{
"isSuccess": true,
"data": {
"fileId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"url": "fileurl",
"isComplete": true
},
"message": "File uploaded successfully"
}