Use this file to discover all available pages before exploring further.
The RecommendationsService class (accessed via client.recommendations) allows you to integrate AI-driven product suggestions into your storefront to increase discovery and conversion.
Secret Key Required. This service requires a Secret Key (sk_live_* / sk_test_*). AI inference is computationally expensive and consumes Gemini API quota — gating to sk prevents abuse from scraped publishable keys. Requests authenticated with a publishable key receive 403 Forbidden.
Retrieve curated product suggestions based on various AI models. Use the examples below to see how to implement different recommendation strategies.
// Get products similar in meaning or features to a specific itemconst { recommendations } = await client.recommendations.getRecommendations({ requestBody: { type: 'similar', productId: 'current-product-uuid', limit: 4 }});
Recommendation Types Details:
Type
Description
Required Parameters
similar
Products with similar features/meaning (Embedding-based).
Required. The configuration for the recommendation request.
requestBody.type
string
The recommendation algorithm to use.
requestBody.productId
string
Required for similar, also-bought, and bundle.
requestBody.customerId
string
Required for personalized.
requestBody.limit
number
Optional. Maximum number of suggestions to return.
Recommendation results are often cached for high performance. The response includes a fromCache boolean, a computedAt ISO timestamp, and an optional fallbackUsed string indicating if the system had to use a simpler algorithm due to data scarcity.
When a recommendation type cannot produce results (insufficient data, missing embeddings, cold-start product, etc.), Tybrite degrades gracefully to a simpler algorithm rather than returning an empty array:
Requested Type
Fallback Order
bundle
bundle → also-bought → similar → trending
also-bought
also-bought → similar → trending
similar
similar → trending
personalized
personalized → trending
trending
trending (terminal — no further fallback)
When a fallback is used, the response’s fallbackUsed field contains the name of the algorithm that ultimately produced the results.