Autosuggest

The Autosuggest API provides real-time, relevant, and trending suggestions to users as they type, significantly enhancing the search experience. The API returns two suggestion types, which you can request together or separately:

  • Query suggestions: Popular search terms that complete what the user types.
  • Product suggestions: Products from your feed that match what the user types, with the product data you need to render them.

Autosuggest API is designed to maximize search efficiency and user satisfaction by:

  • Guiding users: Directing users toward popular and desired search results, or straight to a product.
  • Reducing effort: Minimizing the required typing effort for users.
  • Improving efficiency: Accelerating the overall search process and conversion.

Query Suggestions

Query suggestions are dynamically generated based on a combination of search frequency and contextual signals, ensuring high relevance. The API surfaces only meaningful and popular queries. The underlying data is collected from real search interactions, processed daily, and rigorously filtered.

Trending vs. Query autocomplete

The API supports two distinct suggestion modes based on the user's input:

  • Query autocomplete: When the API is called with 3 or more characters in the query.text field, the response provides relevant suggestions to complete the user's current search term.
  • Trending suggestions: If the API is called with an empty query.text field (or fewer than 3 characters, which is the minimum threshold), the response includes the most trending/popular terms for the locale, often used to populate a "hot searches" section

Data filtering and quality

Suggestions are filtered based on the following criteria to ensure high quality:

  • Length, frequency, and engagement: Terms that are too rare, too short, or lack sufficient engagement (clicks) are excluded.
  • Blocked terms: Inappropriate or irrelevant terms can be explicitly excluded from the results.

To maintain suggestion quality and relevance, the following minimum thresholds apply by default:

RequirementThreshold
Minimum input length3 characters are required for a suggestion to appear
Minimum search frequency50 searches recorded in the last 30 days
Minimum engagement1 click on a product returned by the search term

Data refresh

Query performance data is refreshed at least once every 48 hours using a sliding window of the last 30 days of data.

Note: If your use case requires different thresholds or specific configurations, contact your Customer Success Manager for assistance.

Product suggestions

Product suggestions return products from your product feed that match the user’s input, enabling you to show products directly in the search box before the user submits a query. Unlike query suggestions, product suggestions are matched against your catalog in real time, so products can be suggested as soon as they are available in the feed. No search history is required.

Trending vs. matching products

  • Trending products: When query.text is empty or contains 1–2 characters, the response includes the store’s most popular products. Use these to populate the search box when it receives focus.
  • Matching products: When query.text contains 3 or more characters, the response includes products whose searchable fields match the input. Every word in the input must match, and the last word is treated as a prefix. For example, hobo b matches hobo bag.

How products are matched

Products are matched against the searchable fields defined in your Search Textual Attributes, such as name, brand, categories, and keywords. Each word can match a different field. For example, black top can match the color in one field and the product type in another.

If an exact match returns no results, the API retries with progressively looser matching, within the same latency budget:

  1. Fuzzy match: Allows one typo per word and matches hyphenated and non-hyphenated forms (for example, t shirt and t-shirt).
  2. Relaxed match: For input containing two or more words, allows one word to be missing from the product.

Retries run only when the previous step returns no results, so a typical request requires a single lookup. If no step finds a matching product, the productSuggestions array is empty.

Ranking and deduplication

  • Ranking: Products are ranked first by how closely the text matches, and then by popularity within each match tier.
  • One suggestion per product: Variants from the same grouping column defined in your product feed are grouped into a single suggestion. For example, a request for 20 results returns 20 different products.
  • Language: context.page.locale selects the product text for that locale from the feed (for example, en_CA or es_MX). If the feed doesn't contain text for the specified locale, the feed’s default language is used.
  • Fixed ranking: Product suggestions use the same tested ranking for every site. Ranking overrides, such as priority factors, aren’t supported and are rejected.

API Integration

Request structure

The Autosuggest API request maintains the same structure as the Search API for seamless integration and compatibility. The main difference is the inclusion of the suggestions array within the query object: Add one entry per suggestion type you want returned, with the maximum number of results for each.

Sample request

{ 
  "user": { 
    "active_consent_accepted": false, 
    "dyid": "11", 
    "dyid_server": "111" 
  }, 
  "session": { 
    "dy": "111" 
  }, 
  "query": { 
    "text": "bag", 
    "suggestions": [ 
      { 
        "type": "querySuggestions", 
        "maxResults": 6 
      }, 
      { 
        "type": "productSuggestions", 
        "maxResults": 4 
      } 
    ] 
  }, 
  "options": { 
    "productData": { 
      "fieldFilter": ["sku", "name", "price", "url", "image_url"] 
    } 
  }, 
  "context": { 
    "page": { 
      "locale": "en_US" 
    } 
  } 
} 

Response structure

The API returns each requested suggestion type in its own array under suggestions. Query suggestions are ranked by relevance and popularity. Each product suggestion contains the product’s feed attributes as requested. The attributes returned are controlled by options.productData.

Sample response

{ 
  "variations": [ 
    { 
      "payload": { 
        "data": { 
          "suggestions": { 
            "querySuggestions": [ 
              { "term": "bag" }, 
              { "term": "bag strap" }, 
              { "term": "bag charm" }, 
              { "term": "bags for women" }, 
              { "term": "backpack" }, 
              { "term": "baguette bag" } 
            ], 
            "productSuggestions": [ 
              { 
                "productData": { 
                  "sku": "48783517843697", 
                  "name": "Lock Hobo Bag", 
                  "price": 59.95, 
                  "url": "https://www.example.com/products/lock-hobo-bag", 
                  "image_url": "https://cdn.example.com/images/lock-hobo-bag.jpg" 
                }
              },
              { 
                "productData": { 
                  "sku": "48783518236913", 
                  "name": "Crossbody Bag", 
                  "price": 79.95, 
                  "url": "https://www.example.com/products/crossbody-bag", 
                  "image_url": "https://cdn.example.com/images/crossbody-bag.jpg" 
                }
              },
              { 
                "productData": { 
                  "sku": "48783519102341", 
                  "name": "Mini Bucket Bag", 
                  "price": 49.95, 
                  "url": "https://www.example.com/products/mini-bucket-bag", 
                  "image_url": "https://cdn.example.com/images/mini-bucket-bag.jpg" 
                }
              },
              { 
                "productData": { 
                  "sku": "48783520377809", 
                  "name": "Leather Tote Bag", 
                  "price": 129.95, 
                  "url": "https://www.example.com/products/leather-tote-bag", 
                  "image_url": "https://cdn.example.com/images/leather-tote-bag.jpg" 
                }
              }
            ]
          }
        }
      }
    }
  ]
}

Technical specifications and limits

ParameterQuery suggestionsProduct suggestionsNotes
Minimum character input33Suggestions aren't returned until the input meets this length
maxResults1–20
default: 8
1–20
default: 8
If omitted, 8 results are returned
Target latency50–100 msUp to 150 ms
Rate limitNoneNoneNo rate limits are currently applied to the Autosuggest API

Note: The Autosuggest API does not maintain logs of requests or responses.

Configuration adjustments: If you need to request adjustments to any of these defaults (for example, higher results limits or custom performance thresholds), contact your Customer Success Manager.


Did this page help you?