Search API
One endpoint answers every search, the widget’s and yours: from your server, a native app or a UI you build yourself. This page lists its parameters, what it returns and the endpoints beside it. Keys, regions, errors and rate limits are on API basics.
POST https://search.typemo.com/v1/collections/{collectionId}/searchGET https://search.typemo.com/v1/collections/{collectionId}/searchUse a Read only key. From a browser, call your region’s address, not search.typemo.com:
Regions explains why.
A first request
Section titled “A first request”curl -sL "https://search.typemo.com/v1/collections/{collectionId}/search" \ -H "X-API-Key: sq_your_key" \ -H "Content-Type: application/json" \ -d '{ "q": "sneakers", "perPage": 5 }'{ "q": "sneakers", "found": 3, "page": 1, "perPage": 5, "hits": [{ "id": "1001", "title": "Court Sneakers", "price": 79.99, "_score": 5.34 }], "facets": { "category": [["Footwear", 3]] }, "facetStats": { "price": { "min": 49.99, "max": 79.99 } }, "fallback": null, "correctedQuery": null, "redirect": null, "banner": null}Typo tolerance, synonyms, your merchandising and the rest of how search works apply exactly as in the widget. Every request counts in analytics like any other search.
Parameters
Section titled “Parameters”POST takes them as a JSON body. GET takes the same names as query parameters: lists
comma-separated, filter as URL-encoded JSON.
| Name | Type | What it does | Default |
|---|---|---|---|
q | string | The search text. Empty or * browses the whole collection. Only the first 32 words, up to 200 characters, are searched. | * |
filter | object | Conditions on document fields. See Filters. | None |
sort | string | field:asc or field:desc, such as price:asc. | Relevance |
page | integer | The page, from 1. | 1 |
perPage | integer | Results per page, 1–100. | 10 |
facets | string[] | Fields to count values of, on top of the filters set in the dashboard. Unknown names are ignored. | The dashboard’s |
maxFacetValues | integer | Values returned per facet. | 100 |
unavailableFacetValues | boolean | Keeps the facet values the other filters rule out, marked "unavailable". Costs more per search; ignored on a field that holds lists. | false |
groupBy | string | One result per value of this field, such as one card per product across its variants. Each hit carries _groupFound. | None |
includeFields | string[] | The fields to return. id and _score always come back. Keeps responses small when documents carry long text. | Every field |
highlightFields | string[] | Text fields to highlight. Each hit carries _highlight with the matches marked up. | None |
mode | string | auto, text, hybrid or vector. vector needs vector (POST only), documentId or q. | auto |
queryType | string | keywords or question: how the query’s words are matched. See Questions. | keywords |
documentId | string | With mode: "vector": return similar items. | None |
pinIds | string[] | Document ids shown first, in this order. With pinsOnly: true, only they come back. | None |
autocomplete | boolean | Adds query completions to the response. See Autocomplete and suggestions. | false |
lang | string | The query’s language tag, for analytics and suggestions. | The collection’s language |
session | string | Your visitor’s session id, so analytics can tie this search to that visitor’s clicks. Also accepted as an X-Session-Id header. | None |
Response
Section titled “Response”| Field | What it holds |
|---|---|
q, page, perPage | The request, as searched. |
found | How many documents match. |
hits | The page of documents, with the fields you indexed. |
hits[]._score | How well the hit matches, with your boosts and popularity counted in. Compare scores within one response, not across queries. |
facets | Each categorical field’s values as [value, count] pairs. With unavailableFacetValues, a third element "unavailable" marks a value the other filters rule out. |
facetStats | Each numeric field’s { min, max }. |
fallback | On a search that finds nothing: your popular items as { hits, found }, to show instead. Otherwise null. |
correctedQuery | The corrected words when a typo was fixed to find the results. Otherwise null. |
redirect | The page a custom result sends this query to: open it when the visitor submits the search. Otherwise null. |
banner | The banner set for this search, shown above the results: title, imageUrl, mobileImageUrl, link, openInNewTab. Otherwise null. |
autocomplete | Only with autocomplete: true. |
Without a sort, hits that match every word come first, and hits that match part of the query
follow.
Filters
Section titled “Filters”A condition is { field, op, value }. Group conditions with AND, OR and NOT:
{ "q": "sneakers", "filter": { "AND": [ { "field": "brand", "op": "in", "value": ["Stride", "Acme"] }, { "field": "price", "op": "lte", "value": 100 }, { "NOT": { "field": "title", "op": "contains", "value": "kids" } } ] }}op | Meaning |
|---|---|
eq | Equals |
neq | Doesn’t equal |
gt | Greater than |
gte | Greater than or equal |
lt | Less than |
lte | Less than or equal |
in | Any of a list |
nin | None of a list |
contains | The phrase appears in a text field |
| Rule | What happens |
|---|---|
A value of another type than the field, such as "10" on a number field | It is read as the field’s type: "10" becomes 10. |
| A field that holds a list | It takes eq, in and nin. |
contains inside an OR or a NOT group | 400. Use it at the top level or inside AND. |
| An unknown field, an operator the field type doesn’t take, a value that doesn’t fit | 400, so a typo never comes back as unfiltered results. |
Questions
Section titled “Questions”By default a search treats the query as keywords: documents with every word come first. Send
queryType: "question" when the query is a sentence, from a person or from an AI agent, and the
documents are long: articles, help pages, a knowledge base.
curl -sL "https://search.typemo.com/v1/collections/{collectionId}/search" \ -H "X-API-Key: sq_your_key" \ -H "Content-Type: application/json" \ -d '{ "q": "how do I move my shop to another domain without losing rankings", "queryType": "question" }'| Rule | What happens |
|---|---|
| Order | Documents are ordered by how well they cover the question’s words. No document needs every word. |
found | Counts every document with at least one of the words, so it is larger than with keywords. |
| One-word query | The same results as keywords. |
| Product catalogs | Keep keywords: with question, a product with one word of three can rank above one with all three. |
mode | Combines with it: hybrid adds matches by meaning to either type. |
| Everything else | Typo correction, synonyms, filters, facets and your rules work the same. |
Similar items
Section titled “Similar items”On a collection with semantic search, mode: "vector" with a documentId
returns the products that look most like that one, for a “similar products” row:
curl -sL "https://search.typemo.com/v1/collections/{collectionId}/search" \ -H "X-API-Key: sq_your_key" \ -H "Content-Type: application/json" \ -d '{ "mode": "vector", "documentId": "1001", "perPage": 6 }'| Rule | What happens |
|---|---|
| What it compares | First photos, once the collection has photo vectors: the Image field mapped and the vectors regenerated since. Otherwise the meaning of the text. |
| The document itself | Left out. |
groupBy with your variant field | The document’s other variants are left out too, and each other product comes back once. |
filter | Applies. |
| Order | By closeness alone, with no boosts. |
| An unknown id, or a product without a photo vector | An empty hits. |
Autocomplete and suggestions
Section titled “Autocomplete and suggestions”With autocomplete: true and a non-empty q, the response carries an autocomplete object:
completions based on what your visitors search for, plus a related group of related terms.
Before the visitor types, show popular searches from their own endpoint. It isn’t billed as a search:
GET https://search.typemo.com/v1/collections/{collectionId}/suggestions| Parameter | What it does |
|---|---|
q | Only the searches that start with or contain this text. |
limit | How many to return. |
locale | The language whose searches to return. |
Analytics events
Section titled “Analytics events”The widget reports clicks and purchases for you. A UI of your own reports them here, so analytics and popularity reflect your visitors:
POST https://search.typemo.com/v1/collections/{collectionId}/eventsEvery event carries type and sessionId, and optionally deviceType.
type | Fields |
|---|---|
search | query, resultsCount. Send it for the query the visitor settled on. |
click | docId, position; optionally query, docTitle and searchEventId, the X-Search-Event-Id of the search the click came from. |
add_to_cart | docId; optionally clickEventId. |
purchase | docId, value as a decimal string such as "79.99", currency as a three-letter code; optionally clickEventId and purchaseId. One purchaseId counts once per document. |
An event with a field that is missing, too long or of the wrong type gets 400, and nothing is
recorded.
Response headers
Section titled “Response headers”| Header | What it holds |
|---|---|
X-Search-Time-Ms | How long the search took. |
X-Search-Count | How many documents match, the same as found. |
X-Search-Event-Id | This search’s id. Send it as searchEventId with a click. |
X-RateLimit-Limit, X-RateLimit-Reset | Requests one IP may make per minute, and when the minute ends. See Rate limits. |
X-Typemo-Stale | 1 when a GET search was answered from a saved copy because search was briefly unavailable. |
Errors
Section titled “Errors”Errors follow the shape on API basics. A search answers 400 for a
bad filter, sort, perPage, groupBy or highlightFields, and for a POST body that isn’t a
JSON object.
Next: Push over the API to send your catalog, or the TypeScript SDK for a typed client.