Skip to main content

Get Dashboard Statistics

curl -X GET "https://api.invenicum.com/dashboard/stats" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
Retrieves comprehensive statistics and insights for the dashboard, including container counts, item totals, market values, low stock alerts, and loan information.

Response

data
object
required
The dashboard statistics object
{
  "data": {
    "totalContainers": 5,
    "totalItems": 1247,
    "totalAssets": 342,
    "itemsPending": 23,
    "itemsLowStock": 15,
    "totalValue": 45789.50,
    "topLoanedItems": [
      {
        "id": 156,
        "name": "Laptop Dell XPS 15",
        "count": 45,
        "assetTypeId": 3,
        "containerId": 1
      },
      {
        "id": 234,
        "name": "Projector Epson EB-2250U",
        "count": 38,
        "assetTypeId": 5,
        "containerId": 1
      },
      {
        "id": 189,
        "name": "Conference Room Camera",
        "count": 32,
        "assetTypeId": 4,
        "containerId": 2
      }
    ],
    "loansExpiringToday": [
      {
        "itemName": "iPad Pro 12.9\"",
        "borrowerName": "John Smith",
        "quantity": 2
      },
      {
        "itemName": "Wireless Microphone Set",
        "borrowerName": "Sarah Johnson",
        "quantity": 1
      }
    ]
  }
}

Statistics Breakdown

Market Value Calculation

The totalValue field represents the cumulative market value of all inventory items, calculated by:
totalValue = Σ (item.marketValue × item.quantity)
This provides insight into the total worth of your inventory portfolio.

Low Stock Alerts

The itemsLowStock counter includes items where:
  • currentQuantity < minStock
Items are further categorized based on severity:
  • Critical (Red): Current quantity is less than 50% of minimum stock
  • Warning (Orange): Current quantity is between 50-100% of minimum stock

Loan Insights

Top Loaned Items: Identifies your most popular items based on loan frequency, helping you:
  • Plan inventory levels for high-demand items
  • Identify assets that may need additional units
  • Understand usage patterns
Loans Expiring Today: Provides real-time visibility into items due for return today, enabling:
  • Proactive follow-up with borrowers
  • Better availability planning
  • Reduced overdue loans

Use Cases

Inventory Health Dashboard

const stats = await fetch('/dashboard/stats');

if (stats.itemsLowStock > 0) {
  // Alert: Reorder needed
  notifyProcurement(stats.itemsLowStock);
}

if (stats.totalValue > insuranceThreshold) {
  // Review insurance coverage
  updateInsurancePolicy(stats.totalValue);
}

Loan Management Dashboard

const stats = await fetch('/dashboard/stats');

// Display expiring loans
stats.loansExpiringToday.forEach(loan => {
  sendReturnReminder(loan.borrowerName, loan.itemName);
});

// Analyze popular items
stats.topLoanedItems.forEach(item => {
  if (item.count > thresholdForAdditionalUnits) {
    suggestPurchase(item.name);
  }
});

Executive Summary Report

const stats = await fetch('/dashboard/stats');

const summary = {
  inventorySize: stats.totalItems,
  portfolioValue: formatCurrency(stats.totalValue),
  utilizationRate: (stats.topLoanedItems.length / stats.totalItems) * 100,
  healthStatus: stats.itemsLowStock === 0 ? 'Good' : 'Needs Attention'
};

Error Responses

401 Unauthorized
Returned when the API token is missing, invalid, or expired.
{
  "error": "No autorizado. Por favor, inicie sesión nuevamente."
}
500 Internal Server Error
Returned when the server encounters an unexpected error.
{
  "error": "Error inesperado al obtener estadísticas",
  "message": "Database connection failed"
}

Build docs developers (and LLMs) love