---
updatedAt: 2026-03-30T13:15:21.000Z
agentTools:
  siteIndex: https://documentation.bloomreach.com/llms.txt
  projectIndex: https://documentation.bloomreach.com/discovery/llms.txt
---

# Contextual Merchandising via the API

[Contextual Merchandising](https://documentation.bloomreach.com/discovery/docs/contextual-merchandising) is supported on the Item-based Recommendations family widgets. It works similarly to Item-based recommendation widgets and uses the Product ID/Context ID as an identifier for the item on your site to display relevant recommendations.

Contextual Merchandising is applied on the [Item-based Recommendations Widget API](https://documentation.bloomreach.com/discovery/reference/item-based-recommendation-widget-api) by passing an additional Context PID (`context_pids`) parameter (not mandatory).

## What is Context PID

***

Context PID is the latest addition to Item-based recommendations API parameters. Context PID comes into play when a user decides to add a Contextual Merchandising rule as an attribute rule during the widget creation process. An example of a Context PID API parameter is: `&context_pids=4500928`.

## Is Context PID API parameter mandatory?

***

Currently, the Context PID API parameter is not mandatory. In case a Context PID is not passed as an API parameter, our system will consider Item ID as Context PID and Item ID will work as a fallback for Contextual recommendations.

But it is highly recommended to add a Context PID as an API parameter whenever a contextual attribute rule is added for better widget recall set and performance.