Endpoint
Request
Send amultipart/form-data request. Do not set Content-Type manually — let the HTTP client set the boundary automatically.
The image file to upload. Must be a valid image type (any
image/* MIME type). Maximum size is 5 MB.The Supabase Storage bucket to upload into. Use
"recetas" for recipe images or "avatars" for user profile pictures.The storage path of a previously uploaded file to delete before uploading the new one. Pass the file name returned by a prior upload. Omit this field (or pass an empty string) if no replacement is needed.
File naming
The server generates the file name automatically using the pattern:receta-<user_id>-<timestamp>.<ext>— for therecetasbucketavatar-<user_id>-<timestamp>.<ext>— for theavatarsbucket
Response
The public URL of the uploaded file in Supabase Storage. Use this URL to reference the image in recipe or profile records.
Error responses
| Status | Error | Description |
|---|---|---|
401 | No autorizado para subir archivos | No active session or invalid session token. |
400 | Faltan parámetros (archivo o bucket) | The file or bucket field is missing from the form data. |
400 | El archivo debe ser una imagen válida. | The uploaded file’s MIME type does not start with image/. |
400 | La imagen es demasiado grande. El máximo es 5MB. | The file exceeds the 5 MB size limit. |
400 | Supabase error message | A storage upload error occurred. |
500 | Error interno del servidor | An unexpected server error occurred. |
If
oldFileName is provided and the deletion of the old file fails, the error is logged server-side but does not block the upload. The new file is still uploaded and its URL is returned.Example requests
Upload a recipe image
Replace an existing avatar
Example responses
200 OK
401 Unauthorized
400 File too large
400 Invalid file type