Top Items API
GETOverview
Section titled “Overview”The Top Items API returns the most popular or most relevant objects from the index, even when the user has not entered a search query. It is commonly used for “popular items” or “recommended for you” widgets.
Request parameters
Section titled “Request parameters”To request global top items, provide your tracker ID and the object types you want returned.
Required parameters
Section titled “Required parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
tracker_id | string | ✓ | Your unique site identifier within Luigi’s Box. |
type | string | ✓ | Result types and counts in the format type:count, for example item:6,category:3. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Description |
|---|---|---|
f_type[] | string | Filters results for a specific type in the format |
hit_fields | string | Comma-separated list of fields to return, for example |
ctx[] | string | Model-selection context in |
Request headers
Section titled “Request headers”| Header | Value | Required | Description |
|---|---|---|---|
Accept-Encoding | gzip, deflate | Recommended | Enables compressed responses to reduce payload size. |
How to Make a Request
Section titled “How to Make a Request”To make a valid request:
- Send a
GETrequest tohttps://live.luigisbox.com/v1/top_items. - Provide
tracker_idand the requestedtypecounts. - Add filters or model context only when needed for the placement.
For implementation guidance, see Quickstart: Top Items API.
Response structure
Section titled “Response structure”The response is a JSON object containing the resulting items.
Response attributes
Section titled “Response attributes”| Field | Type | Description |
|---|---|---|
hits | array | The list of returned objects. |
hits[].type | string | Object type, for example item or category. |
hits[].url | string | Unique identity of the result object. |
hits[].attributes | object | Indexed fields such as title, price, or image links. |
hits[].pinned | boolean | Present when the result was added by customization. |
hits[].exact | boolean | Indicates whether the result is an exact match. |
Get personalized top items
Section titled “Get personalized top items”Use this endpoint to retrieve recommendations based on a specific user’s history.
- For standard item recommendations, request
type=item:10. - If you request
type=queries, the endpoint returns the last queries performed by that user.
Request parameters (personalized)
Section titled “Request parameters (personalized)”Required parameters
Section titled “Required parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
tracker_id | string | ✓ | Your site identifier. |
user_id | string | ✓ | User ID to personalize for. |
type | string | ✓ | Requested object types and counts. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Description |
|---|---|---|
ctx[] | string | Model-selection context parameters. |
How to Make a Personalized Request
Section titled “How to Make a Personalized Request”Include the user_id parameter whenever you want Luigi’s Box to rank results for a specific user profile.
Error handling
Section titled “Error handling”The API uses standard HTTP status codes to indicate success or failure.
| HTTP Status | Description |
|---|---|
200 OK | The request succeeded and results are returned. |
400 Bad Request | The request was malformed — missing or invalid parameters. |
404 Not Found | The tracker_id does not match any known catalog. |
500 Server Error | Internal error. If persistent, contact support. |
504 Gateway Timeout | The request took too long to process. Retrying may succeed. |
Was this page helpful?
Thanks.