Skip to content

Recommender API

POST
View MD

The Recommender API lets you retrieve personalized product suggestions, alternatives, and bestsellers programmatically. It is designed to return recommendation results based on user behavior, item similarity, popularity, and context.

  • Flexible batching: Request multiple recommenders in a single API call.
  • Context awareness: Restrict recommendations with request-time filters.
  • Business logic support: Override settings for scenarios like warehouse-specific availability.

To get recommendations, send a POST request to the endpoint. The tracker_id is passed as a query parameter and the recommendation definition is sent in the JSON body.

ParameterTypeRequiredDescription
tracker_idstringYour unique site identifier within Luigi’s Box.

The request body is a JSON array of recommendation request objects. This allows you to batch multiple widgets in one HTTP call.

ParameterTypeDescription
recommendation_typestring

Required. Identifier of the recommender model, for example bestsellers or item_detail_alternatives. See Reference Models.

recommender_client_identifierstring

Arbitrary identifier for the widget location, such as homepage_hero or cart_cross_sell.

user_idstring

User identifier used for personalization. For anonymous users, use a stable client identifier such as the _lb cookie. For logged-in users, use your own customer ID.

item_idsarray

List of item IDs the recommendation should be based on. Required for contextual models such as alternatives or related items. Only the first 10 values are used.

sizeinteger

Number of items to return. Default: 10. Maximum: 50.

hit_fieldsarray

List of fields to return for each hit, for example [“title”, “url”, “price”].

blacklisted_item_idsarray

List of item IDs that must be excluded from the response.

recommendation_contextobject

Request-time filter object. Supports operators like or, and, not, and range values using the pipe character.

settings_overrideobject

Overrides model settings for this request, for example changing the availability field in a multi-warehouse setup.

mark_fallback_resultsboolean

When true, the response indicates whether a result came from the primary model or a fallback strategy.

HeaderValueRequiredDescription
Content-Typeapplication/json; charset=utf-8Indicates JSON request format.
Accept-Encodinggzip, deflateRecommendedEnables compressed responses.

To make a valid recommendation request:

  • Send a POST request to https://live.luigisbox.com/v1/recommend.
  • Put tracker_id in the query string.
  • Send one or more recommendation request objects in a JSON array.
  • Use batching whenever you need recommendations for multiple widgets on the same page.

The response is a JSON array in the same order as the request objects you sent.

FieldTypeDescription
recommendation_idstringUnique identifier for the generated recommendation batch.
recommendation_typestringRecommender model used for this result set.
recommender_client_identifierstringWidget identifier echoed from the request.
hitsarrayList of recommended items.
hits[].typestringUsually item.
hits[].urlstringIdentity of the recommended product.
hits[].attributesobjectProduct data such as title, price, and image fields.
hits[].pinnedbooleanPresent when the result was added by customization.
generated_atstringGeneration timestamp.

The API uses standard HTTP status codes to indicate success or failure. All error responses are returned as a JSON array.

StatusDescription
200 OKSuccess. The body contains recommendation results.
400 Bad RequestMalformed JSON, wrong content type, or missing required parameters.
404 Not FoundThe tracker_id or recommendation_type could not be matched.
405 Method Not AllowedThe endpoint only accepts POST requests.
500 Server ErrorInternal error. If persistent, contact support.