The product endpoints cover the full product management lifecycle. The search and catalog endpoints power the register screen and the Productos management page; the create and update endpoints allow staff to maintain the pharmacy’s inventory.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/15aozzz/Lab-Nova-Salud/llms.txt
Use this file to discover all available pages before exploring further.
All routes require a valid JWT in the
Authorization: Bearer <token> header.GET /api/productos
Returns the full product catalog. Each product includes all configured pricing tiers. Callssp_get_todos_productos and groups the flat result rows by id_producto.
Query parameters
No parameters required.Response
200 OK — returns an array of products, each with aprecios array. The response shape is identical to GET /api/productos/buscar — see below for the full field reference.
Example
GET /api/productos/buscar
Searches active products by commercial name or active ingredient. Callssp_buscar_productos and groups the flat result rows by id_producto, attaching each pricing tier to a precios array on the parent product.
Query parameters
Search term matched against product name and active ingredient. Must be at least 2 characters.
Response
200 OK — returns an array of matching products, each with aprecios array.
Internal product ID.
Commercial product name (e.g.,
"Paracetamol 500mg").Active ingredient (e.g.,
"Paracetamol").Current stock expressed in base units.
Pharmaceutical form (e.g.,
"TABLETA", "JARABE").Manufacturer or laboratory name.
Available price tiers for this product.
Errors
| Status | Condition | Body |
|---|---|---|
400 | q missing or shorter than 2 characters | { "error": "El parámetro \"q\" debe tener al menos 2 caracteres" } |
500 | Database or server error | { "error": "<message>" } |
Example
Response
GET /api/productos/:id/precios
Returns all available price tiers for a specific product. Callssp_get_precios_producto. Useful when you already know the product ID and only need to refresh its pricing.
Path parameters
Internal product ID.
Response
200 OK — returns a flat array of price tier records for the given product.Price tier ID.
Unit label (e.g.,
"UNIDAD", "BLISTER x10").Number of base units this tier represents.
Selling price for this tier.
Errors
| Status | Condition | Body |
|---|---|---|
500 | Database or server error | { "error": "<message>" } |
If the product ID does not exist, the SP returns an empty array (
[]) with status 200 rather than a 404. Check the array length before use.Example
Response
POST /api/productos
Creates a new product and its pricing tiers in a single transaction. Callssp_crear_producto to create the product, then sp_agregar_precio_producto for each pricing tier.
Request body
Commercial brand name of the medicine (e.g.,
"Paracetamol 500mg").Manufacturer or laboratory ID. Must reference an existing laboratory in the database.
Therapeutic category ID. Must reference an existing category.
At least one pricing tier. Cannot be empty.
Active ingredient (e.g.,
"Paracetamol"). Optional.Pharmaceutical form ID (e.g., tablet, syrup). Optional.
Starting stock in base units.
Minimum stock threshold. Products below this level appear in dashboard alerts.
Response
201 CreatedInternal ID of the newly created product.
Confirmation message (
"Producto creado exitosamente").Errors
| Status | Condition | Body |
|---|---|---|
400 | nombre_comercial, laboratorio, categoria, or precios missing | { "error": "Faltan campos obligatorios" } |
500 | Database error or transaction rollback | { "error": "<message>" } |
Example
Response
PUT /api/productos/:id
Updates a product and replaces its pricing tiers atomically. Callssp_actualizar_producto_completo with a JSON-serialized pricing array.
Path parameters
Internal product ID.
Request body
Updated commercial name.
Updated category ID.
Updated active ingredient. Optional.
Updated laboratory ID. Optional.
Updated presentation/form ID. Optional.
Updated current stock in base units. Optional.
Updated minimum stock threshold. Optional.
Replacement pricing tiers. Replaces all existing tiers for this product. Optional — pass an empty array to remove all tiers.
Response
200 OKConfirmation or SP message (e.g.,
"Producto actualizado exitosamente").Errors
| Status | Condition | Body |
|---|---|---|
400 | nombre_comercial or categoria missing | { "error": "Faltan campos obligatorios" } |
500 | Database error | { "error": "<message>" } |
Example
Response