http://localhost:8000/api/file
All routes below are prefixed with this base URL.
Description: Upload a single file to the server. The file is stored locally and metadata is saved in the database.
Authorization: Bearer <your_token>
Content-Type: multipart/form-data
file → Required (File)
Accepted types: images, pdf, etc. (based on backend config)
curl -X POST http://localhost:8000/api/file/upload \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "file=@file.jpg"
{
"message": "File uploaded successfully",
"data": {
"fileId": "uuid-generated-id",
"fileUrl": "/upload/file/filename.jpg",
"size": 204800,
"type": "image/jpeg"
}
}
400 Bad Request
{
"error": "No file uploaded"
}
401 Unauthorized
{
"error": "Invalid or missing token"
}
500 Internal Server Error
{
"error": "Internal Server Error"
}
fileUrl is a relative path from serverfileId (UUID)