Variants: Recommendations

See how Variants works in the Unbxd V3 Recommendations API

Overview

The V3 Recommendations API can now return variant information alongside each recommended product, so customers who want to show variants in their front end can get them directly in the Recs response.

Each product can carry a variant ID, a variant count, a variant total, and a variants array, and the same variant fields also show up in console previews once they are mapped in Product Card Mapping.

The feature is available in the V3 API only.

Enable Variants

Variants must be enabled for the site before the API returns any variant data. If it is not enabled, no combination of request parameters will produce variant output.

Request Variants

Once variants are enabled for the site, include these parameters in the V3 Recommendations request.

ParameterRequiredDescription
variantsYes, for variant outputSet to true
variants.countOptionalVariants to return per product. Defaults to 1 when variants=true is sent without a count
GET v3.0/{apiKey}/{siteKey}/recommendation?pageType=PRODUCT&id=xxs812&uid=uid1234&variants=true&variants.count=1

If neither parameter is sent, Recommender does not send variant parameters to Mimir, and the response has no variant data.

Variant Response

Each product in the response carries its own variant fields alongside the usual product data.

{
  "uniqueId": "xxs812",
  "title": "Armitage Sectional",
  "productUrl": "/p/_/R-xxs812",
  "score": 0.25,
  "vId": "xxs812_J210890",
  "variantCount": 2,
  "variantTotal": 2,
  "variants": [
    {
      "vId": "xxs812_J210890",
      "title": "Armitage Sectional",
      "productUrl": "/p/_/R-xxs812",
      "score": 0.25
    }
  ]
}
Response fieldMeaning
vIdVariant ID of the variant shown for the product
variantCountNumber of variants (2 in the example)
variantTotalTotal variants for the product (2 in the example)
variantsArray of variant objects; length capped by variants.count (1 in the example)

Did this page help you?