/api/dynamic_pricing_recommend

Header
X-Customer-Api-Id: <uuid>
X-Secret:          <secret>
Content-Type:      application/json
Request Body Schema
{
  "product_id":             "string",
  "cost_per_unit":          0.0,
  "optimize_for":           "profit|revenue",
  "candidate_prices":       [float, ...],
  "historical": [
    {
      "date":               "YYYY-MM-DD",
      "price":              float,
      "units_sold":         int,
      "competitor_price":   float?, 
      "inventory_level":    int?, 
      "segment":            { "...": "..." }?
    }
    // ≥10 rows, ≥2 distinct prices
  ],
  "competitor_price_current": float?,
  "inventory_level_current":  int?,
  "segment_current":          { "...": "..." }?
}
Example Request Body
{
  "product_id": "SKU-123",
  "cost_per_unit": 50.0,
  "optimize_for": "profit",
  "candidate_prices": [79.0,89.0,99.0,109.0],
  "historical": [
    {"date":"2025-03-01","price":99.0,"units_sold":38,"competitor_price":95.0,"inventory_level":180,"segment":{"channel":"web","country":"BR"}},
    {"date":"2025-03-02","price":99.0,"units_sold":41,"competitor_price":96.0,"inventory_level":170,"segment":{"channel":"web","country":"BR"}},
    {"date":"2025-03-03","price":89.0,"units_sold":57,"competitor_price":90.0,"inventory_level":150,"segment":{"channel":"mobile","country":"BR"}},
    {"date":"2025-03-04","price":79.0,"units_sold":80,"competitor_price":88.0,"inventory_level":130,"segment":{"channel":"mobile","country":"BR"}},
    {"date":"2025-03-05","price":89.0,"units_sold":60,"competitor_price":91.0,"inventory_level":140,"segment":{"channel":"web","country":"BR"}},
    {"date":"2025-03-06","price":99.0,"units_sold":36,"competitor_price":97.0,"inventory_level":165,"segment":{"channel":"store","country":"BR"}},
    {"date":"2025-03-07","price":79.0,"units_sold":85,"competitor_price":89.0,"inventory_level":120,"segment":{"channel":"mobile","country":"BR"}},
    {"date":"2025-03-08","price":109.0,"units_sold":22,"competitor_price":104.0,"inventory_level":210,"segment":{"channel":"store","country":"BR"}},
    {"date":"2025-03-09","price":89.0,"units_sold":55,"competitor_price":92.0,"inventory_level":145,"segment":{"channel":"web","country":"BR"}},
    {"date":"2025-03-10","price":109.0,"units_sold":25,"competitor_price":103.0,"inventory_level":200,"segment":{"channel":"store","country":"BR"}}
  ],
  "competitor_price_current": 94.0,
  "inventory_level_current": 120,
  "segment_current": {"channel":"mobile","country":"BR"}
}
Example Response Body
{
  "best_price": 79.0,
  "outcomes": [
    {"candidate_price":79.0,"expected_units":85.0,"expected_revenue":6714.9,"expected_profit":2464.96},
    {"candidate_price":89.0,"expected_units":61.13,"expected_revenue":5440.35,"expected_profit":2383.97},
    {"candidate_price":99.0,"expected_units":44.56,"expected_revenue":4411.79,"expected_profit":2183.61},
    {"candidate_price":109.0,"expected_units":35.23,"expected_revenue":3839.86,"expected_profit":2078.46}
  ],
  "model_info": {
    "algorithm":   "XGBoost|Elastic-Net|RandomForest",
    "mape":        0.0,
    "train_rows":  10
  },
  "interpretation": "Setting price at 79.00 maximises PROFIT: +3.4% vs 89.00 given competitor=94.0 and inventory=120."
}
Description

- **best_price**: Optimal price to publish. - **outcomes**: Forecast units, revenue & profit per candidate price. - **model_info**: Selected model, MAPE, #history rows. - **interpretation**: One-line rationale.

Business Usage

Automate daily or flash-sale calls using recent sales data, push `best_price` to your platform, and monitor week-over-week margin improvements.

← Back to all routes