Skip to main content

Complementary Recommendations

Complementary recommendations

POST /indexes/{index_name}/recommendations/complementary

Purpose

Drive cross-sell by suggesting items frequently purchased or interacted with together. Complementary recommendations use machine learning to analyze purchase patterns, co-occurrence data, and product relationships to identify items that naturally pair with what the customer is already considering. Unlike similar recommendations that offer alternatives, complementary suggestions work synergistically with the base product to optimize for increased Average Order Value (AOV).

When to use

  • Cross-sell opportunities: When customers are viewing or have added items that commonly pair with accessories, add-ons, or complementary products
  • Bundle optimization: To suggest logical product combinations that increase basket size
  • Cart abandonment recovery: To add value perception through relevant add-ons

Example uses

Use CaseDescriptionInput ProductsBusiness Impact
Frequently Bought TogetherSuggest items commonly purchased alongside the current productMain product from PDP or cartDrives cross-sell, leverages proven purchase patterns
Cart CompletionRecommend add-ons or accessories before checkoutAll items currently in cartLast-chance revenue boost, reduces post-purchase regret
Bundle SuggestionsShow products that work together as a logical set or packagePrimary product or category anchorCreates value perception, increases basket size
Cross-Sell OpportunitiesSuggest complementary items from different categoriesAny product as anchor pointDiversifies purchase, introduces new product categories

Event types (eventType)

The eventType parameter controls which co-interaction signal is used to generate recommendations:

  • ClickEvent — "customers also viewed". Based on products that users frequently view together.
  • AddToCartEvent — "customers also added to cart". Based on products that users frequently add to cart together.
  • PurchaseEvent — "frequently bought together". Based on products that users frequently purchase together.

How multiple docIds work

When multiple docIds are provided, results are products that are complementary to any of the input items, ranked by the sum of co-interaction frequencies across all input items. This is useful for checkout-page cross-sell where you want to recommend items based on the entire cart.

Example (cURL)

curl -X POST https://ecom.marqo-ep.ai/api/v1/indexes/${index_name}/recommendations/complementary \
-H "x-marqo-index-id: ${MARQO_INDEX_ID}" \
-H "Content-Type: application/json" \
-d '{
"docIds": ["shirt_123"],
"eventType": "PurchaseEvent",
"limit": 6
}'

Multi-doc example (checkout cross-sell)

curl -X POST https://ecom.marqo-ep.ai/api/v1/indexes/${index_name}/recommendations/complementary \
-H "x-marqo-index-id: ${MARQO_INDEX_ID}" \
-H "Content-Type: application/json" \
-d '{
"docIds": ["shirt_123", "pants_456"],
"eventType": "PurchaseEvent",
"minFrequency": 5,
"limit": 4,
"filter": "in_stock:true"
}'

Parameters

Filters use the Marqo Filter DSL. Note: Results automatically exclude the input item(s) where applicable. The endpoint uses strict validation — any unrecognized parameters will return a 400 error.

NameTypeRequiredDescriptionExample
docIdsarray[string]yesAn array of 1-10 item IDs to anchor the complements.["shirt_123"]
eventTypestringyesThe type of co-interaction to base recommendations on. One of ClickEvent, AddToCartEvent, PurchaseEvent."PurchaseEvent"
limitintegernoMax number of results (default 10).6
offsetintegernoPagination offset.0
filterstringnoConstrain by stock, brand, category, price ranges. See Marqo Filter DSL."in_stock:true"
attributesToRetrievearray[string]noAttributes to return in the response for each document. If not specified, all attributes are returned.["title", "price", "image_url"]
minFrequencyintegernoMinimum number of co-interactions required for a product to appear in results. Acts as a quality threshold — set higher to only surface strong signals. Defaults to 1.5
profileIdstringnoA named configuration profile for the request. Profiles allow fine-tuned configurations tailored to specific use cases (e.g., different behaviour on PDP vs checkout). If the specified profile does not exist, Marqo will fall back to the default configuration."pdp_default"