Search API Routes

Search the indexes that your application exposes to the storefront.

An index is only searchable through these API routes once it's allowed with the configureStoreSearch middleware.

POST /store/search#

Search Indexes

Search the indexes that your application exposes to the storefront. An index is only searchable through this route once it's allowed with the configureStoreSearch middleware, and a query for any other index is answered with a 404 error. Pass a single query, or a queries array to run a batch of queries in one round-trip to the search engine. For an index whose entity is product, Medusa also restricts the results to published products in the sales channels of the request's publishable API key.

Authentication: none.

Header parameters

x-publishable-api-keystring
Publishable API Key created in the Medusa Admin.
x-medusa-localestringOptional
The locale in BCP 47 format to retrieve localized content.
Example: en-US

Query parameters

localestringOptional
The locale in BCP 47 format to retrieve localized content.
Example: en-US

Request body (application/json)

queriesobject[]Optional
The queries to run, in the order their results are returned in.
entitystringOptional
The name of the index to query, which defaults to the index whose name equals the entity.
fieldsstring[]Optional
The dotted paths of the fields the search engine returns. Only fields stored in the search index can be passed here.
filtersobjectOptional
The filters to apply, including the free-text query as q.
paginationobjectOptional
How a search query's results are paginated and sorted.
search_optionsobjectOptional
The options changing how a search query is matched, scored, and aggregated.

Request examples

Responses

200 OK

resultsobject[]
The results of the posted queries, in the order they were sent in.

400, 401, 404, 409, 422, 500: an error response is returned.

Found a problem with this page?Report Issue
Edited Nov 14·Edit this page