Restofy Docs
Control de inventario POST

Listar movimientos de inventario

POST /api/inventory/list-movements

Descripción

Devuelve el historial paginado de movimientos de insumos.

Detalles

Retorna el historial cronológico de movimientos de inventario (entradas, salidas, ajustes y consumos) con el insumo, la bodega y quién lo registró. Cada movimiento incluye tipo, cantidad y saldo resultante. Acepta búsqueda textual, filtro por tipo, por bodega y por rango de fechas, e incluye indicadores del periodo.

Permisos requeridos

inventory.module

Request

Nombre Tipo Requerido Reglas
search string No
max:100
movementType string No
enum:purchase,sale,transfer_in,transfer_out,adjustment,waste
storageLocationId int No
min_value:1
dateFrom string No
max:30
dateTo string No
max:30

Paginación

defaultLimit 50
maxLimit 100
defaultDir desc
withTotal true
allowedSorts [createdAt, movementType, quantity, balanceAfter]

Ejemplo de request

curl -X POST https://restofy.pro/api/inventory/list-movements \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <accessToken>"

Los valores son demo: reemplázalos por datos reales del negocio.

Ejemplo de respuesta

Actualizado: 2026-09-13T21:05:19Z
HTTP 200

Request

[]

Response

{
    "success": true,
    "message": "Operación realizada correctamente",
    "data": {
        "movements": [
            {
                "movementId": 6,
                "movementUuid": "2ae5cb99-acb4-11f1-b72d-f2569efa6eee",
                "inventoryItemId": 28,
                "itemName": "Insumo Test 6aa70f402a4cf",
                "categoryName": "Cat Insumo 6aa70f3fbf3d3",
                "storageLocationId": 4,
                "locationName": "Bodega Bebidas",
                "movementType": "adjustment",
                "quantity": "100.0000",
                "baseUnitSymbol": "g",
                "countingSymbol": "g",
                "countingFactor": "1.0000",
                "costPerUnitCents": 150000,
                "balanceAfter": "100.0000",
                "transferId": null,
                "referenceId": null,
                "referenceType": null,
                "actorId": 15,
                "actorName": "App Testing",
                "notes": "Stock inicial de prueba",
                "createdAt": "2026-09-13T21:01:53.000Z"
            },
            {
                "movementId": 7,
                "movementUuid": "2b23054d-acb4-11f1-b72d-f2569efa6eee",
                "inventoryItemId": 28,
                "itemName": "Insumo Test 6aa70f402a4cf",
                "categoryName": "Cat Insumo 6aa70f3fbf3d3",
                "storageLocationId": 4,
                "locationName": "Bodega Bebidas",
                "movementType": "sale",
                "quantity": "-3.0000",
                "baseUnitSymbol": "g",
                "countingSymbol": "g",
                "countingFactor": "1.0000",
                "costPerUnitCents": 150000,
                "balanceAfter": "97.0000",
                "transferId": null,
                "referenceId": 6,
                "referenceType": "order_item",
                "actorId": 15,
                "actorName": "App Testing",
                "notes": null,
                "createdAt": "2026-09-13T21:01:53.000Z"
            },
            {
                "movementId": 8,
                "movementUuid": "2b241748-acb4-11f1-b72d-f2569efa6eee",
                "inventoryItemId": 28,
                "itemName": "Insumo Test 6aa70f402a4cf",
                "categoryName": "Cat Insumo 6aa70f3fbf3d3",
                "storageLocationId": 4,
                "locationName": "Bodega Bebidas",
                "movementType": "sale",
                "quantity": "-3.0000",
                "baseUnitSymbol": "g",
                "countingSymbol": "g",
                "countingFactor": "1.0000",
                "costPerUnitCents": 150000,
                "balanceAfter": "94.0000",
                "transferId": null,
                "referenceId": 7,
                "referenceType": "order_item",
                "actorId": 15,
                "actorName": "App Testing",
                "notes": null,
                "createdAt": "2026-09-13T21:01:53.000Z"
            },
            {
                "movementId": 5,
                "movementUuid": "2889c5a4-acb4-11f1-b72d-f2569efa6eee",
                "inventoryItemId": 27,
                "itemName": "Insumo Test 6aa70f3775ee6",
                "categoryName": "Cat Insumo 6aa70f37129df",
                "storageLocationId": 4,
                "locationName": "Bodega Bebidas",
                "movementType": "sale",
                "quantity": "-3.0000",
                "baseUnitSymbol": "g",
                "countingSymbol": "g",
                "countingFactor": "1.0000",
                "costPerUnitCents": 150000,
                "balanceAfter": "91.0000",
                "transferId": null,
                "referenceId": 5,
                "referenceType": "order_item",
                "actorId": 15,
                "actorName": "App Testing",
                "notes": null,
                "createdAt": "2026-09-13T21:01:49.000Z"
            },
            {
                "movementId": 3,
                "movementUuid": "262969c0-acb4-11f1-b72d-f2569efa6eee",
                "inventoryItemId": 27,
                "itemName": "Insumo Test 6aa70f3775ee6",
                "categoryName": "Cat Insumo 6aa70f37129df",
                "storageLocationId": 4,
                "locationName": "Bodega Bebidas",
                "movementType": "sale",
                "quantity": "-3.0000",
                "baseUnitSymbol": "g",
                "countingSymbol": "g",
                "countingFactor": "1.0000",
                "costPerUnitCents": 150000,
                "balanceAfter": "97.0000",
                "transferId": null,
                "referenceId": 3,
                "referenceType": "order_item",
                "actorId": 15,
                "actorName": "App Testing",
                "notes": null,
                "createdAt": "2026-09-13T21:01:45.000Z"
            },
            {
                "movementId": 4,
                "movementUuid": "262b12e9-acb4-11f1-b72d-f2569efa6eee",
                "inventoryItemId": 27,
                "itemName": "Insumo Test 6aa70f3775ee6",
                "categoryName": "Cat Insumo 6aa70f37129df",
                "storageLocationId": 4,
                "locationName": "Bodega Bebidas",
                "movementType": "sale",
                "quantity": "-3.0000",
                "baseUnitSymbol": "g",
                "countingSymbol": "g",
                "countingFactor": "1.0000",
                "costPerUnitCents": 150000,
                "balanceAfter": "94.0000",
                "transferId": null,
                "referenceId": 4,
                "referenceType": "order_item",
                "actorId": 15,
                "actorName": "App Testing",
                "notes": null,
                "createdAt": "2026-09-13T21:01:45.000Z"
            },
            {
                "movementId": 2,
                "movementUuid": "25c272b3-acb4-11f1-b72d-f2569efa6eee",
                "inventoryItemId": 27,
                "itemName": "Insumo Test 6aa70f3775ee6",
                "categoryName": "Cat Insumo 6aa70f37129df",
                "storageLocationId": 4,
                "locationName": "Bodega Bebidas",
                "movementType": "adjustment",
                "quantity": "100.0000",
                "baseUnitSymbol": "g",
                "countingSymbol": "g",
                "countingFactor": "1.0000",
                "costPerUnitCents": 150000,
                "balanceAfter": "100.0000",
                "transferId": null,
                "referenceId": null,
                "referenceType": null,
                "actorId": 15,
                "actorName": "App Testing",
                "notes": "Stock inicial de prueba",
                "createdAt": "2026-09-13T21:01:44.000Z"
            },
            {
                "movementId": 1,
                "movementUuid": "ffffffff-ffff-ffff-ffff-ffffffffff10",
                "inventoryItemId": 1,
                "itemName": "Lomo de Res",
                "categoryName": "Carnes y Aves",
                "storageLocationId": 1,
                "locationName": "Bodega Principal",
                "movementType": "purchase",
                "quantity": "10.0000",
                "baseUnitSymbol": "g",
                "countingSymbol": "g",
                "countingFactor": "1.0000",
                "costPerUnitCents": 500,
                "balanceAfter": "10.0000",
                "transferId": null,
                "referenceId": null,
                "referenceType": null,
                "actorId": 15,
                "actorName": "App Testing",
                "notes": null,
                "createdAt": "2026-09-13T21:00:44.000Z"
            }
        ],
        "pagination": {
            "page": 1,
            "limit": 50,
            "total": 8,
            "totalPages": 1,
            "hasNext": false,
            "hasPrev": false
        },
        "kpis": {
            "totalMovements": 8,
            "entriesCount": 3,
            "exitsCount": 5,
            "valueMovedCents": 32255000
        }
    }
}