Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/MultiSas/llms.txt

Use this file to discover all available pages before exploring further.

Pharmacy products represent every item in your dispensary’s inventory — medications, hygiene supplies, medical materials, and more. Each product record tracks its category, cost, sale price, unit of measure, stock levels, minimum stock threshold, and one or more batch (lote) entries that carry per-batch expiry dates and quantities. Eight endpoints cover the full inventory lifecycle: create, update core fields, update a batch, list all products, list low-stock products, list expired batches, delete a batch, and delete a product.
All pharmacy product endpoints require two authentication middlewares. TokenAny validates the bearer token and attaches the user to the request. TokenAuthorize('Admin', 'Super Admin') restricts access to users whose role is either Admin or Super Admin. Include the token in every request as token-access: Bearer $TOKEN.

Create a Product


POST /api/product-pharmacy/:company_id Creates a new pharmacy product. All fields are required. The batch_product array must contain at least one valid batch entry.

Path Parameters

company_id
string
required
The MongoDB ObjectId of the owning company.

Body Parameters

name_product
string
required
Name of the product (e.g. "Ibuprofeno 400mg").
category_product
string
required
Product category. Must be one of: "analgesicos", "antibioticos", "gastrointestinal", "antialergicos", "diabetes", "cardiovascular", "vitaminas", "higiene", "material medico", "respiratorio".
cost_product
string
required
Purchase cost of the product (stored as a string).
price_product
string
required
Sale price of the product (stored as a string).
unit_product
string
required
Unit of sale. Must be one of: "unidad", "kg", "gramo", "litro", "metro", "caja", "paquete", "rollo", "".
stock_product
number
required
Maximum expected stock quantity.
minimum_stock_product
number
required
Minimum stock threshold; products at or below this value appear in the low-stock list.
batch_product
array
required
Array of batch objects. Must contain at least one entry. Each entry must include:
  • lote (string) — batch identifier
  • expiration_date (string, ISO 8601 date) — expiry date for this batch
  • quantity (number) — quantity in this batch

Response Fields

msj
string
Human-readable result message.
status
boolean
true on success, false on failure.
save_product_pharmacy
object
The newly created product document.

Example

curl -X POST https://api.example.com/api/product-pharmacy/64a1f2c3e4b0a1b2c3d4e5f6 \
  -H "Content-Type: application/json" \
  -H "token-access: Bearer $TOKEN" \
  -d '{
    "name_product": "Ibuprofeno 400mg",
    "category_product": "analgesicos",
    "cost_product": "3500",
    "price_product": "5000",
    "unit_product": "caja",
    "stock_product": 200,
    "minimum_stock_product": 20,
    "batch_product": [
      {
        "lote": "LOT-2024-001",
        "expiration_date": "2026-06-30",
        "quantity": 100
      }
    ]
  }'
{
  "msj": "Producto creado exitosamente",
  "status": true,
  "save_product_pharmacy": {
    "_id": "64h8i9j0k1l2m3n4o5p6q7r8",
    "bill_counter": "FAR-0001",
    "name_product": "Ibuprofeno 400mg",
    "category_product": "analgesicos",
    "cost_product": "3500",
    "price_product": "5000",
    "unit_product": "caja",
    "stock_product": 200,
    "minimum_stock_product": 20,
    "batch_product": [
      {
        "_id": "64h8i9j0k1l2m3n4o5p6q7r9",
        "lote": "LOT-2024-001",
        "expiration_date": "2026-06-30T00:00:00.000Z",
        "quantity": 100
      }
    ],
    "company": "64a1f2c3e4b0a1b2c3d4e5f6",
    "createdAt": "2024-01-15T09:00:00.000Z",
    "updatedAt": "2024-01-15T09:00:00.000Z"
  }
}

Update a Product


PATCH /api/product-pharmacy/:company_id/updating/:product_id Updates the core fields of an existing pharmacy product. Does not update batch entries.

Path Parameters

company_id
string
required
The MongoDB ObjectId of the owning company.
product_id
string
required
The MongoDB ObjectId of the product to update.

Body Parameters

name_product
string
required
Updated product name.
category_product
string
required
Updated category. Must be a valid enum value (see Create above).
cost_product
string
required
Updated purchase cost.
price_product
string
required
Updated sale price.
unit_product
string
required
Updated unit of sale. Must be a valid enum value (see Create above).
stock_product
number
required
Updated maximum stock quantity.
minimum_stock_product
number
required
Updated minimum stock threshold.

Response Fields

msj
string
Human-readable result message.
status
boolean
true on success.

Example

curl -X PATCH https://api.example.com/api/product-pharmacy/64a1f2c3e4b0a1b2c3d4e5f6/updating/64h8i9j0k1l2m3n4o5p6q7r8 \
  -H "Content-Type: application/json" \
  -H "token-access: Bearer $TOKEN" \
  -d '{
    "name_product": "Ibuprofeno 400mg x 20",
    "category_product": "analgesicos",
    "cost_product": "3800",
    "price_product": "5500",
    "unit_product": "caja",
    "stock_product": 200,
    "minimum_stock_product": 25
  }'
{
  "msj": "Producto actualizado exitosamente",
  "status": true
}

Update a Product Batch


PUT /api/product-pharmacy/:company_id/company/:product_id/product/:batch_id Updates a single batch entry inside a product’s batch_product array.

Path Parameters

company_id
string
required
The MongoDB ObjectId of the owning company.
product_id
string
required
The MongoDB ObjectId of the product that owns the batch.
batch_id
string
required
The MongoDB ObjectId of the batch subdocument to update.

Body Parameters

lote
string
required
Updated batch identifier.
expiration_date
string
required
Updated expiry date. Accepted formats: YYYY-MM-DD (e.g. "2026-12-31").
quantity
number
required
Updated quantity in this batch.

Response Fields

msj
string
Human-readable result message.
status
boolean
true on success.

Example

curl -X PUT https://api.example.com/api/product-pharmacy/64a1f2c3e4b0a1b2c3d4e5f6/company/64h8i9j0k1l2m3n4o5p6q7r8/product/64h8i9j0k1l2m3n4o5p6q7r9 \
  -H "Content-Type: application/json" \
  -H "token-access: Bearer $TOKEN" \
  -d '{
    "lote": "LOT-2024-001-REV",
    "expiration_date": "2026-12-31",
    "quantity": 80
  }'
{
  "msj": "Lote actualizado correctamente",
  "status": true
}

List Products with Low Stock


GET /api/product-pharmacy/stock/:company_id/:pag?/:perpage? Returns a paginated list of products whose stock_product is less than or equal to minimum_stock_product.

Path Parameters

company_id
string
required
The MongoDB ObjectId of the company.
pag
number
Optional page number.
perpage
number
Optional results per page.

Response Fields

msj
string
Human-readable result message.
status
boolean
true on success.
data
array
Products at or below their minimum stock level.
pagination
object
Pagination metadata with pag, perpage, and pags.

Example

curl -X GET https://api.example.com/api/product-pharmacy/stock/64a1f2c3e4b0a1b2c3d4e5f6/1/10 \
  -H "Content-Type: application/json" \
  -H "token-access: Bearer $TOKEN"
{
  "msj": "Cargando productos con stock bajo",
  "status": true,
  "data": [],
  "pagination": {
    "pag": "1",
    "perpage": 10,
    "pags": 0
  }
}

List Products with Expired Batches


GET /api/product-pharmacy/lotes/:company_id/:pag?/:perpage? Returns a paginated list of products that contain at least one batch whose expiration_date is in the past.

Path Parameters

company_id
string
required
The MongoDB ObjectId of the company.
pag
number
Optional page number.
perpage
number
Optional results per page.

Response Fields

msj
string
Human-readable result message.
status
boolean
true on success.
data
array
Products with at least one expired batch.
pagination
object
Pagination metadata with pag, perpage, and pags.

Example

curl -X GET https://api.example.com/api/product-pharmacy/lotes/64a1f2c3e4b0a1b2c3d4e5f6/1/10 \
  -H "Content-Type: application/json" \
  -H "token-access: Bearer $TOKEN"
{
  "msj": "Cargando productos vencidos",
  "status": true,
  "data": [],
  "pagination": {
    "pag": "1",
    "perpage": 10,
    "pags": 0
  }
}

List All Products


GET /api/product-pharmacy/:company_id/:pag?/:perpage? Returns a paginated list of all pharmacy products for the specified company, sorted by most recently created.

Path Parameters

company_id
string
required
The MongoDB ObjectId of the company.
pag
number
Optional page number.
perpage
number
Optional results per page.

Response Fields

msj
string
Human-readable result message.
status
boolean
true on success.
data
array
Array of all pharmacy product documents for the company.
pagination
object
Pagination metadata with pag, perpage, and pags.

Example

curl -X GET https://api.example.com/api/product-pharmacy/64a1f2c3e4b0a1b2c3d4e5f6/1/10 \
  -H "Content-Type: application/json" \
  -H "token-access: Bearer $TOKEN"
{
  "msj": "Cargando productos",
  "status": true,
  "data": [
    {
      "_id": "64h8i9j0k1l2m3n4o5p6q7r8",
      "bill_counter": "FAR-0001",
      "name_product": "Ibuprofeno 400mg",
      "category_product": "analgesicos",
      "cost_product": "3500",
      "price_product": "5000",
      "unit_product": "caja",
      "stock_product": 200,
      "minimum_stock_product": 20,
      "batch_product": [
        {
          "_id": "64h8i9j0k1l2m3n4o5p6q7r9",
          "lote": "LOT-2024-001",
          "expiration_date": "2026-06-30T00:00:00.000Z",
          "quantity": 100
        }
      ],
      "company": "64a1f2c3e4b0a1b2c3d4e5f6",
      "createdAt": "2024-01-15T09:00:00.000Z",
      "updatedAt": "2024-01-15T09:00:00.000Z"
    }
  ],
  "pagination": {
    "pag": "1",
    "perpage": 10,
    "pags": 1
  }
}

Delete a Product Batch


DELETE /api/product-pharmacy/remove/:company_id/-/:product_id/-/:batch_id Removes a single batch from a product’s batch_product array without deleting the product.

Path Parameters

company_id
string
required
The MongoDB ObjectId of the owning company.
product_id
string
required
The MongoDB ObjectId of the product.
batch_id
string
required
The MongoDB ObjectId of the batch subdocument to remove.

Response Fields

msj
string
Human-readable result message.
status
boolean
true on success.

Example

curl -X DELETE https://api.example.com/api/product-pharmacy/remove/64a1f2c3e4b0a1b2c3d4e5f6/-/64h8i9j0k1l2m3n4o5p6q7r8/-/64h8i9j0k1l2m3n4o5p6q7r9 \
  -H "Content-Type: application/json" \
  -H "token-access: Bearer $TOKEN"
{
  "msj": "Lote eliminado exitosamente de producto",
  "status": true
}

Delete a Product


DELETE /api/product-pharmacy/:company_id/-/:product_id Permanently removes a pharmacy product and all its batch data.

Path Parameters

company_id
string
required
The MongoDB ObjectId of the owning company.
product_id
string
required
The MongoDB ObjectId of the product to delete.

Response Fields

msj
string
Human-readable result message.
status
boolean
true on success.

Example

curl -X DELETE https://api.example.com/api/product-pharmacy/64a1f2c3e4b0a1b2c3d4e5f6/-/64h8i9j0k1l2m3n4o5p6q7r8 \
  -H "Content-Type: application/json" \
  -H "token-access: Bearer $TOKEN"
{
  "msj": "Producto eliminado correctamente",
  "status": true
}

Build docs developers (and LLMs) love