Content Search: Execute Search
Content Search
Content Search: Execute Search
Content Search API endpoint to run semantic searches across blog articles, knowledge base pages, and other content using AI similarity matching.
POST
Content Search: Execute Search
Authorization
Token-based authentication header in the form of
<YOUR_LAYERS_TOKEN>.Headers
Path parameters
The url-encoded search query.
Body
Filter results by content type. Supported values:
"article" and "page". When omitted, all content types are searched and results from both articles and pages are returned together.Override default ranking weights for content search.
User identity information for tracking and personalization. Automatically managed by the Storefront Pixel; required for headless integrations.
Contextual information about the customer’s session, behavior, and environment. Automatically collected by the Storefront Pixel; must be manually provided for headless integrations. See Contextual Information for implementation guidance.
Response
Array of content items matching the search query. Results can include both articles and pages when no
content_type filter is applied. Each item includes:The search query that was executed.
The content type filter applied, if any.
The total number of results matching the search query.
The current page number.
The total number of pages.
The number of results per page.
Response headers
| Header | Description |
|---|---|
x-request-id | A unique identifier (ULID) for the request. Use it to correlate requests across your infrastructure or when contacting support. |
x-layers-build | The Layers build version that served the request. |
Supported content types
Content search indexes two types of Shopify content:| Content type | __typename | Description |
|---|---|---|
| Articles | "Article" | Blog posts from your Shopify blog. Includes author, tags, and blog association. |
| Pages | "Page" | Shopify pages (e.g., About Us, FAQ, Size Guide). Includes featured images when available. |
content_type parameter, results from both articles and pages are returned together, ranked by a unified scoring model. Use the __typename field to distinguish between content types when rendering results.
Search behavior
Content search uses a configurable ranking model to score and rank results. The default model combines three signal groups:| Signal group | Default weight | What it measures |
|---|---|---|
| Semantic (text) | 50% | How closely the content text matches the meaning of the query |
| Semantic (image) | 20% | How closely the content’s images match the query |
| Freshness | 30% | How recently the content was published (newer items score higher) |
tuning.rankingWeightOverrides parameter. For product search testing, use Test text search in Lab.
Error handling
When search processing fails (e.g., due to rate limits or service issues), the API returns an empty result set withtotalResults: 0 rather than throwing an error. This ensures graceful degradation of the search experience.
Usage example
cURL (all content types)
cURL (pages only)
Content sync: Articles and pages are automatically synced from Shopify via webhooks and bulk operations. Only published content without the
seo.hidden metafield is included in search results.