Autosuggest API

Learn to deliver real-time query suggestions and product previews to enhance on-site search and boost conversions.

Overview

The Autosuggest feature provides query suggestions that deliver faster results to your visitors on your site. Unbxd supports autocompleting search queries and showcasing products relevant to the query as they type. Usually, this feature comes in-built with the Unbxd Search, but you can also implement Unbxd Autosuggest as a standalone feature in your site. With Autosuggest, visitors can search for their intended products directly from your site’s search bar.

Autosuggest Endpoint

With Autosuggest, your visitors can easily search products directly from your site’s search bar.

  • Method: GET
  • Endpoint: https://search.unbxd.io/yourapikey/yoursitekey/autosuggest?

Sample Request

To integrate Unbxd Autosuggest, you need to make the following API call to Unbxd servers:

https://search.unbxd.io/yourapikey/yoursitekey/autosuggest?q=<value>&version=V2&inFields.count=<value>&popularProducts.count=<value>&keywordSuggestions.count=<value>&topQueries.count=<value>&promotedSuggestion.count=<value>&popularProducts.fields=<comma separated list of fields>&variants=<true|false>&filter=<filter_query>

Request Parameters

The table below describes the different API parameters for an autosuggest API call.

ParameterDescription
inFields.countDefines number of autosuggest results with doctype IN_FIELD. Default value: 2.
popularProducts.countDefines number of autosuggest results with doctype POPULAR_PRODUCTS. Default value: 3.
keywordSuggestions.countDefines number of autosuggest results with doctype KEYWORD_SUGGESTION. Default value: 2.
topQueries.countDefines number of autosuggest results with doctype TOP_QUERIES. Default value: 2.
popularProducts.fieldsReturns the fields required for popular products.
promotedSuggestion.countDefines the number of autosuggest results with doctype PROMOTED_SUGGESTION. Default value: 2.
popularProducts.filterRestrict the popular products based on field name criteria. Works like the filter parameter in Search/Browse API (only for autosuggest popularProducts).
popularProducts.filter-idRestrict the popular products based on field ID criteria. Works like the filter-id parameter in Search/Browse API (only for autosuggest popularProducts).
filterRestrict the products based on criteria passed using field-name.
spellcheckEnables spellcheck in autosuggest. When spellcheck=true, a did-you-mean block is returned (default: false).
versionMandatory. Version of the API. Only V2 is supported as V1 is deprecated.
variantsEnables or disables variants in the API response. Default value: false.
📘

NOTE

To read more about the aforementioned parameters, refer Search API.

Response Parameters

Unbxd returns the list of products which match the search criteria. The response would be in application/json or application/xml content type format.

The table below describes the different response keys of an autosuggest call.

Attribute NameTypeDescription
autosuggestStringThe query string suggested by Unbxd for the autosuggest.
doctypeEnumThe type of autosuggest. Possible values: POPULAR_PRODUCTS, TOP_SEARCH_QUERIES, PROMOTED_SUGGESTION, IN_FIELD, KEYWORD_SUGGESTION
unbxdAutosuggestSrcStringThe field on which the autosuggest string was generated (present only for IN_FIELD doctype results)
unbxdAutosuggestScoreFloatThe relevancy score given to the autosuggest string by Unbxd (not meant for client-side use)
uniqueIdStringRandom ID for each autosuggest string. For popular products, the format is popularProduct_<PRODUCT_ID>
_inListFields ending with _in are present for IN_FIELD doctype. E.g., brand_in contains all possible values of brand linked to the autosuggest
priceDecimalPrice of the suggested product (only applicable for popular products)
imageUrlLinkURL of the product’s thumbnail image (only for popular products)
productUrlLinkURL of the suggested product page (only for popular products)