POST /api/upload/image
Uploads an image to the appropriate Supabase Storage bucket.Requires authentication.
Request Body (multipart/form-data)
| Field | Type | Required | Description |
|---|---|---|---|
file | File | Yes | Image file (max 5MB) |
type | string | Yes | avatar, cover, recipe, or post |
Accepted Formats
image/jpegimage/pngimage/webp
Response (201)
Storage Buckets
| Type | Bucket | Folder Structure |
|---|---|---|
avatar | avatars | {user_id}/avatar.jpg |
cover | cover-photos | {user_id}/cover.jpg |
recipe | recipe-images | {user_id}/{image_id}.jpg |
post | post-images | {user_id}/{image_id}.jpg |
Errors
| Status | Code | Reason |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid file type or too large |
| 401 | UNAUTHORIZED | Not authenticated |