/api/cross_sell_matrix

Header
X-Customer-Api-Id: <uuid>
X-Secret:          <secret>
Content-Type:      application/json
Request Body Schema
{
  "level":        "item|category",
  "customer_id":  "string|null",
  "transactions": [
    {
      "customer_id": "string",
      "items":       ["string", "..."]
    }
  ],
  "item_catalog": [
    {
      "item_id":   "string",
      "category":  "string"
    }
  ]
}
Example Request Body
{
  "level": "item",
  "customer_id": null,
  "transactions": [
    { "customer_id": "C-1", "items": ["SKU-A1","SKU-B9"] },
    { "customer_id": "C-2", "items": ["SKU-A1","SKU-D7","SKU-E2"] },
    { "customer_id": "C-1", "items": ["SKU-B9","SKU-E2"] }
  ],
  "item_catalog": [
    { "item_id": "SKU-A1", "category": "shoes.running" },
    { "item_id": "SKU-B9", "category": "shoes.trail" },
    { "item_id": "SKU-D7", "category": "accessories.socks" },
    { "item_id": "SKU-E2", "category": "electronics.wearable" }
  ]
}
Example Response Body
{
  "items_or_categories": ["SKU-A1","SKU-B9","SKU-D7","SKU-E2"],
  "matrix": [
    [1.0, 0.5, 0.5, 0.5],
    [0.5, 1.0, 0.0, 0.5],
    [0.5, 0.0, 1.0, 1.0],
    [0.5, 0.5, 1.0, 1.0]
  ],
  "metric":       "orders_with_i_and_j / orders_with_i",
  "generated_at": "2025-05-21T10:33:37.149247Z"
}
Description

Return a conditional-probability matrix confidence(i→j)=#orders_with_both(i,j)/#orders_with(i) at item or category level, global or per customer.

Business Usage

• PDP “Frequently Bought Together” → +8–18% attach rate • Dynamic checkout bundles → +5–12% AOV • Assortment & planogram design → higher shelf penetration • Category-to-category email flows → +10–25% CTR

← Back to all routes