stock is decremented automatically. All list and detail endpoints return only active (non-deleted) records.
Soft delete is used throughout. Deleting a product sets
borrado_en to the current timestamp. The record is never physically removed from the database, and it will no longer appear in any list or detail response.POST /api/productos
Create a new product.
Authentication: Bearer JWT requiredRequired role:
admin
Request body
Product name. Max 60 characters.
Price in bolivianos. Must be
>= 0. Stored as a two-decimal numeric.Initial stock quantity. Must be an integer
>= 0.Unit of measure (e.g.
kg, unidad, litro). Max 20 characters.Response
Returns the created product object (201 Created).
Unique identifier generated with nanoid (10 characters).
Product name.
Price as a decimal string (e.g.
"45.50").Current stock quantity.
Unit of measure.
Creation timestamp.
Last update timestamp.
Soft-delete timestamp.
null for active products.Example
GET /api/productos
Return all active products.
Authentication: Bearer JWT requiredRequired role: any authenticated user
Request parameters
No parameters.Response
Returns an array of product objects (200 OK). Only records where borrado_en IS NULL are included.
Example
GET /api/productos/:id
Return a single active product by ID.
Authentication: Bearer JWT requiredRequired role: any authenticated user
Request parameters
The nanoid of the product.
Response
Returns the product object (200 OK), or 404 Not Found if the product does not exist or has been soft-deleted.
Example
PATCH /api/productos/:id
Partially update a product. All body fields are optional; only the fields you send are updated.
Authentication: Bearer JWT requiredRequired role:
admin
Request parameters
The nanoid of the product to update.
New product name. Max 60 characters.
New price in bolivianos. Must be
>= 0.New stock quantity. Must be an integer
>= 0.New unit of measure. Max 20 characters.
Response
Returns the updated product object (200 OK). actualizado_en is always refreshed.
Example
DELETE /api/productos/:id
Soft-delete a product.
Authentication: Bearer JWT requiredRequired role:
admin
This operation sets
borrado_en and actualizado_en to the current timestamp. The product record is retained in the database and will no longer appear in list or detail responses.Request parameters
The nanoid of the product to delete.
Response
Returns a confirmation message (200 OK).
Confirmation string, e.g.
"Producto con ID aB3dE7fGhJ eliminado exitosamente (soft delete)".