This endpoint permanently removes a product image in two steps: it first deletes the physical file from the server’s disk, then removes the corresponding record from theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/MateoNavarroMN/Balsamoa-Backend/llms.txt
Use this file to discover all available pages before exploring further.
producto_imagenes table. Use this when you want to discard a standalone image that is no longer needed without modifying the product itself.
Request
| Property | Value |
|---|---|
| Method | DELETE |
| Path | /api/v1/admin/imagenes/:id |
Path Parameters
The numeric ID of the image record in the
producto_imagenes table. This ID is returned when images are listed via the admin product endpoints.Behavior
- The server validates that
idis a valid integer. - It looks up the image record in
producto_imagenesby ID to retrieve the storedurl. - If the
urlstarts with/recursos/, the corresponding file is deleted from the local disk usingfs.unlinkSync. - The database record is then deleted with
DELETE FROM producto_imagenes WHERE id = $1. - A success message is returned once both operations complete.
Example
Response
200 OKConfirmation that the file was removed from disk and the record was deleted from the database.
Error Cases
| Status | Cause | Response body |
|---|---|---|
400 | id path parameter is not a valid number | {"mensaje": "El ID de imagen debe ser un número válido"} |
404 | No image record found for the given ID | {"mensaje": "Imagen no encontrada"} |
500 | Database error while deleting the record | {"mensaje": "Error al eliminar la imagen de la base de datos"} |
This endpoint deletes the image independently of any product update. Alternatively, when you call
PUT /api/v1/admin/productos/:id and supply a new imagenes array, the API automatically computes which old images are no longer referenced and removes their files from disk before persisting the new list. This means you generally only need this standalone endpoint when discarding an image that was uploaded but never attached to a product.