Search blog posts
const url = 'https://apibase.ecomweb.app/api/v1/public/stores/example/search/blog?q=T-shirt&collection=blog_posts&page=1&page_size=10&sort_by=price%3Aasc&status=published&tags=t-shirt&categories=t-shirt';const options = {method: 'GET', headers: {'x-storefront-api-key': '<x-storefront-api-key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://apibase.ecomweb.app/api/v1/public/stores/example/search/blog?q=T-shirt&collection=blog_posts&page=1&page_size=10&sort_by=price%3Aasc&status=published&tags=t-shirt&categories=t-shirt' \ --header 'x-storefront-api-key: <x-storefront-api-key>'Searches the store’s blog posts by title and excerpt with typo tolerance. collection must be blog_posts. Published posts are searched unless status is sent. Narrow with categories and tags (comma-separated names) and page with page and page_size. Results are always ordered by publication date, newest first.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The store’s ref, as returned by GET /stores.
Query Parameters
Section titled “Query Parameters”Example
T-shirtThe search query string
Example
blog_postsThe collection to search within
Example
1Page number for pagination (1-based)
Example
10Number of items per page
Example
price:ascSort order for results
Example
publishedStatus for filtering
Example
t-shirtTags for filtering
Example
t-shirtCategories for filtering
Responses
Section titled “Responses”object
For each faceted field, how many matches carry each value. Empty when the response is read from the database.
object
The matches on this page. Present on results from the search index.
object
The indexed record. For products it holds fields such as id, name, slug, description, main_image_url, min_price, max_price, has_promotion, variant_mode and rating_average; for blog posts, id, title, slug, excerpt and published_at.
object
Highlighted fragments of the matched fields, keyed by field name. Absent on results read from the database.
object
The same fragments as a list, one entry per matched field. Absent on results read from the database.
object
The matches on this page. Present instead of data when the response is read directly from the database, which happens for a manual collection that keeps its hand-picked order.
object
The indexed record. For products it holds fields such as id, name, slug, description, main_image_url, min_price, max_price, has_promotion, variant_mode and rating_average; for blog posts, id, title, slug, excerpt and published_at.
object
Highlighted fragments of the matched fields, keyed by field name. Absent on results read from the database.
object
The same fragments as a list, one entry per matched field. Absent on results read from the database.
object
The request parameters as the search ran them. Absent on results read from the database.
object
Number of matches per page.
The search query.
Total number of records that match, across all pages.
The page these results belong to, starting at 1.
Example generated
{ "facet_counts": [ {} ], "data": [ { "document": {}, "highlight": {}, "highlights": [ {} ] } ], "hits": [ { "document": {}, "highlight": {}, "highlights": [ {} ] } ], "request_params": { "per_page": 1, "q": "example" }, "found": 1, "page": 1}The request is malformed or failed validation.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key is missing, invalid, revoked or expired.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}