GET
/
api
/
v1
/
inventory
/
analytics
curl -X GET "https://api.stateset.com/api/v1/inventory/analytics?metric_type=overview&include_trends=true" \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "metric_type": "overview",
  "period": {
    "from": "2024-01-01T00:00:00Z",
    "to": "2024-11-15T23:59:59Z"
  },
  "metrics": {
    "total_value": 485750.00,
    "total_units": 12500,
    "unique_skus": 256,
    "average_turnover": 8.5,
    "stockout_rate": 0.03,
    "overstock_rate": 0.12,
    "dead_stock_value": 15000.00,
    "carrying_cost": 121437.50
  },
  "breakdown": [
    {
      "group": "Electronics",
      "name": "Electronics Category",
      "metrics": {
        "units": 3500,
        "value": 175000.00,
        "turnover_rate": 12.5,
        "days_of_supply": 29.2,
        "velocity": "fast"
      }
    },
    {
      "group": "Accessories",
      "name": "Accessories Category",
      "metrics": {
        "units": 5000,
        "value": 75000.00,
        "turnover_rate": 6.0,
        "days_of_supply": 60.8,
        "velocity": "medium"
      }
    }
  ],
  "trends": {
    "inventory_value": [
      { "date": "2024-01-01", "value": 450000 },
      { "date": "2024-02-01", "value": 465000 },
      { "date": "2024-03-01", "value": 478000 }
    ],
    "turnover_rate": [
      { "date": "2024-01-01", "rate": 7.5 },
      { "date": "2024-02-01", "rate": 8.0 },
      { "date": "2024-03-01", "rate": 8.5 }
    ]
  },
  "insights": [
    {
      "type": "opportunity",
      "severity": "high",
      "message": "15 SKUs have been non-moving for 180+ days",
      "affected_items": ["OLD-001", "OLD-002", "OLD-003"],
      "potential_savings": 15000.00
    },
    {
      "type": "warning",
      "severity": "medium",
      "message": "Electronics category showing 25% increase in stockouts",
      "affected_items": ["ELEC-101", "ELEC-102"],
      "potential_savings": 5000.00
    },
    {
      "type": "recommendation",
      "severity": "low",
      "message": "Consider implementing ABC classification for better control",
      "affected_items": [],
      "potential_savings": 8000.00
    }
  ]
}
The Analytics API provides real-time insights into inventory performance, trends, and optimization opportunities.

Query Parameters

metric_type
string
required
Type of analytics to retrieve:
  • overview - General inventory metrics
  • turnover - Inventory turnover analysis
  • aging - Stock aging report
  • performance - SKU performance metrics
  • forecast_accuracy - Forecast vs actual comparison
sku
string
Filter analytics for specific SKU
location_id
string
Filter by specific location
date_from
string
Start date for analytics period (ISO 8601)
date_to
string
End date for analytics period (ISO 8601)
group_by
string
Group results by: sku, category, location, supplier
Include historical trend data. Default: false

Response

metric_type
string
Type of analytics returned
period
object
Analytics time period
metrics
object
Core metrics based on metric_type
breakdown
array
Detailed breakdown by grouping
Historical trend data (if requested)
insights
array
AI-generated insights and recommendations
curl -X GET "https://api.stateset.com/api/v1/inventory/analytics?metric_type=overview&include_trends=true" \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "metric_type": "overview",
  "period": {
    "from": "2024-01-01T00:00:00Z",
    "to": "2024-11-15T23:59:59Z"
  },
  "metrics": {
    "total_value": 485750.00,
    "total_units": 12500,
    "unique_skus": 256,
    "average_turnover": 8.5,
    "stockout_rate": 0.03,
    "overstock_rate": 0.12,
    "dead_stock_value": 15000.00,
    "carrying_cost": 121437.50
  },
  "breakdown": [
    {
      "group": "Electronics",
      "name": "Electronics Category",
      "metrics": {
        "units": 3500,
        "value": 175000.00,
        "turnover_rate": 12.5,
        "days_of_supply": 29.2,
        "velocity": "fast"
      }
    },
    {
      "group": "Accessories",
      "name": "Accessories Category",
      "metrics": {
        "units": 5000,
        "value": 75000.00,
        "turnover_rate": 6.0,
        "days_of_supply": 60.8,
        "velocity": "medium"
      }
    }
  ],
  "trends": {
    "inventory_value": [
      { "date": "2024-01-01", "value": 450000 },
      { "date": "2024-02-01", "value": 465000 },
      { "date": "2024-03-01", "value": 478000 }
    ],
    "turnover_rate": [
      { "date": "2024-01-01", "rate": 7.5 },
      { "date": "2024-02-01", "rate": 8.0 },
      { "date": "2024-03-01", "rate": 8.5 }
    ]
  },
  "insights": [
    {
      "type": "opportunity",
      "severity": "high",
      "message": "15 SKUs have been non-moving for 180+ days",
      "affected_items": ["OLD-001", "OLD-002", "OLD-003"],
      "potential_savings": 15000.00
    },
    {
      "type": "warning",
      "severity": "medium",
      "message": "Electronics category showing 25% increase in stockouts",
      "affected_items": ["ELEC-101", "ELEC-102"],
      "potential_savings": 5000.00
    },
    {
      "type": "recommendation",
      "severity": "low",
      "message": "Consider implementing ABC classification for better control",
      "affected_items": [],
      "potential_savings": 8000.00
    }
  ]
}

Metric Types

Overview Analytics

General inventory health metrics and KPIs.
const overview = await stateset.inventory.analytics.get({
  metric_type: 'overview',
  group_by: 'category'
});

Turnover Analysis

Detailed inventory turnover rates and velocity metrics.
const turnover = await stateset.inventory.analytics.get({
  metric_type: 'turnover',
  group_by: 'sku',
  date_from: '2024-01-01'
});

Aging Report

Analysis of stock age and identification of slow-moving items.
const aging = await stateset.inventory.analytics.get({
  metric_type: 'aging',
  location_id: 'loc_warehouse_001'
});

Performance Metrics

SKU-level performance including sales velocity and profitability.
const performance = await stateset.inventory.analytics.get({
  metric_type: 'performance',
  sku: 'WIDGET-001',
  include_trends: true
});

Forecast Accuracy

Compare forecasted demand with actual sales to improve planning.
const accuracy = await stateset.inventory.analytics.get({
  metric_type: 'forecast_accuracy',
  date_from: '2024-06-01',
  date_to: '2024-11-01'
});

Exporting Analytics

Export analytics data in various formats:
// Export as CSV
const csvExport = await stateset.inventory.analytics.export({
  metric_type: 'overview',
  format: 'csv'
});

// Export as PDF report
const pdfReport = await stateset.inventory.analytics.export({
  metric_type: 'performance',
  format: 'pdf',
  include_charts: true
});

Scheduling Reports

Set up automated analytics reports:
const schedule = await stateset.inventory.analytics.schedule({
  name: 'Weekly Inventory Report',
  metric_type: 'overview',
  frequency: 'weekly',
  recipients: ['ops@company.com'],
  format: 'pdf'
});