Skip to main content
For dev - Recommendation API

In this article, we want to introduce our Recommendation API and what you can do with it.

Thomas Ta avatar
Written by Thomas Ta
Updated over a week ago

📖 In this article, we want to introduce our Recommendation API and what you can do with it.


Description

Recommendation API lets you query the recommendation widgets for rendering in the frontend store's theme


What can you do with Recommendation API

POST /discovery/recommend

Return recommendation products by type

Params

Param

Type

Default

Values

recommendationType

string

"bestsellers",

"newest-arrivals",

"frequently-bought-together",

"trending-products",

"hand-picked-products",

"recently-viewed",

"most-viewed",

"related-items”

limit

number (optional)

30

shop

string (required)

tenantId

debug

boolean

false

modelType

string

FBT

Complementary

Alternative

AIRelated

Request Body

{
"type": "object",
"properties": {
"limit": {
"type": "number",
"default": 30
},
"recommendationType": {
"type": "string",
"required": true,
"enum": [
"bestsellers",
"newest-arrivals",
"frequently-bought-together",
"trending-products",
"hand-picked-products",
"recently-viewed",
"most-viewed",
"related-items"
]
},
"modelType": {
"type": "string",
"enum": [
"FBT",
"Complementary",
"Alternative",
"AIRelated"
]
},
"calculatedBasedOn": {
"type": "string",
"enum": [
"view-events",
"purchase-events"
],
"description": "Support trending products"
},
"rangeOfTime": {
"type": "string",
"enum": [
"1-day",
"2-day",
"3-day",
"4-day",
"5-day",
"6-day",
"7-day"
],
"description": "Support trending products"
},
"productIds": {
"type": "array",
"description": "list of product ids"
},
"ruleBased": {
"type": "array",
"item": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"sameCollection",
"sameProductType",
"sameVendor",
"sameTags",
"sameMetafield",
"sameProductCategory"
]
},
"status": {
"type": "boolean"
},
"excluded": {
"type": "array",
"items": [
{
"type": "string"
}
]
},
"metafield": {
"type": "string"
}
}
},
"description": "Support frequently-bought-together"
}
}
}

Response

{
"products": {
"type": "array",
"item": "ProductObject"
},
"total": {
"type": "number"
},
"debug": {
"type": "Object"
}
}

Example

{
"total": 278,
"products": [
{
"body_html": "Cum a rerum ut. Et dolores amet inventore corporis.",
"skus": [],
"available": true,
"created_at": "2022-06-30T00:36:16-07:00",
"review_count": 0,
"variants": [
{
"merged_options": ["size:XXS", "color:Purple"],
"inventory_quantity": 8,
"image": null,
"compare_at_price": null,
"inventory_management": null,
"fulfillment_service": "manual",
"available": true,
"title": "XXS / Purple",
"inventory_policy": "deny",
"price": "71",
"id": 40258801401898,
"sku": "",
"barcode": ""
},
{
"merged_options": ["size:M", "color:Purple"],
"inventory_quantity": 2,
"image": null,
"compare_at_price": "71",
"inventory_management": null,
"fulfillment_service": "manual",
"available": true,
"title": "M / Purple",
"inventory_policy": "deny",
"price": "7",
"id": 40258801434666,
"sku": "",
"barcode": ""
},
{
"merged_options": ["size:L", "color:Purple"],
"inventory_quantity": 8,
"image": null,
"compare_at_price": "71",
"inventory_management": null,
"fulfillment_service": "manual",
"available": true,
"title": "L / Purple",
"inventory_policy": "deny",
"price": "63",
"id": 40258801467434,
"sku": "",
"barcode": ""
}
],
"media": [],
"title": "Purple Mix Dress",
"price_min": 7,
"images_info": [
{
"src": "https://cdn.shopify.com/s/files/1/0567/8386/3850/products/1.jpg?v=1656574576",
"width": 762,
"alt": "Ipsum expedita iusto ad fugiat totam.",
"id": 29585037852714,
"position": 1,
"height": 1100
},
{
"src": "https://cdn.shopify.com/s/files/1/0567/8386/3850/products/4.jpg?v=1656574576",
"width": 762,
"alt": null,
"id": 29585037885482,
"position": 2,
"height": 1100
}
],
"review_ratings": 0,
"template_suffix": "",
"updated_at": "2022-12-25T20:38:20-08:00",
"collections": [
{
"template_suffix": "",
"handle": "dress",
"id": 271327232042,
"sort_value": "09",
"title": "Dress"
}
],
"vendor": "<a onmouseover=alert(document.cookie)>xxs link</a>",
"percent_sale_min": 90,
"best_selling_rank": 999999,
"html": {
"theme_id": 0,
"value": ""
},
"id": 6840831377450,
"published_at": "2022-06-30T00:36:14-07:00",
"images": {
"1": "https://cdn.shopify.com/s/files/1/0567/8386/3850/products/1.jpg?v=1656574576",
"2": "https://cdn.shopify.com/s/files/1/0567/8386/3850/products/4.jpg?v=1656574576"
},
"options_with_values": [
{
"values": [
{
"image": null,
"title": "XXS"
},
{
"image": null,
"title": "M"
},
{
"image": null,
"title": "XL"
},
{
"image": null,
"title": "XXL"
}
],
"name": "size",
"label": "Size"
},
{
"values": [
{
"image": null,
"title": "Yellow"
}
],
"name": "color",
"label": "Color"
}
],
"weight_min": 56,
"handle": "purple-mix-dress",
"compare_at_price_min": 71,
"barcodes": [],
"tags": ["collection:dresses", "style:Arty"],
"published_scope": "webmetafields": [],
"review_ratings": 0,
"product_type": "Dresses",
"weight_max": 971,
"locations": [],
"position": null,
"compare_at_price_max": 71,
"product_category": null,
"price_max": 71,
"debugInfo": {
"score": null,
"sort": [
999999,
1656574576000
]
}
}
],
"debug": {
"aiResponse": []
}
}

If you have any questions or need further assistance, please do not hesitate to contact our dedicated support team at [email protected].

Did this answer your question?