/api/inventory_optimization

Header
X-Customer-Api-Id: <uuid>
X-Secret: <secret>
Content-Type: application/json
Request Body Schema
{
  "inventory_last_position": {
    "closing_inventory": number,       // Current on-hand quantity
    "last_count_date": "YYYY-MM-DD",   // Date of the stock count
    "warehouse": string                // Location label
  },
  "product_details": {                 // Echoed SKU metadata
    "product_code": string,
    "product_name": string,
    "category": string,
    "uom": string,
    "supplier": string
  },
  "forecast": [                        // Monthly demand projection
    { "yyyy-mm": "YYYY-MM", "value": number }
    // … at least 12 months …
  ],
  "lead_time_days": number,            // Replenishment lead time (calendar days)
  "daily_cost": number,                // Holding cost per unit per day
  "ordering_cost": number,             // Cost per purchase order
  "sales_revenue": number,             // Unit sell price
  "sales_profit": number,              // Unit contribution margin
  "buy_cost": number                   // Unit purchase cost
}
Example Request Body
{
  "inventory_last_position": {
    "closing_inventory": 50000,
    "last_count_date": "2025-04-15",
    "warehouse": "Central-SP"
  },
  "product_details": {
    "product_code": "38788",
    "product_name": "Widget Pro XL",
    "category": "Industrial Components",
    "uom": "units",
    "supplier": "WidgetCo Brazil"
  },
  "forecast": [
    { "yyyy-mm": "2025-05", "value": 2500 },
    { "yyyy-mm": "2025-06", "value": 2750 },
    // … through 2027-04 …
    { "yyyy-mm": "2027-04", "value": 3450 }
  ],
  "lead_time_days": 15,
  "daily_cost": 0.12,
  "ordering_cost": 150,
  "sales_revenue": 75,
  "sales_profit": 25,
  "buy_cost": 30
}
Example Response Body
{
  "inventory_analysis": {
    "inventory_coverage_ratio": {
      "months_of_inventory": 15.79,
      "days_of_inventory": 473.68,
      "description": "On-hand ÷ average monthly demand."
    },
    "excess_or_shortfall_analysis": {
      "stock_status": "Shortfall",
      "difference": 26000
    }
  },
  "stock_optimization_and_replenishment": {
    "reorder_point": 1678.68,
    "safety_stock": 95.35,
    "economic_order_quantity": 510.17,
    "optimal_order_frequency": 45.27,
    "inventory_turnover_ratio": 1.52
  },
  "forecast_demand_analysis": {
    "average_monthly_demand": 3166.67,
    "average_forecast_growth_rate": 1.83,
    "forecast_variability": { "coefficient_of_variation": 0.141 },
    "cumulative_demand_projection": { "exhaustion_month": "2026-09" }
  },
  "financial_analysis": {
    "inventory_value": 1500000,
    "shortfall_cost_details": {
      "shortfall_quantity": 26000,
      "profit_loss": 650000
    }
  },
  "alerts": {
    "stock_status_alert": "Alert: Stock Shortfall – immediate replenishment required."
  },
  "processing_info": {
    "processing_time_seconds": "0.005",
    "calculation_date": "2025-05-21"
  }
}
Description

Automatically computes optimal reorder points, safety stock, EOQ, inventory coverage, demand trends, and financial impact of any shortfall—so supply-chain, operations, and finance teams know exactly when and how much to order, and the cost of under- or over-stocking.

Business Usage

• Procurement Automation: Trigger POs when `reorder_point` is breached. • Working-Capital Planning: Use `inventory_value` and `shortfall_cost_details` for cash-flow forecasts. • Demand-Planning Reviews: Adjust marketing, production, and staffing based on `forecast_demand_analysis`. • Service-Level Alerts: Surface `alerts.stock_status_alert` for immediate replenishment actions. • Continuous Optimization: Monitor EOQ and turnover ratios to fine-tune ordering cadence and reduce total cost.

← Back to all routes