Upload a file under a typed purpose; receive a fileId and variant URLs.
Multipart endpoint. Supply `purpose` (`avatar | truck_photo | menu_item | marketplace | review_image | community_image | category_icon | chat_attachment | kyc_document`), the target `entityId` (omit for `avatar` — defaults to the caller), and `file`. The response carries `fileId` plus `urls` for the rendered variants; pass `fileId` to the feature endpoint that anchors the upload (e.g. `POST /me/avatar`, `POST /chats/:id/messages`). Per-purpose limits: avatar 2MB, truck_photo / marketplace / community_image 5MB, menu_item / review_image 3MB, category_icon 512KB, chat_attachment / kyc_document 10MB. Allowed types are jpg/png/webp for images; pdf is additionally allowed for chat attachments and KYC docs. Magic-byte checks reject renamed files.
Authorization
bearerAuth AdonisJS access-token guard (middleware.auth({ guards: ["api"] })). Send Authorization: Bearer <oat_…> (issued by /auth/register, /auth/login, /auth/social/{google,apple}, or /auth/guest).
In: header
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/v1/uploads"{ "data": { "fileId": "fil_01jq8z5a0b1c2d3e4f5g6h7j8k", "purpose": "truck_photo", "entityType": "food_truck", "entityId": "trk_01jq8z2hf5t8z4w9d8x4mzg2p3", "urls": { "original": "https://cdn.trackme.sa/t/crispy-cart-original.jpg", "thumb": "https://cdn.trackme.sa/t/crispy-cart-thumb.jpg", "medium": "https://cdn.trackme.sa/t/crispy-cart-medium.jpg", "large": "https://cdn.trackme.sa/t/crispy-cart-large.jpg" } }, "meta": { "requestId": "req_01jq8z1mxc0e0v6r3xj0a8h9k7" }}{ "error": { "code": "AUTH_REQUIRED", "message": "Authentication is required to access this resource." }, "meta": { "requestId": "req_01jq8z1mxc0e0v6r3xj0a8h9k7" }}{ "error": { "code": "FORBIDDEN", "message": "You are not allowed to perform this action." }, "meta": { "requestId": "req_01jq8z1mxc0e0v6r3xj0a8h9k7" }}{ "error": { "code": "CONFLICT", "message": "This action conflicts with an existing record.", "targetType": "order", "targetId": "ord_01jq8z3a0n0y9v0x1g4t2c7m6e" }, "meta": { "requestId": "req_01jq8z1mxc0e0v6r3xj0a8h9k7" }}{ "error": { "code": "VALIDATION_ERROR", "message": "One or more fields are invalid.", "fields": [ { "path": "email", "rule": "email", "message": "Must be a valid email address." } ] }, "meta": { "requestId": "req_01jq8z1mxc0e0v6r3xj0a8h9k7" }}{ "error": { "code": "VALIDATION_ERROR", "message": "One or more fields are invalid.", "fields": [ { "path": "email", "rule": "email", "message": "Must be a valid email address." } ] }, "meta": { "requestId": "req_01jq8z1mxc0e0v6r3xj0a8h9k7" }}