---
title: Product recommendations response
slug: product-recommendations/docs/recommendations-response
docTags: 
createdAt: 2026-07-30T20:41:29.696Z
---

The Optimizely Recommendations API returns a list of product recommendations in the message.

The contents are returned in the `smartRecs` element at the root of the response JSON. It contains the product recommendations generated by the Optimizely recommendations engine. These product recommendations are grouped by widget.

The value of `smartRecs` is a list of product recommendation widget elements. These elements have the following properties:

| Parameters   |            |            |           | Description and usage                                                                                                                                                                                                                                                   |
| ------------ | ---------- | ---------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| campaignId   |            |            |           | \[String]<br />The ID of the widget campaign. This is used for validation.<br />`"campaignId" : "k3Rw892i"`                                                                                                                                                             |
| campaignName |            |            |           | \[String]<br />The name of the widget campaign. This is used for validation.<br />`"campaignName" : "Packaging slip"`                                                                                                                                                   |
| widgets      |            |            |           | \[List]<br />The list of widgets in the campaign.<br />`"widgets" : [{…},{…},…]`                                                                                                                                                                                        |
|              | widgetId   |            |           | \[String]<br />The ID of the widget.<br />`"widgetId" : "08Ppq3ca"`                                                                                                                                                                                                     |
|              | widgetName |            |           | \[String]<br />The name of the widget.<br />`"widgetId" : "middlejson"`                                                                                                                                                                                                 |
|              | alias      |            |           | \[String]<br />The alias name of the widget. Multiple widgets can share the same alias.<br />`"alias" : "Packaging slip (4 recs)"`                                                                                                                                      |
|              | recs       |            |           | A list of product recommendations.<br />`"recs" : [{…},{…},{…},…]`                                                                                                                                                                                                      |
|              |            | img        |           | \[String]<br />URL of the product image.<br />`"img" : "http://www.retailer.com/img/RC678_size_small"`                                                                                                                                                                  |
|              |            | title      |           | \[String]<br />Product title.<br />`"title" : "Levis Washed Jeans"`                                                                                                                                                                                                     |
|              |            | url        |           | \[String]<br />URL to the product page for the item.<br />`"url" : "http://www.retailer.com/product/RC678.html"`                                                                                                                                                        |
|              |            | refCode    |           | \[String]<br />Product reference code.<br />`"refCode" : "RC678"`                                                                                                                                                                                                       |
|              |            | prices     |           | A map in which the key will be the currency name (such as USD, GBP, and so on) and the value a map with unitPrice and salePrice properties. For example:<br />`"prices"  : {`<br />`"GBP" : {`<br />`"unitPrice" : 52.00,`<br />`"salePrice" : 40.00`<br />`}`<br />`}` |
|              |            |            | unitPrice | \[Number]<br />The price per unit of the item.                                                                                                                                                                                                                          |
|              |            |            | salePrice | \[Number]<br />The sale price of the item.                                                                                                                                                                                                                              |
|              |            | attributes |           | A list of attributes and their values. Attributes required in the request.<br />`"attributes" : { "colour" : "washed blue", … }`                                                                                                                                        |

In the request, you can configure the output details of the recommended product by the `recContent` request parameter.

## Response examples

The following example shows three product recommendations returned for one widget with full product details, which is the default behavior when `recContent` is omitted or has value *full*:

```csharp
{  
      "status"    : "OK",
      "smartRecs" : [{  
        "campaignId"   : "k3Rw892i",
        "campaignName" : "Packaging slip",
        "widgets"      : {  
            "widgetId"   : "08Ppq3ca",
            "widgetName" : "middlejson",
            "alias"      : "Packaging slip (4 recs)",
            "recs"       : [{  
               "img"        : "http://www.retailer.com/img/RC678_size_small",
               "title"      : "Levis Washed Jeans"
               "url"        : "http://www.retailer.com/product/RC678.html",
               "refCode"    : "RC678",
               "prices"     : {  
                 "GBP" : {  
                   "unitPrice" : 52.00,  
                   "salePrice" : 40.00
                 }
               },
               "attributes" : {  
                 "colour" : "dirty blue"
               }
             },
             {  
               "img"        : "http://www.retailer.com/img/RC910_size_small",
               "title"      : "Levis Dirty Jeans",
               "url"        : "http://www.retailer.com/product/RC910.html",
               "refCode"    : "RC910",
               "prices"     : {  
                 "GBP" : {  
                   "unitPrice" : 54.95,  
                   "salePrice" : 43.95
                 }
               },
               "attributes" : {  
                 "colour" : "washed blue"
               }
             },
             {  
               "img"        : "http://www.retailer.com/img/RC101_size_small",
               "title"      : "Levis Legless Jeans",
               "url"        : "http://www.retailer.com/product/RC101.html",
               "refCode"    : "RC101",
               "prices"     : {  
                 "GBP" : {  
                   "unitPrice" : 39.95,
                   "salePrice" : 39.95
                 }
               },
               "attributes" : {  
                 "colour" : "just blue"
               }
             }]
          }
     }],
    }
```

This is the returned result when `recContent` property is set to `refCodeOnly`:

```csharp
{  
      "status"    : "OK",
      "smartRecs" : [  
       {  
         "campaignId"   : "k3Rw892i",
         "campaignName" : "Packaging slip",
         "widgets"      : {  
           "widgetId"   : "08Ppq3ca",
           "widgetName" : "middlejson",
           "alias"      : "Packaging slip (4 recs)",
           "recs"       : [  
             {  
               "refCode"    : "RC678",
               "attributes" : {"colour" : "dirty blue"}
             },
             {  
               "refCode"    : "RC910",
               "attributes" : {"colour" : "washed blue"}
             },
             {  
               "refCode"    : "RC101",
               "attributes" : {"colour" : "just blue"}
             }
           ]
         }
       }
     ],
    }
```
