File
Upload files (base64) and attach/detach them to records
INFO
Har bir javob umumiy konvertda qaytadi — code, message, messages, status_code, time — foydali yuk esa data ichida. Quyidagi jadvallar faqat data ichini tavsiflaydi.
POST /file/upload
Upload a file as base64. Stores it in object storage and returns the storage key (a string in data). Use that key as the file field (e.g. path, image) when creating/updating a record, or pass it to /file/attach. base64-only — no remote URL fetching (no SSRF).
So‘rov tanasi
| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
filename | string | Ha | Original file name including extension. The extension is used to derive the storage key and (if mimetype is omitted) the content type. |
content_base64 | string | Ha | File bytes encoded as base64 (no data: URI prefix). Max ~20MB after decoding. base64-only by design — the API never fetches a remote URL, so there is no SSRF surface. |
mimetype | string | Yo‘q | Optional MIME type. If omitted it is inferred from the filename extension, falling back to application/octet-stream. |
{
"filename": "receipt.pdf",
"content_base64": "JVBERi0xLjQKJeLjz9MK...",
"mimetype": "application/pdf"
}Javob
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": "/uploads/665f.../integration/file-abc123.pdf",
"time": "2025-05-01T12:00:00Z"
}POST /file/attach
Attach an already-uploaded file (its storage key) to an existing record. Body: path (the key) plus exactly one entity FK id (e.g. transaction_id, invoice_id). The referenced record must exist and the file must already be uploaded.
So‘rov tanasi
| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
path | string | Ha | Storage key returned by /file/upload. |
type | string | Yo‘q | Optional. Inferred from the file extension when omitted.. Mumkin qiymatlar: image, video, audio, file |
name | string | Yo‘q | Optional display name. |
note | string | Yo‘q | Optional note. |
transaction_id | string | Yo‘q | Attach to a finance transaction. |
invoice_id | string | Yo‘q | Attach to an invoice. |
category_id | string | Yo‘q | Attach to a product category. |
task_id | string | Yo‘q | Attach to a task. |
purchase_id | string | Yo‘q | Attach to a purchase. |
supplier_id | string | Yo‘q | Attach to a supplier. |
{
"path": "/uploads/665f.../integration/file-abc123.pdf",
"type": "image",
"name": "string",
"note": "string",
"transaction_id": "string",
"invoice_id": "string",
"category_id": "string",
"task_id": "string",
"purchase_id": "string",
"supplier_id": "string"
}Javob
| Maydon | Tur | Tavsif |
|---|---|---|
_id | string | |
path | string | |
type | string | |
size | number |
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": {
"_id": "string",
"path": "string",
"type": "string",
"size": 0
},
"time": "2025-05-01T12:00:00Z"
}DELETE /file/attach/{id}
Soft-delete an attachment by its ObjectId (detach a file from a record). Returns the deleted attachment id.
Yo‘l parametrlari
| Parametr | Tur | Majburiy | Tavsif |
|---|---|---|---|
id | string | Ha | Attachment ObjectId to detach |
So‘rov tanasi
So‘rov tanasi talab qilinmaydi.
Javob
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": "string",
"time": "2025-05-01T12:00:00Z"
}Bu sahifa OpenAPI spetsifikatsiyasidan yaratilgan.