Skip to main content
The SearchService class (accessed via client.search) provides keyword search, type-ahead suggestions, and semantic search.

Methods

searchProducts

Fast, keyword-based search optimized for exact matches, SKUs, and product names. It uses case-insensitive partial matching to find relevant results quickly. Keyword search is available on every plan.
Response

Misspellings

When exact matching finds nothing, the query is retried against a similarity match over product names and brands, so a typo still reaches the product. Those results carry a matchReason of Similar name or Similar brand rather than Text match, which lets you label them — “showing results for snowboard” — instead of presenting an approximate match as an exact one. Exact matches always rank first: the fallback runs only when there were none, so a query that already worked behaves exactly as before.
Response

Synonyms

A merchant can declare words that mean the same (“sofa”, “couch”, “settee”) or a one-way pairing (“trainers” also finds “sneakers”, not the reverse). A query containing one of those words is also searched with each alternative: matches for the words typed rank first, followed by the matches each synonym adds.

Sentences

When neither the typed words, their synonyms nor the spelling match reach a product name, the query is read for its meaning. Words that carry none (“best”, “products”, “for”) are set aside, and the rest are matched against product names, brands, categories, subcategories, SKUs and tags, together with the products of a collection the query names. best products for summer finds the summer range. Those results carry a matchReason of Related to your search or In the <name> collection. client.products.listProducts({ search }) reads text the same way when its own name and SKU match finds nothing, so a search page and a product list agree.

Redirects

A merchant can send a query to one place: a page address, a collection, a category or a product. The response carries redirect beside the results, or null when there is none. The results are still returned; the storefront decides whether to navigate or to offer the destination as a suggestion.
Response
Redirects apply to a store’s own search. A search made with a marketplace operator key does not return redirect. Searching as a wholesale buyer. Pass b2b: true with a buyer’s session token. A search result is a reference to a product — an id, a score and a match reason — and carries no price, so this does not price anything. What it does is keep the response out of the caches, because a buyer’s results can be narrowed to the range they may order from and a narrowed set must not be served to anyone else. Fetch the priced page from listProducts({ b2b: true }).

autocompleteSearch

Suggestions for a partial query, for a search box that completes as the shopper types. Call it on each keystroke from the second character; it returns terms to suggest, not products, so run searchProducts once the shopper picks one. Suggestions come from what the store actually sells — its product names, its brands, and the merchant’s own subcategories — so there is nothing to configure and nothing that drifts from the catalogue. Each carries a kind so you can group or badge them. Prefixes match first, with similarity as a fallback, so a suggestion still appears when the first characters are already mistyped. Fewer than two characters returns an empty list with a 200 — a shopper mid-word has not done anything wrong.
Response
With a marketplace operator key the suggestions span every active merchant: merchants first, then categories, brands and products, a product whose name starts with the typed text ranking before one where it starts a later word. Merchant, category and product suggestions carry merchant_store_id, category_id, product_id and product_slug; product suggestions add merchant_store_name, thumbnail_url and price.

semanticSearch

AI-powered, meaning-based search that understands intent and context. This allows customers to find products using natural language descriptions even if they don’t know the exact product name. Semantic search belongs to the store’s plan. A store whose plan does not include it answers 403 feature_not_available; searchProducts and autocompleteSearch answer on every plan, so a storefront can fall back to them.
Key Support: Both Secret Keys and Publishable Keys are supported for semantic search, allowing you to implement AI-powered search directly in your frontend. With a marketplace operator key, storeId (also accepted as store_id in the body) narrows the search to one merchant of the marketplace; a store key ignores it.
Response

Synonyms and redirects

The store’s synonyms apply to the query, so the meaning the merchant declared is part of the match, and the response carries redirect exactly as searchProducts does. When the query cannot be embedded, or no result scores above minScore, the keyword search answers instead, with its synonyms and its reading of a sentence (see searchProducts). The store’s ranking by popularity, promotions and stock applies after the merchant’s rules.

Personalized results

Pass personalize: true together with a credential identifying the shopper to nudge results toward their preferences. Query relevance stays primary — relevance is blended with the shopper’s preference signal, not replaced — so results remain on-topic. Without a customer session, or for a shopper with no preference signal yet, ranking is by query relevance only. Send whichever credential matches how the shopper signed in — the same three this API accepts everywhere a shopper is identified: Personalization is best-effort: an absent, expired, or invalid credential returns unpersonalized results rather than an error, so search never fails because a session lapsed.

Merchandising

A merchant can place results deliberately for a query or a family of queries, from their own admin. There is nothing to request or configure on the client — the order you receive already reflects it, and a store with no rules behaves exactly as it did before. A rule matches a query either exactly or by substring, can be limited to a date range, and carries a priority that decides the winner where two rules overlap. Each rule can name up to twenty products. Rules reorder; they never conjure. They are applied after ranking and only to products the query already matched, so a rule cannot introduce an unrelated product, and a pinned product that has been deleted, taken offline, or is otherwise not sellable simply does not appear. Nothing a merchant hides becomes visible through a pin. One consequence is worth building for: a pinned product is fetched and merged in even if it ranked below the page you asked for, because “float it to the top” would otherwise do nothing for exactly the products a merchant most wants pinned. The limit you asked for is still honoured. A merchant can also turn on a ranking that, after the rules, lifts the products shoppers add to their carts most this week and those in a live buy-one-get-one or bundle offer or on sale, nudges down a product at or below the store’s low-stock level, and places sold-out products after the rest. Pinned results stay first and buried results stay last. This is also the merchant’s setting; nothing is requested on the client. Pinned and boosted results carry a matchReason of Featured by the store. That is the signal to build against if you want to distinguish a deliberate placement from an earned one:
Merchandising rules are authored in the merchant’s admin, not through this API — placing your own products in someone’s search results is not something an integration should be able to do. The API reflects the merchant’s decisions; it does not set them.

Comparison: Text vs. Semantic


Zero-Result Fallback: A powerful UX pattern is to first call searchProducts. If totalResults is 0, gracefully fallback to semanticSearch to suggest products that might still interest the user.

Why is semanticSearch a POST? POST /v1/search is intentionally accessible to publishable keys despite using the POST verb. It is a read-only operation — POST is used purely to support complex JSON request bodies (query, minScore, filters). No state is mutated and no 403 is returned for publishable keys.

Response Codes

All three methods accept publishable and secret keys. searchProducts and autocompleteSearch are GET; semanticSearch is POST (read-only).