Skip to content

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}/search
GET https://search.typemo.com/v1/collections/{collectionId}/search

Use a Read only key. From a browser, call your region’s address, not search.typemo.com: Regions explains why.

Terminal window
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 }'
Response (abridged)
{
"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.

POST takes them as a JSON body. GET takes the same names as query parameters: lists comma-separated, filter as URL-encoded JSON.

NameTypeWhat it doesDefault
qstringThe search text. Empty or * browses the whole collection. Only the first 32 words, up to 200 characters, are searched.*
filterobjectConditions on document fields. See Filters.None
sortstringfield:asc or field:desc, such as price:asc.Relevance
pageintegerThe page, from 1.1
perPageintegerResults per page, 1–100.10
facetsstring[]Fields to count values of, on top of the filters set in the dashboard. Unknown names are ignored.The dashboard’s
maxFacetValuesintegerValues returned per facet.100
unavailableFacetValuesbooleanKeeps the facet values the other filters rule out, marked "unavailable". Costs more per search; ignored on a field that holds lists.false
groupBystringOne result per value of this field, such as one card per product across its variants. Each hit carries _groupFound.None
includeFieldsstring[]The fields to return. id and _score always come back. Keeps responses small when documents carry long text.Every field
highlightFieldsstring[]Text fields to highlight. Each hit carries _highlight with the matches marked up.None
modestringauto, text, hybrid or vector. vector needs vector (POST only), documentId or q.auto
queryTypestringkeywords or question: how the query’s words are matched. See Questions.keywords
documentIdstringWith mode: "vector": return similar items.None
pinIdsstring[]Document ids shown first, in this order. With pinsOnly: true, only they come back.None
autocompletebooleanAdds query completions to the response. See Autocomplete and suggestions.false
langstringThe query’s language tag, for analytics and suggestions.The collection’s language
sessionstringYour visitor’s session id, so analytics can tie this search to that visitor’s clicks. Also accepted as an X-Session-Id header.None
FieldWhat it holds
q, page, perPageThe request, as searched.
foundHow many documents match.
hitsThe page of documents, with the fields you indexed.
hits[]._scoreHow well the hit matches, with your boosts and popularity counted in. Compare scores within one response, not across queries.
facetsEach categorical field’s values as [value, count] pairs. With unavailableFacetValues, a third element "unavailable" marks a value the other filters rule out.
facetStatsEach numeric field’s { min, max }.
fallbackOn a search that finds nothing: your popular items as { hits, found }, to show instead. Otherwise null.
correctedQueryThe corrected words when a typo was fixed to find the results. Otherwise null.
redirectThe page a custom result sends this query to: open it when the visitor submits the search. Otherwise null.
bannerThe banner set for this search, shown above the results: title, imageUrl, mobileImageUrl, link, openInNewTab. Otherwise null.
autocompleteOnly with autocomplete: true.

Without a sort, hits that match every word come first, and hits that match part of the query follow.

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" } }
]
}
}
opMeaning
eqEquals
neqDoesn’t equal
gtGreater than
gteGreater than or equal
ltLess than
lteLess than or equal
inAny of a list
ninNone of a list
containsThe phrase appears in a text field
RuleWhat happens
A value of another type than the field, such as "10" on a number fieldIt is read as the field’s type: "10" becomes 10.
A field that holds a listIt takes eq, in and nin.
contains inside an OR or a NOT group400. 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 fit400, so a typo never comes back as unfiltered results.

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.

Terminal window
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" }'
RuleWhat happens
OrderDocuments are ordered by how well they cover the question’s words. No document needs every word.
foundCounts every document with at least one of the words, so it is larger than with keywords.
One-word queryThe same results as keywords.
Product catalogsKeep keywords: with question, a product with one word of three can rank above one with all three.
modeCombines with it: hybrid adds matches by meaning to either type.
Everything elseTypo correction, synonyms, filters, facets and your rules work the same.

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:

Terminal window
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 }'
RuleWhat happens
What it comparesFirst photos, once the collection has photo vectors: the Image field mapped and the vectors regenerated since. Otherwise the meaning of the text.
The document itselfLeft out.
groupBy with your variant fieldThe document’s other variants are left out too, and each other product comes back once.
filterApplies.
OrderBy closeness alone, with no boosts.
An unknown id, or a product without a photo vectorAn empty hits.

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
ParameterWhat it does
qOnly the searches that start with or contain this text.
limitHow many to return.
localeThe language whose searches to return.

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}/events

Every event carries type and sessionId, and optionally deviceType.

typeFields
searchquery, resultsCount. Send it for the query the visitor settled on.
clickdocId, position; optionally query, docTitle and searchEventId, the X-Search-Event-Id of the search the click came from.
add_to_cartdocId; optionally clickEventId.
purchasedocId, 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.

HeaderWhat it holds
X-Search-Time-MsHow long the search took.
X-Search-CountHow many documents match, the same as found.
X-Search-Event-IdThis search’s id. Send it as searchEventId with a click.
X-RateLimit-Limit, X-RateLimit-ResetRequests one IP may make per minute, and when the minute ends. See Rate limits.
X-Typemo-Stale1 when a GET search was answered from a saved copy because search was briefly unavailable.

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.