--- title: How the Commerce API interacts with the CMH slug: o6od0220 canonical_url: https://docs.coveo.com/en/o6od0220/ collection: coveo-for-commerce source_format: adoc --- # How the Commerce API interacts with the CMH The [Commerce API](https://docs.coveo.com/en/103/) exposes services that let you create [search interfaces](https://docs.coveo.com/en/2741/), [product listing pages (PLPs)](https://docs.coveo.com/en/m1sf3187/), and [product recommendations](https://docs.coveo.com/en/3132/) in your Coveo-powered commerce site. The Commerce API is designed to be used with the [Coveo Merchandising Hub (CMH)](https://docs.coveo.com/en/o5290573/), which lets you configure its behavior. In contrast to the CMH, which is meant for merchandisers, the Commerce API is meant for developers to send requests from the front end to the [Coveo Platform](https://docs.coveo.com/en/186/). The Commerce API embraces a fully [descriptive API](#whats-a-descriptive-api). This approach enhances merchandiser control, standardizes developer implementations, and reduces developer rework once the implementation is complete. Merchandisers gain greater control over their [product discovery solutions](https://docs.coveo.com/en/o9cf0524/) as business logic shifts to the CMH. However, rather than directly querying products with the Commerce API, we strongly recommend using the [Coveo Headless library](https://docs.coveo.com/en/lcdf0493/), which abstracts away most of the complexity that comes with working directly with the API. ## What's a descriptive API? A descriptive API requires the consumer to identify a resource and describe the user's current state, allowing the API to render the response. All business logic resides behind the API, enabling control by the merchandiser, a [Coveo Machine Learning (Coveo ML)](https://docs.coveo.com/en/188/) [model](https://docs.coveo.com/en/1012/), or both. This contrasts with Imperative APIs, where the consumer dictates specific actions to the API. For example, in a descriptive API, the front end requests content for _surfboards_ without specifying facets, ranking rules, sorting criteria, etc. The Coveo Platform responds with the relevant details, such as exactly which facets should be returned and if certain ranking rules need to be applied to the response. These details were configured by the merchandiser in the CMH or left to [Coveo Machine Learning (Coveo ML)](https://docs.coveo.com/en/188/) [models](https://docs.coveo.com/en/1012/). The Commerce API is a descriptive API that allows the front end to request content without specifying the business logic. This content is managed using various Commerce API endpoints. > **Note** > > For recommendations, under the hood, the CMH configures the response returned by the Commerce API via the [Recommendations Configuration](https://docs.coveo.com/en/o8880463/) endpoints. ## Product listing page example Let's look at an example of how [product listing pages (PLPs)](https://docs.coveo.com/en/m1sf3187/) are configured in Coveo to better understand the interaction between the CMH and the Commerce API. [Create each PLP](https://docs.coveo.com/en/pbjb9139/) on your commerce site using the [Product listings manager](https://docs.coveo.com/en/ncce0176/) in the [Coveo Merchandising Hub (CMH)](https://docs.coveo.com/en/o5290573/), which uses the [Public Listing Page API](https://docs.coveo.com/en/103/api-reference/commerce-api#tag/Public-Listing-Page-API) under the hood, or by calling this API directly. Once a PLP has been created, the front end can query it through the Commerce API to return the desired products. Set up [facets](https://docs.coveo.com/en/198/) for your PLPs using the [Facet manager](https://docs.coveo.com/en/p3oa0420/) in the [Coveo Merchandising Hub (CMH)](https://docs.coveo.com/en/o5290573/), which uses the [Facet Field Configurations API](https://docs.coveo.com/en/103/api-reference/commerce-api#tag/Facet-Field-Configurations) under the hood. If the [Facet manager](https://docs.coveo.com/en/p63f0211/) isn't enabled for your [organization](https://docs.coveo.com/en/185/), you'll have set up your [facets](https://docs.coveo.com/en/198/) using the Query Configurations API. [Use the Query Configurations API](https://docs.coveo.com/en/pbbf0247/) to specify certain details about the products returned by the Commerce API, including their sort criteria and additional [fields](https://docs.coveo.com/en/200/). For PLPs, you can create _global_ and _specific_ query configurations, and any settings in a specific configuration override those in the global configuration. **Example** In the global query configuration for PLPs, you specify that you want to sort by relevance. In a specific query configuration for the "Promotions" PLP, you specify that you want to sort by price. This sorting will take precedence over the global setting on that PLP. Optionally, [set up additional rules](https://docs.coveo.com/en/ncce0176#product-listings-manager-rules) to apply to the products returned by the Commerce API using the [Product listings manager](https://docs.coveo.com/en/p64e0262/) in the [Coveo Merchandising Hub (CMH)](https://docs.coveo.com/en/o5290573/).