Skip to content

Top Items API

GET
View MD

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.

To request global top items, provide your tracker ID and the object types you want returned.

ParameterTypeRequiredDescription
tracker_idstringYour unique site identifier within Luigi’s Box.
typestringResult types and counts in the format type:count, for example item:6,category:3.
ParameterTypeDescription
f_type[]string

Filters results for a specific type in the format f_<type>[]=<field>:<value>. Supports exact matches, repeated OR filters, and ranges such as price:10|50.

hit_fieldsstring

Comma-separated list of fields to return, for example title,url,price.

ctx[]string

Model-selection context in key:value format, for example ctx[]=warehouse:berlin. Keys must match contexts reported in Analytics.

HeaderValueRequiredDescription
Accept-Encodinggzip, deflateRecommendedEnables compressed responses to reduce payload size.

To make a valid request:

  1. Send a GET request to https://live.luigisbox.com/v1/top_items.
  2. Provide tracker_id and the requested type counts.
  3. Add filters or model context only when needed for the placement.

For implementation guidance, see Quickstart: Top Items API.

The response is a JSON object containing the resulting items.

FieldTypeDescription
hitsarrayThe list of returned objects.
hits[].typestringObject type, for example item or category.
hits[].urlstringUnique identity of the result object.
hits[].attributesobjectIndexed fields such as title, price, or image links.
hits[].pinnedbooleanPresent when the result was added by customization.
hits[].exactbooleanIndicates whether the result is an exact match.

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.
ParameterTypeRequiredDescription
tracker_idstringYour site identifier.
user_idstringUser ID to personalize for.
typestringRequested object types and counts.
ParameterTypeDescription
ctx[]stringModel-selection context parameters.

Include the user_id parameter whenever you want Luigi’s Box to rank results for a specific user profile.

The API uses standard HTTP status codes to indicate success or failure.

HTTP StatusDescription
200 OKThe request succeeded and results are returned.
400 Bad RequestThe request was malformed — missing or invalid parameters.
404 Not FoundThe tracker_id does not match any known catalog.
500 Server ErrorInternal error. If persistent, contact support.
504 Gateway TimeoutThe request took too long to process. Retrying may succeed.