Get product recommendations
AI-powered product recommendations. Supported types:
- similar: Products similar to a given product
- also-bought: Frequently purchased together. Each item indicates whether it is a complement (commonly bought alongside) or an alternative.
- next: The products a shopper is most likely to view or add next, given what they have
viewed/added in the current session. Pass
sessionId(the worker anchors on the shopper’s most recent product this session) and/or an explicitproductIdanchor. Falls back to also-bought, then trending, when there is no session signal. - trending: Currently trending products
- new: Recently added products
- personalized: Based on the signed-in shopper’s preferences. Identify the shopper with an
x-auth-token,x-external-auth, orx-idp-tokencredential header; with no valid credential the response falls back to trending. - bundle: Bundle suggestions. Items that complement the product are surfaced ahead of alternatives.
Minimum results. Every response is topped up to at least 8 products (capped at limit,
and at the number of active products in the store), so a storefront shelf never renders with
only one or two items. When the requested algorithm returns fewer than eight, the response is
backfilled — in order — from trending, engagement signals (views/adds-to-cart), featured
products, and newest arrivals, de-duplicated and excluding the anchor product; fallbackUsed
then includes backfill.
⚠️ SECRET KEY REQUIRED
This endpoint requires a secret key (tybrite_sk_*). Publishable keys will return 403 Forbidden.
Why Secret Key? Recommendation generation uses computational resources and accesses machine learning models that should be protected from unauthorized use. This prevents abuse and ensures fair resource allocation.
Marketplace operator keys. With a marketplace operator key, recommendations are computed
across all merchants in the marketplace; supported types: trending, new, also-bought,
similar, personalized, bundle, next. Each item is stamped with its source merchant
(merchant_store_id).
curl --request POST \
--url https://api.tybritelabs.com/v1/recommendations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "similar",
"productId": "7d425c0a-50e7-4e39-af79-6f7945f9dfa8",
"limit": 5
}
'{
"type": "similar",
"recommendations": [
{
"productId": "7d425c0a-50e7-4e39-af79-6f7945f9dfa8",
"score": 0.99,
"reason": "Similar product based on description and attributes",
"relation": "alternative",
"source": "similar"
},
{
"productId": "0186665f-f0a1-4c79-976a-919b5b1c2daa",
"score": 0.85,
"reason": "Similar product based on description and attributes",
"relation": "alternative",
"source": "similar"
}
],
"fromCache": true,
"computedAt": "2026-06-20T10:30:00Z"
}Authorizations
API Key Authentication
Use your API key in the Authorization header:
Authorization: Bearer tybrite_sk_live_YOUR_KEY
Key Types:
Secret Keys (Server-Side Only):
- Format:
tybrite_sk_live_*(production) ortybrite_sk_test_*(sandbox) - Full read/write access to all endpoints
- ⚠️ NEVER expose in client-side code or public repositories
- Required for: every write a shopper does not make for themselves, authentication, payment verification, AI recommendations
Publishable Keys (Client-Safe):
- Format:
tybrite_pk_live_*(production) ortybrite_pk_test_*(sandbox) - Catalogue reads, plus the actions a shopper takes for themselves
- ✅ Safe for client-side JavaScript, mobile apps, and public code
- Allowed for: browsing products, search, CMS content, pricing queries, cart and wishlist, reviews, storefront events, and the Agent API's quotes, cart drafts and checkout intents
Endpoint-Specific Requirements:
- Authentication endpoints (
/v1/auth/*): state-changingPOSTcalls require a secret key, for store and marketplace keys alike;GET /v1/auth/meaccepts either key - Payment verification (
POST /v1/payments/verify): Secret key required - AI Recommendations (
POST /v1/recommendations): Secret key required - Semantic Search (
POST /v1/search): Both key types allowed (read-only operation) - Shopper actions (cart, wishlist, reviews, storefront events, Agent API quotes, cart drafts and checkout intents): Both key types allowed
- All other write operations: Secret key required
- All read operations: Both key types allowed
Using a publishable key for restricted operations returns 403 Forbidden.
Limited publishable keys:
A publishable key can be limited to the products that carry one tag (for example starter:jewellery), created from
the store's Developers page. The limit applies to the key, never to the shopper: shopper sign-up and sign-in stay store-wide.
- Reads return only the slice: products (with their facets, filters, search, brands and specifications), categories and
subcategories that hold in-slice products, collections, promotions, posts and lookbooks that carry the tag, reviews of
in-slice products, prices, discovery lists and the store information summary, with every count computed on the slice.
A product outside the slice answers
404, as if it did not exist. - A write that names a product or variant outside the slice (adding to the cart or wishlist, reserving stock, an order line,
a review, a promotion calculation, a storefront event) answers
403with the error codeout_of_scope, and nothing is written or reserved. An order is refused as a whole. - A route that carries no slice behaviour is not available to the key: it answers
403withendpoint_not_allowed. - Orders placed through such a key record the tag on the order's attribution as
key_scope. - Secret keys and connected-app keys cannot be limited.
- Responses are cached per key limit: a limited key never receives a response cached for the whole store, and the reverse.
Headers
Session token of a customer signed in through Galactic Core. Used only when type is personalized, to identify the shopper the recommendations are for. Personalization is keyed to whoever this credential resolves to — a customer id in the request body is not accepted for this. An absent or invalid credential simply falls back to trending recommendations rather than returning an error.
Body
curl --request POST \
--url https://api.tybritelabs.com/v1/recommendations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "similar",
"productId": "7d425c0a-50e7-4e39-af79-6f7945f9dfa8",
"limit": 5
}
'{
"type": "similar",
"recommendations": [
{
"productId": "7d425c0a-50e7-4e39-af79-6f7945f9dfa8",
"score": 0.99,
"reason": "Similar product based on description and attributes",
"relation": "alternative",
"source": "similar"
},
{
"productId": "0186665f-f0a1-4c79-976a-919b5b1c2daa",
"score": 0.85,
"reason": "Similar product based on description and attributes",
"relation": "alternative",
"source": "similar"
}
],
"fromCache": true,
"computedAt": "2026-06-20T10:30:00Z"
}
