Skip to content

Autocomplete API

GET
View MD

The Autocomplete API provides search-as-you-type functionality. It is designed to return results quickly for incomplete search queries, suggesting items, categories, or other indexed content to the user as they type.

This endpoint supports several important features:

  • Typo correction: Handle misspelled terms gracefully.
  • Personalization: Re-rank results based on user history.
  • Filtering: Restrict suggestions to specific categories or attributes.

To request autocomplete results, provide your tracker ID, the user’s current query, and the object types you want to receive.

ParameterTypeRequiredDescription
tracker_idstringYour unique site identifier within Luigi’s Box.
qstringThe partial user query, for example iph.
typestringResult types and counts in the format type:count. Example: item:6,category:3.
ParameterTypeDescription
user_idstringIdentifier used for personalization. For authenticated users, use the analytics customer_id. For anonymous users, use the analytics client_id. Omit for non-personalized requests. See User identification and Events API common parameters.
client_idstringStable anonymous identifier. Must match the client_id sent in analytics. See Events API common parameters.
ParameterTypeDescription
f_type[]stringFilters results of a specific type. Format: f_<type>[]=<field>:<value>. Supports exact matches, OR logic with repeated parameters, and numeric or date ranges such as `price:10
neg_f_type[]stringExcludes results of a specific type. Format: neg_f_<type>[]=<field>:<value>, where <type> matches one of the requested result types. Supports repeated parameters and numeric or date ranges such as `price:10
sort_typestringSorts results of a specific type. Format: sort_<type>=<field>:<direction>, for example sort_item=price:asc.
prefer[]stringBoosts matching items without strictly filtering them. Format: prefer[]=<field>:<value>. Unlike f_type[], this applies to every requested result type.
ParameterTypeDescription
contextstringArbitrary placement context such as mobile_header or checkout_page. Use it to segment analytics by where the query originated.
ctx[]stringModel-selection context in key:value format, for example ctx[]=warehouse:berlin. Keys must match contexts defined in Analytics.
ParameterTypeDescription
hit_fieldsstringComma-separated list of fields to return, for example title,url,price. Request only what you render to reduce latency.
non_collapsed_variantsbooleanWhen true, returns all product variants instead of collapsing them into a parent hit. Default: false.
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/autocomplete/v2.
  2. Include tracker_id, the partial query q, and the desired type values.
  3. URL-encode query parameters correctly.
  4. Send Accept-Encoding: gzip, deflate for better performance.

For a step-by-step walkthrough, see Quickstart: Query Suggestions.

The response is a JSON object containing the requested hits and related metadata.

FieldTypeDescription
exact_match_hits_countintegerNumber of hits matching the query exactly.
partial_match_hits_countintegerNumber of hits matched through typo tolerance or partial matching.
partial_match_termsarrayTerms used during partial matching or typo correction.
hitsarrayThe list of result objects.
hits[].typestringType of the result object, for example item or category.
hits[].urlstringUnique identity of the result object.
hits[].updated_atstringISO 8601 timestamp of the last update.
hits[].attributesobjectIndexed fields for the result. Highlighted strings can include <em> tags, and raw values are often available as field.untouched.
hits[].pinnedbooleanPresent when the result was added by customization.
campaignsarrayActive banner or fixit campaigns for this query.
suggested_urlstringRedirect target when the query matches a redirect rule.

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.