Files API
Endpoints
POST /api/filesGET /api/files/{id}DELETE /api/files/{id}
All files endpoints require authentication.
Upload
bash
curl -s -X POST http://127.0.0.1:3000/api/files \
-H 'Authorization: Bearer <token>' \
-F file=@./avatar.pngUpload behavior:
- Expects multipart form with one file field.
- Max size: 10 MB.
- Stores metadata:
id,owner_id,mime_type,size,checksum.
Download
bash
curl -s http://127.0.0.1:3000/api/files/1 \
-H 'Authorization: Bearer <token>' \
--output out.binReturns raw bytes with Content-Type from stored mime_type.
Delete
bash
curl -s -X DELETE http://127.0.0.1:3000/api/files/1 \
-H 'Authorization: Bearer <token>'Access policy:
ownerandadmincan access any file.- Other users can access only files they own.
Storage path traversal is blocked by runtime checks.