Sometimes, it makes sense to generate recommendations for a list of products. A great example is checkout recommendations, where you want to take everything the customer has in cart into account when calculating the recommendations. To do this, you can query the following endpoint:

POST https://api.depict.ai/v2/recommend/products/products

The way we use this endpoint is completely analogous to how we use the endpoint for a single product except that we now require a list of product IDs instead of just a single ID.

Example request in JavaScript

const response = await fetch(
	"<https://api.depict.ai/v2/recommend/products/products>",
	{
		method: 'POST',
		data: JSON.stringify({
			tenant: "companyname", 
			market: "se",
			type: "checkout", 
			product_ids: ["123456", "234567", "345678"],
			user_id: "username",
			session_id: "3j894g95g",
		})
	}
)

The response is the same as when requesting a single product’s recommendations.