Skip to main content

POST /api/upload/image

This API route is for the Phase 2 web client. The mobile app uploads images directly to Supabase Storage via the useImageUpload hook — see Image Upload journey.
Uploads an image to the appropriate Supabase Storage bucket.
Requires authentication.

Request Body (multipart/form-data)

FieldTypeRequiredDescription
fileFileYesImage file (max 5MB)
typestringYesavatar, cover, recipe, or post

Accepted Formats

  • image/jpeg
  • image/png
  • image/webp

Response (201)

{
  "url": "https://storage.supabase.co/...",
  "path": "avatars/uuid/image.jpg"
}

Storage Buckets

TypeBucketFolder Structure
avataravatars{user_id}/avatar.jpg
covercover-photos{user_id}/cover.jpg
reciperecipe-images{user_id}/{image_id}.jpg
postpost-images{user_id}/{image_id}.jpg

Errors

StatusCodeReason
400VALIDATION_ERRORInvalid file type or too large
401UNAUTHORIZEDNot authenticated