Skip to main content
All endpoints in this group return responses wrapped in ApiResponse<T>. See the API Overview for the full envelope schema.

GET /api/inventario

Returns all inventory records.

Example request

curl -X GET http://localhost:8080/api/inventario

Example response

{
  "total": 1,
  "fecha": "2026-04-07T14:00:00.000000",
  "data": [
    {
      "idInventario": 1,
      "codigoBarras": "7501055300418",
      "descripcion": "Leche entera 1L",
      "cantidad": 48,
      "fechaCaducidad": "2026-04-14",
      "lote": "L-001",
      "fechaLlegada": "2026-04-07",
      "division": "PERECEDEROS",
      "departamento": "LACTEOS"
    }
  ]
}

GET /api/inventario/caducados

Returns inventory records whose fechaCaducidad is before the given limite date (i.e. already expired as of that date).

Query parameters

limite
string
required
Cut-off date in yyyy-MM-dd format. Records with fechaCaducidad before this date are returned.

Example request

curl -X GET "http://localhost:8080/api/inventario/caducados?limite=2026-04-07"

Example response

{
  "total": 1,
  "fecha": "2026-04-07T14:00:00.000000",
  "data": [
    {
      "idInventario": 3,
      "codigoBarras": "7501234567890",
      "descripcion": "Yogur fresa 200g",
      "cantidad": 12,
      "fechaCaducidad": "2026-04-01",
      "lote": "L-020",
      "fechaLlegada": "2026-03-25",
      "division": "PERECEDEROS",
      "departamento": "LACTEOS"
    }
  ]
}

GET /api/inventario/por-caducar

Returns inventory records whose fechaCaducidad is before the given limite date. Use this endpoint to find products that will expire soon by passing a future date as limite.
This endpoint delegates to the same service method as /caducados. Pass a future date (e.g. today + 7 days) to find items expiring within that window.

Query parameters

limite
string
required
Upper-bound date in yyyy-MM-dd format. Records with fechaCaducidad before this date are returned.

Example request

curl -X GET "http://localhost:8080/api/inventario/por-caducar?limite=2026-04-14"

Example response

{
  "total": 2,
  "fecha": "2026-04-07T14:00:00.000000",
  "data": [
    {
      "idInventario": 5,
      "codigoBarras": "7509999000001",
      "descripcion": "Queso fresco 500g",
      "cantidad": 24,
      "fechaCaducidad": "2026-04-10",
      "lote": "L-045",
      "fechaLlegada": "2026-04-05",
      "division": "PERECEDEROS",
      "departamento": "LACTEOS"
    }
  ]
}

GET /api/inventario/alertas

Generates automatic expiry alerts for all inventory items. Each alert includes days remaining and a severity label.

Response fields

data
AlertaInventario[]
Array of alert objects.

Example request

curl -X GET http://localhost:8080/api/inventario/alertas

Example response

{
  "total": 2,
  "fecha": "2026-04-07T14:00:00.000000",
  "data": [
    {
      "codigoBarras": "7501234567890",
      "descripcion": "Yogur fresa 200g",
      "cantidad": 12,
      "fechaCaducidad": "2026-04-01",
      "diasRestantes": -6,
      "alerta": "❌ Producto vencido, retirar inmediatamente"
    },
    {
      "codigoBarras": "7509999000001",
      "descripcion": "Queso fresco 500g",
      "cantidad": 24,
      "fechaCaducidad": "2026-04-10",
      "diasRestantes": 3,
      "alerta": "⚠️ Retirar mercancía, próxima a vencer"
    }
  ]
}

GET /api/inventario/buscar

Returns inventory records matching a specific barcode.

Query parameters

codigoBarras
string
required
Exact barcode string to search for.

Example request

curl -X GET "http://localhost:8080/api/inventario/buscar?codigoBarras=7501055300418"

Example response

{
  "total": 1,
  "fecha": "2026-04-07T14:00:00.000000",
  "data": [
    {
      "idInventario": 1,
      "codigoBarras": "7501055300418",
      "descripcion": "Leche entera 1L",
      "cantidad": 48,
      "fechaCaducidad": "2026-04-14",
      "lote": "L-001",
      "fechaLlegada": "2026-04-07",
      "division": "PERECEDEROS",
      "departamento": "LACTEOS"
    }
  ]
}

GET /api/inventario/division

Returns all inventory records belonging to a specific division.

Query parameters

division
string
required
Division name. Must be one of: PERECEDEROS, NO_PERECEDEROS.

Example request

curl -X GET "http://localhost:8080/api/inventario/division?division=PERECEDEROS"

Example response

{
  "total": 3,
  "fecha": "2026-04-07T14:00:00.000000",
  "data": [
    {
      "idInventario": 1,
      "codigoBarras": "7501055300418",
      "descripcion": "Leche entera 1L",
      "cantidad": 48,
      "fechaCaducidad": "2026-04-14",
      "lote": "L-001",
      "fechaLlegada": "2026-04-07",
      "division": "PERECEDEROS",
      "departamento": "LACTEOS"
    }
  ]
}

GET /api/inventario/departamento

Returns all inventory records belonging to a specific department.

Query parameters

departamento
string
required
Department name. Must be one of: FRUTAS, VERDURAS, LACTEOS, CARNES, EMBUTIDOS, MULTIPLE, FARMACIA.

Example request

curl -X GET "http://localhost:8080/api/inventario/departamento?departamento=LACTEOS"

Example response

{
  "total": 2,
  "fecha": "2026-04-07T14:00:00.000000",
  "data": [
    {
      "idInventario": 1,
      "codigoBarras": "7501055300418",
      "descripcion": "Leche entera 1L",
      "cantidad": 48,
      "fechaCaducidad": "2026-04-14",
      "lote": "L-001",
      "fechaLlegada": "2026-04-07",
      "division": "PERECEDEROS",
      "departamento": "LACTEOS"
    }
  ]
}

Inventario object schema

idInventario
number
Auto-generated primary key.
codigoBarras
string
Product barcode.
descripcion
string
Human-readable product description.
cantidad
number
Current stock quantity.
fechaCaducidad
string
Expiry date in yyyy-MM-dd format.
lote
string
Lot or batch identifier.
fechaLlegada
string
Date the item was received, in yyyy-MM-dd format. Assigned automatically on creation.
division
string
Division enum: PERECEDEROS or NO_PERECEDEROS.
departamento
string
Department enum: FRUTAS, VERDURAS, LACTEOS, CARNES, EMBUTIDOS, MULTIPLE, or FARMACIA.