Recommendations
Get Recommendations
GET /api/recommendationsReturns a list of recommended products for a given context.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
productId | string | Conditional | Shopify product ID. Required for product-based strategies. |
collectionId | string | Conditional | Shopify collection ID. Required for collection strategies. |
customerId | string | No | Shopify customer ID for personalized recommendations. |
strategy | string | No | Recommendation strategy (see below). Defaults to auto-select. |
limit | number | No | Number of products to return (default: 8, max: 24). |
exclude | string | No | Comma-separated product IDs to exclude from results. |
Strategies
| Strategy | Description | Required Context |
|---|---|---|
bought-together | Products frequently purchased together | productId |
similar | Products similar by attributes and behavior | productId |
trending | Currently trending products in the store | None |
personalized | Personalized to the shopper’s history | customerId |
collection-popular | Popular products in a collection | collectionId |
recently-viewed | Based on the shopper’s recent browsing | customerId |
Response
{ "products": [ { "id": "gid://shopify/Product/123456", "title": "Classic Leather Wallet", "handle": "classic-leather-wallet", "image": "https://cdn.shopify.com/...", "price": "49.99", "compareAtPrice": "59.99", "vendor": "LeatherCo", "score": 0.92, "strategy": "bought-together" } ], "meta": { "strategy": "bought-together", "modelLevel": 2, "count": 8 }}Example
curl -H "Authorization: Bearer your-api-key" \ "https://your-store.myshopify.com/apps/simplersuite-recommendations/api/recommendations?productId=123456&strategy=bought-together&limit=4"