This endpoint issues a physicalDocumentation 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.
DELETE FROM productos WHERE id = $1 against the database. Because the producto_imagenes and variantes tables define ON DELETE CASCADE on their producto_id foreign keys, all associated image records and variant rows are automatically removed in the same operation. After the database confirms the deletion, the controller iterates over the product’s image URLs and removes each file from disk using fs.unlinkSync. This operation cannot be undone — there is no recycle bin or soft-delete recovery path.
Request
Method:DELETEPath:
/api/v1/admin/productos/:idRequest body: none
Path Parameter
The numeric ID of the product to permanently delete. Must be a positive integer.
Response
200 — Deleted
Returns a confirmation message and the raw product row that was deleted, as returned by PostgreSQL’sRETURNING *.
Human-readable confirmation that the product was permanently deleted.
Array containing the raw product row that was deleted, as returned by
RETURNING *. Useful for logging or displaying a confirmation summary to the admin user.Error Cases
| Status | Condition | Response body |
|---|---|---|
400 | id path parameter is not a valid number | {"mensaje": "El ID del producto debe ser un número válido"} |
404 | No product exists with the given id | {"mensaje": "Producto no encontrado"} |
409 | The product is referenced by one or more detalles_pedido rows (PostgreSQL error 23503) | {"mensaje": "No se puede eliminar definitivamente porque el producto ya tiene ventas registradas. Te recomendamos desactivarlo."} |
500 | Unexpected database or server error | {"mensaje": "Error al intentar eliminar"} |
For products that have sales history, use
PATCH /api/v1/admin/productos/:id/desactivar instead. Deactivating a product sets activo = false, hiding it from the public store and preventing new purchases, while preserving all order records and reporting data. See the Activate / Deactivate page for details.