Developer docs / Integrations
Search API
The storefront search and autocomplete endpoints, their parameters and answers, and the owner endpoints for the index.
In the dashboard: GET /api/search, GET /api/search/suggest, /api/owner/search/*
Why use it
Why: a headless storefront, an app or an agent needs the same search the store's own pages use, with its languages, synonyms, rules and ranking. How: two public endpoints on the store's address, and owner endpoints behind the owner token (Store APIs). The full schema is in the store's OpenAPI document at /api/openapi.json.
GET /api/search
Why: one call answers a results page: the products, the total, the filters with their counts, and how the words were understood. How: active products only, at most 60 searches per client address a minute (429 with Retry-After beyond).
| Parameter | What it does |
|---|---|
| q | The words, at most 200 characters. |
| exact=1 | Only what was typed (with word forms and synonyms): no translations, corrections or fallbacks. |
| attr.<key>=<value> | A text or boolean (true or false) attribute value; repeat for any of several. |
| attr.<key>.min, attr.<key>.max | A number attribute range. |
| price.min, price.max | In minor units (cents). |
| option.<name>=<value>, badge, stock=1, collection=<slug> | A variant option such as a colour, a badge, only in stock, a collection. |
| sort | relevance (default), newest, price, -price. |
| offset, limit | Paging: limit 1 to 48 (default 24), offset up to 10,000. |
The answer: products, total (at most 1,000), facets, price (the range), did_you_mean, stage (exact, translated, corrected, relaxed or popular), translated (the words searched in another language), dropped (the words left out), redirect (an address a rule sends these words to: open it instead of the results), truncated.
curl "https://<store>/api/search?q=office+chair&attr.colour=black&sort=relevance&limit=24"GET /api/search/suggest
Why: shoppers pick a suggestion while they type and never land on an empty page. How: from two characters, q and an optional locale (for prices). The answer: terms (popular searches and completions, each with how many products it finds), categories (collections with their size), up to four products (title, href, price, image), total and more (true when the words find more than total: show "200+"). Answers are the same for every shopper and kept a minute at the edge; 180 requests per client address a minute.
curl "https://<store>/api/search/suggest?q=cha&locale=de"Owner endpoints
| Endpoint | What it does |
|---|---|
| GET /api/owner/search | The same search over all products (status=all, active or hidden), limit up to 100. |
| GET /api/owner/search/index | The index: how many changed products wait, and the full reindex (status queued, running, done or failed; done and total products; reason; when it started and finished). Reading it also starts a reindex a new main language needs, and wakes one that stalled. |
| POST /api/owner/search/index/rebuild | Rebuild the whole index in the background (202). Searches use the current index until the new one is complete; a rebuild already running for the store's language goes on. |
| GET /api/owner/search/analyse?text=&locale= | What the analysers make of a text: its index words, and a query's forms and translations. |
| /api/owner/search/synonyms, stop-words, rules, weights, personalisation, tests | The settings of the dash pages (see the OpenAPI document). |
Reads per search
Why: the store's database bills every row a query reads, so a search's reads are its price. How: every search reads a bounded part of the index: at most 4,000 documents of each of two sets (title, collections and keywords; everything), ranked by bm25 with the field weights, then the best 1,000 products. On a 100,000-product store in four languages a search that finds 1,000 products reads about 40,000 to 65,000 rows, a precise one a few hundred; a suggestion 8,000 to 45,000 on a miss of the minute-long cache.