Recommender API
POSTOverview
Section titled “Overview”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.
Features
Section titled “Features”- 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.
Request parameters
Section titled “Request parameters”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.
Query parameters
Section titled “Query parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
tracker_id | string | ✓ | Your unique site identifier within Luigi’s Box. |
Request body
Section titled “Request body”The request body is a JSON array of recommendation request objects. This allows you to batch multiple widgets in one HTTP call.
| Parameter | Type | Description |
|---|---|---|
recommendation_type | string | Required. Identifier of the recommender model, for example |
recommender_client_identifier | string | Arbitrary identifier for the widget location, such as |
user_id | string | User identifier used for personalization. For anonymous users, use a stable client identifier such as the |
item_ids | array | 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. |
size | integer | Number of items to return. Default: |
hit_fields | array | List of fields to return for each hit, for example |
blacklisted_item_ids | array | List of item IDs that must be excluded from the response. |
recommendation_context | object | Request-time filter object. Supports operators like |
settings_override | object | Overrides model settings for this request, for example changing the availability field in a multi-warehouse setup. |
mark_fallback_results | boolean | When |
Request headers
Section titled “Request headers”| Header | Value | Required | Description |
|---|---|---|---|
Content-Type | application/json; charset=utf-8 | ✓ | Indicates JSON request format. |
Accept-Encoding | gzip, deflate | Recommended | Enables compressed responses. |
How to Make a Request
Section titled “How to Make a Request”To make a valid recommendation request:
- Send a
POSTrequest tohttps://live.luigisbox.com/v1/recommend. - Put
tracker_idin 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.
Response structure
Section titled “Response structure”The response is a JSON array in the same order as the request objects you sent.
Response attributes
Section titled “Response attributes”| Field | Type | Description |
|---|---|---|
recommendation_id | string | Unique identifier for the generated recommendation batch. |
recommendation_type | string | Recommender model used for this result set. |
recommender_client_identifier | string | Widget identifier echoed from the request. |
hits | array | List of recommended items. |
hits[].type | string | Usually item. |
hits[].url | string | Identity of the recommended product. |
hits[].attributes | object | Product data such as title, price, and image fields. |
hits[].pinned | boolean | Present when the result was added by customization. |
generated_at | string | Generation timestamp. |
Error handling
Section titled “Error handling”The API uses standard HTTP status codes to indicate success or failure. All error responses are returned as a JSON array.
| Status | Description |
|---|---|
200 OK | Success. The body contains recommendation results. |
400 Bad Request | Malformed JSON, wrong content type, or missing required parameters. |
404 Not Found | The tracker_id or recommendation_type could not be matched. |
405 Method Not Allowed | The endpoint only accepts POST requests. |
500 Server Error | Internal error. If persistent, contact support. |
Was this page helpful?
Thanks.