> ## Documentation Index
> Fetch the complete documentation index at: https://lopiv2-invenicum-25.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Dashboard Statistics

> Retrieve comprehensive statistics and insights for your dashboard

## Get Dashboard Statistics

```bash GET /dashboard/stats theme={null}
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

**DashboardStats Properties**

**totalContainers** `integer` *required*

Total number of containers in the system

**totalItems** `integer` *required*

Total number of inventory items across all containers

**totalAssets** `integer` *required*

Total number of assets tracked in the system

**itemsPending** `integer` *required*

Number of items with pending actions or updates

**itemsLowStock** `integer` *required*

Number of items currently below their minimum stock threshold

**totalValue** `number` *required*

Total market value of all inventory items (in the container's currency)

**topLoanedItems** `array` *required*

List of the most frequently loaned items

**TopLoanedItem Properties**

**id** `integer` *required*

Unique identifier for the inventory item

**name** `string` *required*

Name of the loaned item

**count** `integer` *required*

Number of times this item has been loaned

**assetTypeId** `integer` *required*

ID of the asset type category

**containerId** `integer` *required*

ID of the container where this item belongs

**loansExpiringToday** `array` *required*

List of loans that are expiring today

**ExpiringLoan Properties**

**itemName** `string` *required*

Name of the loaned item

**borrowerName** `string` *required*

Name of the person who borrowed the item

**quantity** `integer` *required*

Quantity of items in this loan

```json Response theme={null}
{
  "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

```javascript theme={null}
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

```javascript theme={null}
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

```javascript theme={null}
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.

```json theme={null}
{
  "error": "No autorizado. Por favor, inicie sesión nuevamente."
}
```

**500 Internal Server Error**

Returned when the server encounters an unexpected error.

```json theme={null}
{
  "error": "Error inesperado al obtener estadísticas",
  "message": "Database connection failed"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.