v1
latestOpenAPI 3.0.22026-08-0426137631.3 KBProduct to Products API
The Product to Products API returns the products that are related to an anchor product (often the product the user is currently engaging with) and are also likely to drive conversions by connecting with the user’s interests. It is different from the User to Products API as it not only considers the user’s interests but also considers the recommended products' relevancy to the anchor product.
Applicable scenarios
This API is frequently used in product detail page to show related products that users can consume further, such as "Related products you may like" on Amazon or "Up next video" on Youtube. It is one of Miso's best performing APIs. Our customers usually see more than 30% and some times 110% relative lift in click-through rate after deploying this a feature using this API.
Basic usage
To use this API, you just need to let Miso knows the user_id (or anonymous_id) and the product_id you want to get related recommendations for. For example, the following request will return the products that are related to the movie Toy Story.
POST https://api.askmiso.com/v1/recommendation/product_to_products
{
"user_id": "user_123",
"product_id": ["toy-story-1995"],
"rows": 3,
"fl": ["title"]
}
- product_id: the id of the anchor product
- rows: the number of related products to return
- fl: like in other Miso API, you can use fl to control which fields to return for each Product
The response will be like:
{
"message": "success",
"data": {
"took": 56,
"miso_id": "f98b1904-ddce-11eb-be53-fa1729b23183",
"products": [
{
"product_id": "toy-story-2-1999",
"title": "Toy Story 2 (1999)"
},
{
"product_id": "toy-story-3-2010",
"title": "Toy Story 3 (2010)"
},
{
"product_id": "the-lion-king-1994",
"title": "The Lion King (1994)"
}
]
}
}
- products: a list of products related to the anchor product
- products[ ].product_id: the id of the recommended product
- products[ ].title: the title of the recommended product. You can use fl parameter to make Miso return more fields
Boosting and filtering
Like every Miso API, you can utilize fq and boost_fq to fine-tune the recommendations returned by Miso, and Miso will guarantee to return the required number of recommendations that meet the given criteria.
For example, the following request still recommends movies related to "Toy Story" but limits the recommendations to only the movies released after year 2010.
POST https://api.askmiso.com/v1/recommendation/product_to_products
{
"user_id": "user_123",
"product_id": ["toy-story-1995"],
"rows": 3,
"fl": ["title"],
"fq": "custom_attributes.year: [2010 TO *]"
}
For another example, the following request will boost the movies that are acted by Tom Hanks. The boosting is different from filtering as it only prioritizes those products that match the boosting criteria and are relevant to the anchor products, but it will not limit the results to only such products.
POST https://api.askmiso.com/v1/recommendation/product_to_products
{
"user_id": "user_123",
"product_id": ["toy-story-1995"],
"rows": 3,
"fl": ["title"],
"boost_fq": "custom_attributes.actors:\"Tom Hanks\""
}
Multiple anchor products
In the scenarios where you want to recommend products related to multiple anchor products, for example, for shopping cart cross-sell or up-sell, you can utilize product_ids parameter and have multiple product ids in it.
For instance, the following request recommends products related to movies "Toy Story" and "Monsters, Inc." that will be of interest to the the current user.
POST https://api.askmiso.com/v1/recommendation/product_to_products
{
"user_id": "user_123",
"product_ids": ["toy-story-1995", "monsters-inc-2001"],
"rows": 3,
"fl": ["title"]
}
Request body
Example request
{
"additional_interactions": [
{
"duration": 61.5,
"product_ids": [
"123ABC-BLACK"
],
"product_group_ids": [
"123ABC"
],
"user_id": "user_1234",
"anonymous_id": "86D51273AD8BF84217E1567B6CBE7152D7034404",
"miso_id": "123e4567-e89b-12d3-a456-426614174000",
"context": {
"campaign": {
"name": "spring_sale",
"source": "Google",
"medium": "cpc",
"term": "running+shoes",
"content": "textlink"
},
"truncated_ip": "1.1.1.0",
"locale": "en-US",
"region": "US East",
"page": {
"url": "https://example.com/miso-tshirt-123ABC",
"referrer": "https://example.com/",
"title": "My Product Page"
},
"user_agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0",
"custom_context": {
"session_variable_1": [
"value_1",
"value_2"
]
}
}
}
],
"custom_context": {
"session_variable_1": [
"value_1",
"value_2"
]
},
"boosting_tags": [
"tag-1",
"quetag-2"
]
}Response
Successful Response
Example response
{
"data": {
"miso_id": "123e4567-e89b-12d3-a456-426614174000",
"products": [
{
"product_id": "123ABC-S-Black"
}
]
}
}