Semantic search products

Search published products using semantic vector embeddings. This is intended for "concerns" style queries (e.g. acne, hyperpigmentation, hydration) and returns products ranked by cosine similarity to the query embedding — strongest match first.

Default behavior (no limit, no min_similarity): every published product that matches the SQL filters (vendor, product_ids) is scored and returned in ranked order. Ranking does the work — the frontend can render the top N and "show more" the tail without a second call. No server-side cap, no pagination. Same query returns the same ordering on repeat calls (deterministic).

Optional knobs:

  • limit — client-side trim. Returns the top N by similarity. Omit to get everything.
  • min_similarity — hard floor on cosine similarity. Products below the floor are dropped server-side. When nothing clears the floor, the response is data: [] (no synthetic-fit fallback). Defaults to no floor (config value embeddings.search.min_similarity, currently -1.0). Recommended values depend on catalog density and embedding model — start at -1 and tighten only if the long tail is noisy for your use case.

Scoping: restrict to a single vendor (vendor_id) or an explicit allow-list (product_ids). For vendor/staff users, results are automatically restricted to the authenticated vendor regardless of any vendor_id they send.

fit_percentage in each result is round(similarity × 100). Absolute values are catalog-relative — in a focused single-domain catalog, even the genuine top match may score in the 60s-70s. Treat fit_percentage as a ranking signal, not an absolute quality score.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Query Params
string
required
length between 2 and 512

Natural language search query (concerns, ingredients, benefits, etc.)

integer

Optional vendor ID to restrict results to that vendor (ignored for vendor/staff users)

product_ids
array of integers

Optional allow-list of product IDs to search within (max 500)

product_ids
exclude_product_ids
array of integers

Optional deny-list of product IDs to leave out of the results (max 500). Pass the IDs of products already shown so a repeated query returns fresh results ("show me different ones"). Unknown or stale IDs are ignored rather than rejected.

exclude_product_ids
integer
≥ 1

Optional client-side truncation. When omitted, returns every product that clears min_similarity (no server-side cap). When supplied, returns the top N by similarity. Use min_similarity to filter by quality.

number
-1 to 1

Optional cosine-similarity floor in [-1, 1]. Products below the threshold are dropped. Default is no floor — ranking already surfaces the best matches at the top, so most callers should omit this unless they want to hard-cut the long tail server-side. Tune empirically per catalog; there is no universal "good" value.

number
≥ 0

Optional upper price bound in the catalogue currency. Only products at or below this price are returned.

number
≥ 0

Optional lower price bound in the catalogue currency. Only products at or above this price are returned.

string
length ≤ 255

Optional product category name to restrict results to (case-insensitive partial match).

Responses

Language
Credentials
Bearer
JWT
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json