Prepare Search API endpoint that starts a search asynchronously so personalization and ranking can run in the background during a redirect or page load.
This endpoint asynchronously prepares expensive personalization for a given query, returning a ULID search_id that you can use with the Search API to execute the search.
Use with: Search API via the search_id body parameter
The url-encoded search query to prepare. Layers normalizes the query before validating it, stripping invisible characters and converting Unicode punctuation to ASCII equivalents. After normalization, the query must be 2 to 255 characters. Queries outside this range return HTTP 422.
Optional hint for which product attributes you intend to include in the eventual Search response. Available attributes include: id, title, handle, body_html, vendor, product_type, tags, images, available, created_at, updated_at, published_at, price_range, options, original_options, metafields, named_tags, calculated, category, featured_media, is_gift_card, has_variants_that_require_components, combined_listing_parent_product_id, combined_listing_role, and first_or_matched_variant. See the Product Schema for detailed descriptions.
Storefront endpoints accept nested AND/OR filter groups up to two levels deep. Each nested group must contain at least one expression; empty nested groups are rejected. Metafield filter properties may include hyphens in their namespace or key, for example metafields.my-app.fit-type.Refer to the dedicated Filter Expressions guide to learn more about filter expressions.
Facets to be included. Accepts both exact facet codes (e.g., "vendor", "options.Size") and wildcard patterns (e.g., "options.*", "metafields.product.*").Wildcard patterns expand to all matching attribute codes. For example, "options.*" expands to all option facets like "options.Size" and "options.Color". Wildcards must match at least one attribute code to be valid.Examples:
When true, any facet backed by a metaobject_reference or list.metaobject_reference metafield is returned with a companion facetDisplay object. Each entry maps a facet value (the metaobject handle) to the referenced metaobject’s display_name and fields. When the metaobject defines a color or image field, the entry also carries a resolved swatch object.Use this when your storefront filter UI needs human-readable labels or nested field data (for example, a color name or swatch hex) instead of the raw handle. When false or omitted, only the handles are returned in facets.Values are looked up from the local metaobject cache. Handles with no matching cached metaobject are omitted from facetDisplay and remain as plain values in facets. See Metaobjects and reference metafields for the normalized shape of each entry.
Persistent browser identifier that remains constant across sessions. Used to recognize returning visitors for long-term personalization. Automatically generated and managed by the Storefront Pixel.
Temporary session identifier. Layers-generated sessions expire after 30 minutes without activity. The Storefront Pixel refreshes the rolling window at page load and on every route change, including pages without tracked events. When a legacy Shopify or fallback cookie is available, Layers prefers it and does not control its lifetime. Without consent, the pixel uses a sessionStorage or in-memory fallback and does not write an analytics cookie.
Shopify B2B company location GID (e.g. gid://shopify/CompanyLocation/123456789) for the authenticated buyer. Layers resolves the catalog assigned to the company location and uses it to scope results: only products in the catalog are returned, prices come from the catalog’s price list, and excluded collections return 404. Omit for retail (DTC) traffic.When you pass companyLocationId, you must also pass the buyer’s customerId. Layers verifies with Shopify that the customer belongs to the company that owns the location before resolving the catalog; unauthorized or unauthenticated requests return a 403. See B2B catalogs.
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.
Geographic location information for regional personalization and merchandising. Layers determines it from the IP address for client-side requests. For server-side API calls (headless integrations), provide geo explicitly.
Number of units of this line in the cart. Layers rounds fractional values down to a whole number. Missing values, non-numeric values, and values below 1 count as 1. Layers uses it to calculate the cart subtotal for Free Shipping Picks.
The cart subtotal at which the shopper qualifies for free shipping, in the request currency’s major units (e.g. 75.00 for $75), not cents. Layers ignores values that aren’t a number greater than 0. Required for Free Shipping Picks blocks.
Shopify’s /cart.js and Liquid money values such as cart.total_price and item.price are in cents. Divide them by 100 before sending productsInCart[].price or freeShippingThreshold.
Products the shopper has viewed during the current session. Layers uses these as short-lived personalization signals, with recent views weighted more heavily. Only the 20 most recent views are used. The Storefront Pixel populates this automatically; send it manually only for headless integrations. See Recently viewed products.
Unit price in the request currency’s major units (e.g. 29.00 for $29), not cents, at time of purchase. Accepts a JSON number or a numeric string such as "29.00".
The page the search was started from (e.g., the referring page URL or page type). Layers accepts this field but doesn’t currently use it for ranking or rules.
Click identifiers from the landing URL, keyed by parameter name (e.g., fbclid, gclid). Layers derives the originating network from them as marketing.clickSource and discards the raw tokens. See Context data structure.
Arrival channel. Layers derives it from UTMs, click identifiers, and the referring site, and keeps a value you send only when it can’t derive one. See Arrival channel.
A/B test assignments for the shopper, keyed by experiment ID with the assigned group ID as the value (e.g., {"exp_123": "group_b"}). Used by the Experiment Group contextual condition. The Layers app embed fills this from Intelligems automatically; values your storefront sends for the same experiment take precedence. Entries whose value isn’t a string are dropped.
Shopify customer tags on the shopper’s profile (e.g., ["vip", "wholesale"]). Collected by the Storefront Pixel for signed-in customers; null for guests.
Shopify customer segment IDs the shopper belongs to. Server-resolved: Layers populates this from the signed-in identity.customerId on every request and ignores any value you send. null for guests and customers with no segment memberships. Available as context.customer.segments in contextual conditions.
Explicitly set the Shopify Market for this request. Must be provided inside context; it is not a top-level request body parameter. Used for market-specific product availability filtering and contextual pricing. Accepts a two-letter country code (e.g., "US", "CA"), a numeric Shopify Market ID (e.g., "12345"), or a Shopify Market GID (e.g., "gid://shopify/Market/12345").When not provided, the market is automatically resolved from context.geo.country (or the shopper’s detected country for client-side requests). If no matching market is found, the store’s primary market is used as the fallback.When you send a two-letter country code that belongs to the resolved market, Layers also prices for that country, ahead of the shopper’s detected location. See Market resolution.Behavior depends on the store’s market application mode (set under Settings > Search & Discovery > Search Behavior, in the Markets card):
Restrict to market catalog — Products are filtered to only those available in the resolved market, and market-specific pricing is applied
Adjust pricing only — The full catalog remains visible, but variant prices are swapped to market-specific values where available
Ignore markets (default) — Market resolution is skipped entirely; base catalog and base pricing are used for all shoppers
Storefront locale code (e.g., "en", "fr", "pt-br"). Case-insensitive; Layers normalizes to lowercase. When the locale is published in Shopify and served by the resolved market, Layers returns translated display text (titles, descriptions, option values, filter labels) while IDs, prices, and filter values stay in the source language. Regional locales fall back to their base language (pt-br uses pt). The store’s primary locale returns source text. See Translations.
ISO 4217 currency code (e.g., "USD", "EUR"). Case-insensitive; Layers normalizes to uppercase. When Layers can resolve a currency from the shopper’s market or pricing context, the server-resolved value takes precedence.
Shopify B2B company location identifier. When identity.companyLocationId is provided, Layers resolves the company location server-side and the server value takes precedence.
The shopping channel the customer is browsing from. Used for channel-specific merchandising, sorting, and analytics segmentation. Automatically detected from request headers when not provided (e.g., mobile app requests via Tapcart, Fuego, or Mobiloud Canvas are detected as "app").Accepted values:
"web" — Standard web browser (default)
"app" — Mobile app (e.g., Tapcart, Fuego, Mobiloud Canvas)
Pre-computes query understanding and personalization inputs
Prepared data is cached for up to 15 minutes; after TTL, Search falls back to normal processing
If Layers is temporarily serving keyword-only results platform-wide, prepare still returns 202 with a usable search_id but skips semantic preparation. The execute call then returns keyword-only results with _meta.search_lane set to "prefix_only". No client changes are required.
Use the returned search_id with the Search API in the search_id body parameter to execute an optimized search.
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Layers","colors":{"primary":"#607FFD","light":"#AFC0FF","dark":"#3A57E8"},"logo":{"light":"https://mintcdn.com/protoninc/PNs-gxGUVcdBDEEC/logo.svg?fit=max\u0026auto=format\u0026n=PNs-gxGUVcdBDEEC\u0026q=85\u0026s=989e3194cb32f07e7018b8b7186b9007","dark":"https://mintcdn.com/protoninc/PNs-gxGUVcdBDEEC/logo.svg?fit=max\u0026auto=format\u0026n=PNs-gxGUVcdBDEEC\u0026q=85\u0026s=989e3194cb32f07e7018b8b7186b9007","href":"https://www.uselayers.com/?utm_source=docs\u0026utm_medium=referral\u0026utm_campaign=docs-to-site"},"favicon":"https://mintcdn.com/protoninc/qubyNEZK4oJTl9By/favicon.svg?fit=max\u0026auto=format\u0026n=qubyNEZK4oJTl9By\u0026q=85\u0026s=3611d60346e12f15e4684bc60cb69ece","api":{"mdx":{"server":"https://app.uselayers.com/api/storefront/v1"}},"navbar":{"links":[{"href":"https://www.uselayers.com/changelog?utm_source=docs\u0026utm_medium=referral\u0026utm_campaign=docs-to-site","label":"Changelog"},{"href":"mailto:support@uselayers.com","label":"Support"},{"href":"https://app.uselayers.com/dashboard?utm_source=docs\u0026utm_medium=referral\u0026utm_campaign=docs-to-dashboard","label":"Dashboard"}],"primary":{"type":"button","label":"Request Demo","href":"https://www.uselayers.com/demo?utm_source=docs\u0026utm_medium=referral\u0026utm_campaign=docs-to-site"}},"footer":{"socials":{"linkedin":"https://www.linkedin.com/company/uselayers"},"links":[{"header":"Legal","items":[{"label":"Privacy Statement","href":"https://docs.uselayers.com/legal/privacy-statement"},{"label":"Terms of Use","href":"https://docs.uselayers.com/legal/terms-of-use"}]}]},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"protoninc","hasAudioNarration":false,"actualSubdomain":"protoninc","customDomains":["docs.uselayers.com"],"gitSource":{"type":"github","owner":"protonagency","repo":"layers-docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6aec9466ca078695d82aa007","collectionId":"eccc4149-6768-4a44-9ebd-e8539317fbe7","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6aec9466ca078695d82aa007"},"feedback":{"thumbs":true,"edits":false,"issues":false,"agentFeedback":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"}},"buildId":"6aedfe438505f54819241077","clientVersion":"0.0.4076","searchFilterCounts":[{"language":"default","tag":"Documentation","count":103},{"language":"default","tag":"Help Center","count":90},{"language":"default","tag":"Merchandising","count":57},{"language":"default","tag":"Developers","count":42},{"language":"default","tag":"API Reference","count":25},{"language":"default","tag":"SDK","count":20},{"language":"default","tag":"Sort Orders","count":18},{"language":"default","tag":"Configuration","count":15},{"language":"default","tag":"Liquid","count":14},{"language":"default","tag":"Search \u0026 Discovery","count":14}]},"assistantConfig":{"enableAskAiButton":true,"enableAskAiSearchBar":false,"deflection":{"enabled":true,"email":"support@uselayers.com","showHelpButton":true}},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":false,"toggles":[],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"api-reference/search-prepare","slug":"/api-reference/search-prepare","pageMetadata":{"api":"POST /search/{searchQuery}/prepare","title":"Text Search: Prepare Search","sidebarTitle":"Prepare Search","description":"Prepare Search API endpoint that starts a search asynchronously so personalization and ranking can run in the background during a redirect or page load.","href":"/api-reference/search-prepare"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Prepare Search API endpoint that starts a search asynchronously so personalization and ranking can run in the background during a redirect or page load.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Expandable,Heading,ParamField,ResponseField,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Expandable)_missingMdxReference(`Expandable`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!ParamField)_missingMdxReference(`ParamField`,true);if(!ResponseField)_missingMdxReference(`ResponseField`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`This endpoint asynchronously prepares expensive personalization for a given query, returning a ULID `,_jsx(_components.code,{children:`search_id`}),` that you can use with the Search API to execute the search.`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Use with: `,_jsx(_components.a,{href:`/api-reference/search`,children:`Search API`}),` via the `,_jsx(_components.code,{children:`search_id`}),` body parameter`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`authorization`,children:`Authorization`}),`\n`,_jsx(ParamField,{header:`X-Storefront-Access-Token`,type:`string`,required:true,id:`param-x-storefront-access-token`,children:_jsxs(_components.p,{children:[`Token-based authentication header in the form of `,_jsx(_components.code,{children:`\u003cYOUR_LAYERS_TOKEN>`}),`. Same requirements as the Search API.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`headers`,children:`Headers`}),`\n`,_jsx(ParamField,{header:`Content-Type`,default:`application/json`,type:`string`,required:true,id:`param-content-type`}),`\n`,_jsx(ParamField,{header:`Accept`,default:`application/json`,type:`string`,required:true,id:`param-accept`}),`\n`,_jsx(Heading,{level:`2`,id:`path-parameters`,children:`Path parameters`}),`\n`,_jsx(ParamField,{path:`searchQuery`,type:`string`,required:true,id:`param-search-query`,children:_jsx(_components.p,{children:`The url-encoded search query to prepare. Layers normalizes the query before validating it, stripping invisible characters and converting Unicode punctuation to ASCII equivalents. After normalization, the query must be 2 to 255 characters. Queries outside this range return HTTP 422.`})}),`\n`,_jsx(Heading,{level:`2`,id:`body`,children:`Body`}),`\n`,_jsx(ParamField,{body:`attributes`,type:`string[]`,id:`param-attributes`,children:_jsxs(_components.p,{children:[`Optional hint for which product attributes you intend to include in the eventual Search response. Available attributes include: `,_jsx(_components.code,{children:`id`}),`, `,_jsx(_components.code,{children:`title`}),`, `,_jsx(_components.code,{children:`handle`}),`, `,_jsx(_components.code,{children:`body_html`}),`, `,_jsx(_components.code,{children:`vendor`}),`, `,_jsx(_components.code,{children:`product_type`}),`, `,_jsx(_components.code,{children:`tags`}),`, `,_jsx(_components.code,{children:`images`}),`, `,_jsx(_components.code,{children:`available`}),`, `,_jsx(_components.code,{children:`created_at`}),`, `,_jsx(_components.code,{children:`updated_at`}),`, `,_jsx(_components.code,{children:`published_at`}),`, `,_jsx(_components.code,{children:`price_range`}),`, `,_jsx(_components.code,{children:`options`}),`, `,_jsx(_components.code,{children:`original_options`}),`, `,_jsx(_components.code,{children:`metafields`}),`, `,_jsx(_components.code,{children:`named_tags`}),`, `,_jsx(_components.code,{children:`calculated`}),`, `,_jsx(_components.code,{children:`category`}),`, `,_jsx(_components.code,{children:`featured_media`}),`, `,_jsx(_components.code,{children:`is_gift_card`}),`, `,_jsx(_components.code,{children:`has_variants_that_require_components`}),`, `,_jsx(_components.code,{children:`combined_listing_parent_product_id`}),`, `,_jsx(_components.code,{children:`combined_listing_role`}),`, and `,_jsx(_components.code,{children:`first_or_matched_variant`}),`. See the `,_jsx(_components.a,{href:`/developers/product-schema/api-attributes`,children:`Product Schema`}),` for detailed descriptions.`]})}),`\n`,_jsxs(ParamField,{body:`filter_group`,type:`object`,description:`A group of filter conditions using various operators.`,id:`param-filter-group`,children:[_jsxs(_components.p,{children:[`Storefront endpoints accept nested `,_jsx(_components.code,{children:`AND`}),`/`,_jsx(_components.code,{children:`OR`}),` filter groups up to two levels deep. Each nested group must contain at least one expression; empty nested groups are rejected. Metafield filter properties may include hyphens in their namespace or key, for example `,_jsx(_components.code,{children:`metafields.my-app.fit-type`}),`.`]}),_jsxs(_components.p,{children:[`Refer to the dedicated `,_jsx(_components.a,{href:`/engine/filtering`,children:`Filter Expressions`}),` guide to learn more about filter expressions.`]})]}),`\n`,_jsx(ParamField,{body:`pagination`,type:`Pagination Object`,description:`Specifies the page number and limit for pagination.`,id:`param-pagination`,children:_jsxs(Expandable,{title:`pagination`,children:[_jsx(ParamField,{body:`page`,type:`int`,min:`1`,max:`100`,id:`param-page`,children:_jsx(_components.p,{children:`The current page of results to fetch.`})}),_jsx(ParamField,{body:`limit`,type:`int`,min:`1`,max:`100`,id:`param-limit`,children:_jsx(_components.p,{children:`The max results to fetch per page.`})})]})}),`\n`,_jsxs(ParamField,{body:`facets`,type:`string[]`,description:`List of facets to include in the response.`,id:`param-facets`,children:[_jsxs(_components.p,{children:[`Facets to be included. Accepts both exact facet codes (e.g., `,_jsx(_components.code,{children:`\"vendor\"`}),`, `,_jsx(_components.code,{children:`\"options.Size\"`}),`) and wildcard patterns (e.g., `,_jsx(_components.code,{children:`\"options.*\"`}),`, `,_jsx(_components.code,{children:`\"metafields.product.*\"`}),`).`]}),_jsxs(_components.p,{children:[`Wildcard patterns expand to all matching attribute codes. For example, `,_jsx(_components.code,{children:`\"options.*\"`}),` expands to all option facets like `,_jsx(_components.code,{children:`\"options.Size\"`}),` and `,_jsx(_components.code,{children:`\"options.Color\"`}),`. Wildcards must match at least one attribute code to be valid.`]}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Examples:`})}),_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Exact facet codes`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"facets\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"vendor\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"options.Size\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"options.Color\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Wildcard pattern`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"facets\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"options.*\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Mixed exact and wildcard`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"facets\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"vendor\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"options.*\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"metafields.product.*\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`]})})})]}),`\n`,_jsx(ParamField,{body:`retrieveFacetCount`,type:`boolean`,description:`Retrieve facet count.`,id:`param-retrieve-facet-count`,children:_jsx(_components.p,{children:`If the count of each facet value should be calculated.`})}),`\n`,_jsx(ParamField,{body:`includeFacetRanges`,type:`boolean`,description:`Return min/max range for facets with a numeric value.`,id:`param-include-facet-ranges`,children:_jsx(_components.p,{children:`If you want a min/max range for numeric facets such as price.`})}),`\n`,_jsxs(ParamField,{body:`enrichFacetMetaobjects`,type:`boolean`,description:`Hydrate metaobject-reference facet values with display data.`,id:`param-enrich-facet-metaobjects`,children:[_jsxs(_components.p,{children:[`When `,_jsx(_components.code,{children:`true`}),`, any facet backed by a `,_jsx(_components.code,{children:`metaobject_reference`}),` or `,_jsx(_components.code,{children:`list.metaobject_reference`}),` metafield is returned with a companion `,_jsx(_components.code,{children:`facetDisplay`}),` object. Each entry maps a facet value (the metaobject handle) to the referenced metaobject’s `,_jsx(_components.code,{children:`display_name`}),` and `,_jsx(_components.code,{children:`fields`}),`. When the metaobject defines a color or image field, the entry also carries a resolved `,_jsx(_components.code,{children:`swatch`}),` object.`]}),_jsxs(_components.p,{children:[`Use this when your storefront filter UI needs human-readable labels or nested field data (for example, a color name or swatch hex) instead of the raw handle. When `,_jsx(_components.code,{children:`false`}),` or omitted, only the handles are returned in `,_jsx(_components.code,{children:`facets`}),`.`]}),_jsxs(_components.p,{children:[`Values are looked up from the local metaobject cache. Handles with no matching cached metaobject are omitted from `,_jsx(_components.code,{children:`facetDisplay`}),` and remain as plain values in `,_jsx(_components.code,{children:`facets`}),`. See `,_jsx(_components.a,{href:`/developers/product-schema/metafields/metaobjects-and-references`,children:`Metaobjects and reference metafields`}),` for the normalized shape of each entry.`]})]}),`\n`,_jsxs(ParamField,{body:`identity`,type:`object`,id:`param-identity`,children:[_jsx(_components.p,{children:`User identity information for tracking and personalization. Automatically managed by the Storefront Pixel; required for headless integrations.`}),_jsxs(Expandable,{title:`Properties`,children:[_jsx(ParamField,{body:`deviceId`,type:`string`,id:`param-device-id`,children:_jsx(_components.p,{children:`Persistent browser identifier that remains constant across sessions. Used to recognize returning visitors for long-term personalization. Automatically generated and managed by the Storefront Pixel.`})}),_jsx(ParamField,{body:`sessionId`,type:`string`,id:`param-session-id`,children:_jsx(_components.p,{children:`Temporary session identifier. Layers-generated sessions expire after 30 minutes without activity. The Storefront Pixel refreshes the rolling window at page load and on every route change, including pages without tracked events. When a legacy Shopify or fallback cookie is available, Layers prefers it and does not control its lifetime. Without consent, the pixel uses a sessionStorage or in-memory fallback and does not write an analytics cookie.`})}),_jsx(ParamField,{body:`customerId`,type:`string`,id:`param-customer-id`,children:_jsx(_components.p,{children:`Shopify customer ID for authenticated users. Only present when the customer is signed in to their account.`})}),_jsxs(ParamField,{body:`companyLocationId`,type:`string`,id:`param-company-location-id`,children:[_jsxs(_components.p,{children:[`Shopify B2B company location GID (e.g. `,_jsx(_components.code,{children:`gid://shopify/CompanyLocation/123456789`}),`) for the authenticated buyer. Layers resolves the catalog assigned to the company location and uses it to scope results: only products in the catalog are returned, prices come from the catalog’s price list, and excluded collections return 404. Omit for retail (DTC) traffic.`]}),_jsxs(_components.p,{children:[`When you pass `,_jsx(_components.code,{children:`companyLocationId`}),`, you must also pass the buyer’s `,_jsx(_components.code,{children:`customerId`}),`. Layers verifies with Shopify that the customer belongs to the company that owns the location before resolving the catalog; unauthorized or unauthenticated requests return a `,_jsx(_components.code,{children:`403`}),`. See `,_jsx(_components.a,{href:`/shopify-integration/b2b-catalogs`,children:`B2B catalogs`}),`.`]})]})]})]}),`\n`,_jsxs(ParamField,{body:`context`,type:`object`,id:`param-context`,children:[_jsxs(_components.p,{children:[`Contextual information about the customer’s session, behavior, and environment. Automatically collected by the Storefront Pixel; must be manually provided for headless integrations. See `,_jsx(_components.a,{href:`/engine/contextual-information`,children:`Contextual Information`}),` for implementation guidance.`]}),_jsxs(Expandable,{title:`Properties`,children:[_jsxs(ParamField,{body:`geo`,type:`object`,id:`param-geo`,children:[_jsxs(_components.p,{children:[`Geographic location information for regional personalization and merchandising. Layers determines it from the IP address for client-side requests. For server-side API calls (headless integrations), provide `,_jsx(_components.code,{children:`geo`}),` explicitly.`]}),_jsxs(Expandable,{title:`Properties`,children:[_jsx(ParamField,{body:`country`,type:`string`,id:`param-country`,children:_jsx(_components.p,{children:`Country code or name (e.g., “US”, “Canada”).`})}),_jsx(ParamField,{body:`province`,type:`string`,id:`param-province`,children:_jsx(_components.p,{children:`State or province name (e.g., “California”, “Ontario”).`})}),_jsx(ParamField,{body:`city`,type:`string`,id:`param-city`,children:_jsx(_components.p,{children:`City name (e.g., “Los Angeles”, “Toronto”).`})})]})]}),_jsxs(ParamField,{body:`productsInCart`,type:`array`,id:`param-products-in-cart`,children:[_jsx(_components.p,{children:`Products currently in the customer’s cart. Used to surface complementary products and influence relevance scoring.`}),_jsxs(Expandable,{title:`Array Item Properties`,children:[_jsx(ParamField,{body:`title`,type:`string`,id:`param-title`,children:_jsxs(_components.p,{children:[`Product title. Each entry needs at least a `,_jsx(_components.code,{children:`productId`}),`, `,_jsx(_components.code,{children:`variantId`}),`, or non-empty `,_jsx(_components.code,{children:`title`}),`. Layers drops entries with none of these.`]})}),_jsx(ParamField,{body:`price`,type:`number`,id:`param-price`,children:_jsxs(_components.p,{children:[`Unit price in the request currency’s major units (e.g. `,_jsx(_components.code,{children:`29.00`}),` for $29), not cents. Accepts a JSON number or a numeric string such as `,_jsx(_components.code,{children:`\"29.00\"`}),`.`]})}),_jsx(ParamField,{body:`type`,type:`string`,id:`param-type`,children:_jsx(_components.p,{children:`Product type or category.`})}),_jsx(ParamField,{body:`productId`,type:`string`,id:`param-product-id`,children:_jsxs(_components.p,{children:[`Product identifier. Accepts a numeric ID (e.g., `,_jsx(_components.code,{children:`\"8234567890123\"`}),`) or a Shopify GID (e.g., `,_jsx(_components.code,{children:`\"gid://shopify/Product/8234567890123\"`}),`).`]})}),_jsx(ParamField,{body:`variantId`,type:`string`,id:`param-variant-id`,children:_jsx(_components.p,{children:`Product variant identifier.`})}),_jsx(ParamField,{body:`options`,type:`object`,id:`param-options`,children:_jsxs(_components.p,{children:[`Product variant options (e.g., `,_jsx(_components.code,{children:`{\"Size\": \"11\", \"Color\": \"Red\"}`}),`).`]})}),_jsx(ParamField,{body:`quantity`,type:`integer`,id:`param-quantity`,children:_jsxs(_components.p,{children:[`Number of units of this line in the cart. Layers rounds fractional values down to a whole number. Missing values, non-numeric values, and values below `,_jsx(_components.code,{children:`1`}),` count as `,_jsx(_components.code,{children:`1`}),`. Layers uses it to calculate the cart subtotal for `,_jsx(_components.a,{href:`/platform/blocks/strategies#free-shipping-picks`,children:`Free Shipping Picks`}),`.`]})})]})]}),_jsx(ParamField,{body:`freeShippingThreshold`,type:`number`,id:`param-free-shipping-threshold`,children:_jsxs(_components.p,{children:[`The cart subtotal at which the shopper qualifies for free shipping, in the request currency’s major units (e.g. `,_jsx(_components.code,{children:`75.00`}),` for $75), not cents. Layers ignores values that aren’t a number greater than `,_jsx(_components.code,{children:`0`}),`. Required for `,_jsx(_components.a,{href:`/platform/blocks/strategies#free-shipping-picks`,children:`Free Shipping Picks`}),` blocks.`]})}),_jsx(Warning,{children:_jsxs(_components.p,{children:[`Shopify’s `,_jsx(_components.code,{children:`/cart.js`}),` and Liquid money values such as `,_jsx(_components.code,{children:`cart.total_price`}),` and `,_jsx(_components.code,{children:`item.price`}),` are in cents. Divide them by 100 before sending `,_jsx(_components.code,{children:`productsInCart[].price`}),` or `,_jsx(_components.code,{children:`freeShippingThreshold`}),`.`]})}),_jsxs(ParamField,{body:`productsViewed`,type:`array`,id:`param-products-viewed`,children:[_jsxs(_components.p,{children:[`Products the shopper has viewed during the current session. Layers uses these as short-lived personalization signals, with recent views weighted more heavily. Only the 20 most recent views are used. The Storefront Pixel populates this automatically; send it manually only for headless integrations. See `,_jsx(_components.a,{href:`/engine/contextual-information/data-structure#recently-viewed-products`,children:`Recently viewed products`}),`.`]}),_jsxs(Expandable,{title:`Array Item Properties`,children:[_jsx(ParamField,{body:`id`,type:`string`,id:`param-id`,children:_jsxs(_components.p,{children:[`Product identifier. Accepts a numeric ID or a Shopify GID. Also accepted as `,_jsx(_components.code,{children:`productId`}),`.`]})}),_jsx(ParamField,{body:`at`,type:`integer`,id:`param-at`,children:_jsxs(_components.p,{children:[`Timestamp of the view in Unix milliseconds. Views without `,_jsx(_components.code,{children:`at`}),` still count but skip recency weighting.`]})}),_jsx(ParamField,{body:`title`,type:`string`,id:`param-title-1`,children:_jsx(_components.p,{children:`Product title.`})}),_jsx(ParamField,{body:`type`,type:`string`,id:`param-type-1`,children:_jsx(_components.p,{children:`Product type or category.`})}),_jsx(ParamField,{body:`variantId`,type:`string`,id:`param-variant-id-1`,children:_jsx(_components.p,{children:`Variant identifier, if the shopper viewed a specific variant.`})}),_jsx(ParamField,{body:`options`,type:`object`,id:`param-options-1`,children:_jsxs(_components.p,{children:[`Product variant options (e.g., `,_jsx(_components.code,{children:`{\"Size\": \"11\", \"Color\": \"Red\"}`}),`).`]})})]})]}),_jsxs(ParamField,{body:`productsPurchased`,type:`array`,id:`param-products-purchased`,children:[_jsx(_components.p,{children:`Products the customer has previously purchased. Informs recommendations and prevents over-promotion of owned items.`}),_jsxs(Expandable,{title:`Array Item Properties`,children:[_jsx(ParamField,{body:`title`,type:`string`,id:`param-title-2`,children:_jsxs(_components.p,{children:[`Product title. Each entry needs at least a `,_jsx(_components.code,{children:`productId`}),`, `,_jsx(_components.code,{children:`variantId`}),`, or non-empty `,_jsx(_components.code,{children:`title`}),`. Layers drops entries with none of these.`]})}),_jsx(ParamField,{body:`price`,type:`number`,id:`param-price-1`,children:_jsxs(_components.p,{children:[`Unit price in the request currency’s major units (e.g. `,_jsx(_components.code,{children:`29.00`}),` for $29), not cents, at time of purchase. Accepts a JSON number or a numeric string such as `,_jsx(_components.code,{children:`\"29.00\"`}),`.`]})}),_jsx(ParamField,{body:`type`,type:`string`,id:`param-type-2`,children:_jsx(_components.p,{children:`Product type or category.`})}),_jsx(ParamField,{body:`productId`,type:`string`,id:`param-product-id-1`,children:_jsxs(_components.p,{children:[`Product identifier. Accepts a numeric ID (e.g., `,_jsx(_components.code,{children:`\"8234567890123\"`}),`) or a Shopify GID (e.g., `,_jsx(_components.code,{children:`\"gid://shopify/Product/8234567890123\"`}),`).`]})}),_jsx(ParamField,{body:`variantId`,type:`string`,id:`param-variant-id-2`,children:_jsx(_components.p,{children:`Product variant identifier.`})}),_jsx(ParamField,{body:`options`,type:`object`,id:`param-options-2`,children:_jsxs(_components.p,{children:[`Product variant options (e.g., `,_jsx(_components.code,{children:`{\"Size\": \"11\", \"Color\": \"Red\"}`}),`).`]})})]})]}),_jsxs(ParamField,{body:`priorSearches`,type:`array`,id:`param-prior-searches`,children:[_jsx(_components.p,{children:`Recent search queries and their outcomes. Helps understand customer intent and refine relevance models.`}),_jsxs(Expandable,{title:`Array Item Properties`,children:[_jsx(ParamField,{body:`searchQuery`,type:`string`,required:true,id:`param-search-query-1`,children:_jsx(_components.p,{children:`The search query text.`})}),_jsx(ParamField,{body:`hadClick`,type:`boolean`,default:`false`,id:`param-had-click`,children:_jsx(_components.p,{children:`Whether the customer clicked on any results from this search.`})}),_jsx(ParamField,{body:`hasResults`,type:`boolean`,default:`false`,id:`param-has-results`,children:_jsx(_components.p,{children:`Whether the search returned any results.`})}),_jsx(ParamField,{body:`fromPage`,type:`string`,id:`param-from-page`,children:_jsx(_components.p,{children:`The page the search was started from (e.g., the referring page URL or page type). Layers accepts this field but doesn’t currently use it for ranking or rules.`})})]})]}),_jsxs(ParamField,{body:`marketing`,type:`object`,id:`param-marketing`,children:[_jsx(_components.p,{children:`UTM parameters and marketing campaign information for attribution tracking.`}),_jsxs(Expandable,{title:`Properties`,children:[_jsx(ParamField,{body:`source`,type:`string`,id:`param-source`,children:_jsx(_components.p,{children:`Marketing source (e.g., “google”, “facebook”).`})}),_jsx(ParamField,{body:`medium`,type:`string`,id:`param-medium`,children:_jsx(_components.p,{children:`Marketing medium (e.g., “cpc”, “email”, “social”).`})}),_jsx(ParamField,{body:`campaign`,type:`string`,id:`param-campaign`,children:_jsx(_components.p,{children:`Campaign name.`})}),_jsx(ParamField,{body:`term`,type:`string`,id:`param-term`,children:_jsx(_components.p,{children:`Search term or keyword.`})}),_jsx(ParamField,{body:`content`,type:`string`,id:`param-content`,children:_jsxs(_components.p,{children:[`Ad or link variant, such as the value of `,_jsx(_components.code,{children:`utm_content`}),`.`]})}),_jsx(ParamField,{body:`clickIds`,type:`object`,id:`param-click-ids`,children:_jsxs(_components.p,{children:[`Click identifiers from the landing URL, keyed by parameter name (e.g., `,_jsx(_components.code,{children:`fbclid`}),`, `,_jsx(_components.code,{children:`gclid`}),`). Layers derives the originating network from them as `,_jsx(_components.code,{children:`marketing.clickSource`}),` and discards the raw tokens. See `,_jsx(_components.a,{href:`/engine/contextual-information/data-structure#click-identifiers-and-derived-click-source`,children:`Context data structure`}),`.`]})}),_jsx(ParamField,{body:`referrer`,type:`string`,id:`param-referrer`,children:_jsxs(_components.p,{children:[`Host or URL of the site that linked the shopper to the storefront (e.g., “google.com”). Layers normalizes it to a lowercase host without `,_jsx(_components.code,{children:`www.`}),`.`]})}),_jsx(ParamField,{body:`landingPath`,type:`string`,id:`param-landing-path`,children:_jsx(_components.p,{children:`Storefront path the shopper first landed on this visit (e.g., “/collections/sale”). Layers removes the query string and keeps up to 512 characters.`})}),_jsx(ParamField,{body:`channel`,type:`string`,id:`param-channel`,children:_jsxs(_components.p,{children:[`Arrival channel. Layers derives it from UTMs, click identifiers, and the referring site, and keeps a value you send only when it can’t derive one. See `,_jsx(_components.a,{href:`/engine/contextual-information/data-structure#arrival-channel`,children:`Arrival channel`}),`.`]})})]})]}),_jsx(ParamField,{body:`experiments`,type:`object`,id:`param-experiments`,children:_jsxs(_components.p,{children:[`A/B test assignments for the shopper, keyed by experiment ID with the assigned group ID as the value (e.g., `,_jsx(_components.code,{children:`{\"exp_123\": \"group_b\"}`}),`). Used by the `,_jsx(_components.strong,{children:`Experiment Group`}),` contextual condition. The Layers app embed fills this from Intelligems automatically; values your storefront sends for the same experiment take precedence. Entries whose value isn’t a string are dropped.`]})}),_jsxs(ParamField,{body:`customer`,type:`object`,id:`param-customer`,children:[_jsx(_components.p,{children:`Aggregated customer behavior and purchase patterns for personalization.`}),_jsxs(Expandable,{title:`Properties`,children:[_jsx(ParamField,{body:`signedIn`,type:`boolean`,id:`param-signed-in`,children:_jsx(_components.p,{children:`Whether the customer is currently authenticated.`})}),_jsx(ParamField,{body:`returning`,type:`boolean`,id:`param-returning`,children:_jsx(_components.p,{children:`Whether this is a returning customer.`})}),_jsx(ParamField,{body:`numberOfOrders`,type:`integer`,id:`param-number-of-orders`,children:_jsx(_components.p,{children:`Total number of orders placed.`})}),_jsx(ParamField,{body:`averageOrderValue`,type:`number`,id:`param-average-order-value`,children:_jsx(_components.p,{children:`Average order value in store currency.`})}),_jsx(ParamField,{body:`daysBetweenOrders`,type:`integer`,id:`param-days-between-orders`,children:_jsx(_components.p,{children:`Average days between orders.`})}),_jsx(ParamField,{body:`daysSinceLastOrder`,type:`integer`,id:`param-days-since-last-order`,children:_jsx(_components.p,{children:`Days since the most recent order.`})}),_jsx(ParamField,{body:`daysSinceOldestOrder`,type:`integer`,id:`param-days-since-oldest-order`,children:_jsx(_components.p,{children:`Days since the first order.`})}),_jsx(ParamField,{body:`totalSpent`,type:`number`,id:`param-total-spent`,children:_jsx(_components.p,{children:`Total amount spent in store currency.`})}),_jsx(ParamField,{body:`tags`,type:`array`,id:`param-tags`,children:_jsxs(_components.p,{children:[`Shopify customer tags on the shopper’s profile (e.g., `,_jsx(_components.code,{children:`[\"vip\", \"wholesale\"]`}),`). Collected by the Storefront Pixel for signed-in customers; `,_jsx(_components.code,{children:`null`}),` for guests.`]})}),_jsx(ParamField,{body:`segments`,type:`array`,id:`param-segments`,children:_jsxs(_components.p,{children:[`Shopify customer segment IDs the shopper belongs to. Server-resolved: Layers populates this from the signed-in `,_jsx(_components.code,{children:`identity.customerId`}),` on every request and ignores any value you send. `,_jsx(_components.code,{children:`null`}),` for guests and customers with no segment memberships. Available as `,_jsx(_components.code,{children:`context.customer.segments`}),` in `,_jsx(_components.a,{href:`/platform/merchandising/contextual-conditions`,children:`contextual conditions`}),`.`]})})]})]}),_jsxs(ParamField,{body:`market`,type:`string`,id:`param-market`,children:[_jsxs(_components.p,{children:[`Explicitly set the Shopify Market for this request. Must be provided inside `,_jsx(_components.code,{children:`context`}),`; it is not a top-level request body parameter. Used for market-specific product availability filtering and contextual pricing. Accepts a two-letter country code (e.g., `,_jsx(_components.code,{children:`\"US\"`}),`, `,_jsx(_components.code,{children:`\"CA\"`}),`), a numeric Shopify Market ID (e.g., `,_jsx(_components.code,{children:`\"12345\"`}),`), or a Shopify Market GID (e.g., `,_jsx(_components.code,{children:`\"gid://shopify/Market/12345\"`}),`).`]}),_jsxs(_components.p,{children:[`When not provided, the market is automatically resolved from `,_jsx(_components.code,{children:`context.geo.country`}),` (or the shopper’s detected country for client-side requests). If no matching market is found, the store’s primary market is used as the fallback.`]}),_jsxs(_components.p,{children:[`When you send a two-letter country code that belongs to the resolved market, Layers also prices for that country, ahead of the shopper’s detected location. See `,_jsx(_components.a,{href:`/engine/contextual-information/data-structure#market`,children:`Market resolution`}),`.`]}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Behavior depends on the store’s market application mode`}),` (set under `,_jsx(_components.strong,{children:`Settings > Search \u0026 Discovery > Search Behavior`}),`, in the `,_jsx(_components.strong,{children:`Markets`}),` card):`]}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Restrict to market catalog`}),` — Products are filtered to only those available in the resolved market, and market-specific pricing is applied`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Adjust pricing only`}),` — The full catalog remains visible, but variant prices are swapped to market-specific values where available`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Ignore markets`}),` (default) — Market resolution is skipped entirely; base catalog and base pricing are used for all shoppers`]}),`\n`]})]}),_jsxs(ParamField,{body:`session`,type:`object`,id:`param-session`,children:[_jsx(_components.p,{children:`Session-level signals about the current visit.`}),_jsx(Expandable,{title:`Properties`,children:_jsx(ParamField,{body:`returning`,type:`boolean`,id:`param-returning-1`,children:_jsx(_components.p,{children:`Whether the current session belongs to a returning visitor. Layers derives this from the storefront’s session cookie when not provided.`})})})]}),_jsx(ParamField,{body:`locale`,type:`string`,id:`param-locale`,children:_jsxs(_components.p,{children:[`Storefront locale code (e.g., `,_jsx(_components.code,{children:`\"en\"`}),`, `,_jsx(_components.code,{children:`\"fr\"`}),`, `,_jsx(_components.code,{children:`\"pt-br\"`}),`). Case-insensitive; Layers normalizes to lowercase. When the locale is published in Shopify and served by the resolved market, Layers returns translated display text (titles, descriptions, option values, filter labels) while IDs, prices, and filter values stay in the source language. Regional locales fall back to their base language (`,_jsx(_components.code,{children:`pt-br`}),` uses `,_jsx(_components.code,{children:`pt`}),`). The store’s primary locale returns source text. See `,_jsx(_components.a,{href:`/shopify-integration/translations`,children:`Translations`}),`.`]})}),_jsx(ParamField,{body:`currency`,type:`string`,id:`param-currency`,children:_jsxs(_components.p,{children:[`ISO 4217 currency code (e.g., `,_jsx(_components.code,{children:`\"USD\"`}),`, `,_jsx(_components.code,{children:`\"EUR\"`}),`). Case-insensitive; Layers normalizes to uppercase. When Layers can resolve a currency from the shopper’s market or pricing context, the server-resolved value takes precedence.`]})}),_jsx(ParamField,{body:`b2bCompany`,type:`string`,id:`param-b2b-company`,children:_jsxs(_components.p,{children:[`Shopify B2B company location identifier. When `,_jsx(_components.code,{children:`identity.companyLocationId`}),` is provided, Layers resolves the company location server-side and the server value takes precedence.`]})}),_jsxs(ParamField,{body:`shoppingChannel`,type:`string`,default:`web`,id:`param-shopping-channel`,children:[_jsxs(_components.p,{children:[`The shopping channel the customer is browsing from. Used for channel-specific merchandising, sorting, and analytics segmentation. Automatically detected from request headers when not provided (e.g., mobile app requests via Tapcart, Fuego, or Mobiloud Canvas are detected as `,_jsx(_components.code,{children:`\"app\"`}),`).`]}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Accepted values:`})}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`\"web\"`}),` — Standard web browser (default)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`\"app\"`}),` — Mobile app (e.g., Tapcart, Fuego, Mobiloud Canvas)`]}),`\n`]})]}),_jsx(ParamField,{body:`custom`,type:`object`,id:`param-custom`,children:_jsx(_components.p,{children:`Custom contextual data specific to your implementation. Structure is flexible and can contain any key-value pairs relevant to your use case.`})})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`behavior`,children:`Behavior`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Returns HTTP 202 (Accepted) immediately with a `,_jsx(_components.code,{children:`search_id`})]}),`\n`,_jsxs(_components.li,{children:[`Generates a ULID `,_jsx(_components.code,{children:`search_id`}),` that identifies the prepared search`]}),`\n`,_jsx(_components.li,{children:`Starts additional search preparation asynchronously`}),`\n`,_jsx(_components.li,{children:`Pre-computes query understanding and personalization inputs`}),`\n`,_jsx(_components.li,{children:`Prepared data is cached for up to 15 minutes; after TTL, Search falls back to normal processing`}),`\n`,_jsxs(_components.li,{children:[`If Layers is temporarily serving keyword-only results platform-wide, prepare still returns 202 with a usable `,_jsx(_components.code,{children:`search_id`}),` but skips semantic preparation. The execute call then returns keyword-only results with `,_jsx(_components.code,{children:`_meta.search_lane`}),` set to `,_jsx(_components.code,{children:`\"prefix_only\"`}),`. No client changes are required.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`response`,children:`Response`}),`\n`,_jsx(Heading,{level:`3`,id:`202-accepted`,children:`202 Accepted`}),`\n`,_jsx(ResponseField,{name:`search_id`,type:`string`,id:`param-search-id`,children:_jsx(_components.p,{children:`ULID identifier for the prepared search. Valid for 15 minutes.`})}),`\n`,`\n`,_jsx(Heading,{level:`3`,id:`response-headers`,children:`Response headers`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Header`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`x-request-id`})}),_jsx(_components.td,{children:`A unique identifier (ULID) for the request. Use it to correlate requests across your infrastructure or when contacting support.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`x-layers-build`})}),_jsx(_components.td,{children:`The Layers build version that served the request.`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`error-conditions`,children:`Error conditions`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`401 Unauthorized: Missing/invalid `,_jsx(_components.code,{children:`X-Storefront-Access-Token`})]}),`\n`,_jsx(_components.li,{children:`402 Payment Required: The store is suspended. Every storefront API request returns this status until the suspension is lifted`}),`\n`,_jsx(_components.li,{children:`422 Unprocessable Entity: Invalid body or parameters`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`next-steps`,children:`Next steps`}),`\n`,_jsxs(_components.p,{children:[`Use the returned `,_jsx(_components.code,{children:`search_id`}),` with the `,_jsx(_components.a,{href:`/api-reference/search`,children:`Search API`}),` in the `,_jsx(_components.code,{children:`search_id`}),` body parameter to execute an optimized search.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"api":"POST /search/{searchQuery}/prepare","title":"Text Search: Prepare Search","sidebarTitle":"Prepare Search","description":"Prepare Search API endpoint that starts a search asynchronously so personalization and ranking can run in the background during a redirect or page load.","href":"/api-reference/search-prepare"}}},"mdxSourceWithNoJs":null,"noJsSplices":[[405,409,"Example,ResponseFiel"],[662,677,"Example)_missingMdxReference(`ResponseExample`,true);if(!ResponseField)_missingM"],[36003,38096,"_jsxs(ResponseExample,{children:[_jsx(CodeBlock,{filename:`Request`,numberOfLines:`25`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`25`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`POST /storefront/v`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`/search/running%`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`20`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`shoes/prepare`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"context\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"geo\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"country\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"US\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"province\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"California\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"productsInCart\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"title\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Nike Air Force 1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"productId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"1234567890\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"marketing\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"source\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"google\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"medium\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"cpc\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"shoppingChannel\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"web\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"identity\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"sessionId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"abc123\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"deviceId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"device-uuid\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Response`,numberOfLines:`3`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"search_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"01HZY7J9ZV6K2T3M6P4FJ3F2QG\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})]}),`\n`,_jsx(Heading,{level:`3`,id:`response-headers`,children:`Response headers`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Header`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`x-request-id`})}),_jsx(_components.td,{children:`A unique identifier (ULID) for the request. Use it to correlate requests across your infrastructure or when contacting support.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`x-layers-build`})}),_jsx(_components.td,{children:`The Layers build version that served the request.`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`error-conditions`,children:`Error conditions`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`401 Unauthorized: Missing/invalid `,_jsx(_components.code,{children:`X-Storefront-Access-Token`})]}),`\n`,_jsx(_components.li,{children:`402 Payment Required: The store is suspended. Every storefront API request returns this status until the suspension is lifted`}),`\n`,_jsx(_components.li,{children:`422 Unprocessable Entity: Invalid body or parameters`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`next-steps`,children:`Next steps`}),`\n`,_jsxs(_components.p,{children:[`Use the returned `,_jsx(_components.code,{children:`search_id`}),` with the `,_jsx(_components.a,{href:`/api-reference/search`,children:`Search API`}),` in the `,_jsx(_components.code,{children:`search_id`}),` body parameter to execute an optimized search.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}"]]},"mdxExtracts":{"tableOfContents":[{"title":"Authorization","slug":"authorization","depth":2,"children":[]},{"title":"Headers","slug":"headers","depth":2,"children":[]},{"title":"Path parameters","slug":"path-parameters","depth":2,"children":[]},{"title":"Body","slug":"body","depth":2,"children":[]},{"title":"Behavior","slug":"behavior","depth":2,"children":[]},{"title":"Response","slug":"response","depth":2,"children":[{"title":"202 Accepted","slug":"202-accepted","depth":3,"children":[]},{"title":"Response headers","slug":"response-headers","depth":3,"children":[]},{"title":"Error conditions","slug":"error-conditions","depth":3,"children":[]}]},{"title":"Next steps","slug":"next-steps","depth":2,"children":[]}],"codeExamples":{"response":{"type":"ResponseExample","children":[{"filename":"Request","html":"\u003cpre class=\"shiki shiki-themes github-light-default dark-plus\" style=\"background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4\" language=\"json\">\u003ccode language=\"json\" numberOfLines=\"25\">\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">POST /storefront/v\u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#B5CEA8\">1\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">/search/running%\u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#B5CEA8\">20\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">shoes/prepare\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">{\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"context\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"geo\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"country\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"US\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"province\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"California\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> },\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"productsInCart\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: [\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"title\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"Nike Air Force 1\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"productId\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"1234567890\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> }\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> ],\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"marketing\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"source\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"google\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"medium\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"cpc\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> },\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"shoppingChannel\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"web\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> },\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"identity\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"sessionId\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"abc123\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"deviceId\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"device-uuid\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> }\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">}\u003c/span>\u003c/span>\n\u003c/code>\u003c/pre>"},{"filename":"Response","html":"\u003cpre class=\"shiki shiki-themes github-light-default dark-plus\" style=\"background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4\" language=\"json\">\u003ccode language=\"json\" numberOfLines=\"3\">\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">{\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"search_id\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"01HZY7J9ZV6K2T3M6P4FJ3F2QG\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">}\u003c/span>\u003c/span>\n\u003c/code>\u003c/pre>"}],"attributes":[]}},"endpoint":{"title":"Text Search: Prepare Search","path":"/search/{searchQuery}/prepare","servers":[{"url":"https://app.uselayers.com/api/storefront/v1"}],"method":"post","request":{"security":[],"parameters":{"query":{},"header":{"X-Storefront-Access-Token":{"schema":[{"type":"string","description":"Token-based authentication header in the form of `\u003cYOUR_LAYERS_TOKEN>` . Same requirements as the Search API.","required":true}]},"Content-Type":{"schema":[{"type":"string","required":true}]},"Accept":{"schema":[{"type":"string","required":true}]}},"cookie":{},"path":{"searchQuery":{"schema":[{"type":"string","description":"The url-encoded search query to prepare. Layers normalizes the query before validating it, stripping invisible characters and converting Unicode punctuation to ASCII equivalents. After normalization, the query must be 2 to 255 characters. Queries outside this range return HTTP 422.","required":true}]}}},"body":{"application/json":{"schemaArray":[{"type":"object","properties":{"attributes":[{"type":"array","items":[{"type":"string"}],"description":"Optional hint for which product attributes you intend to include in the eventual Search response. Available attributes include: `id` , `title` , `handle` , `body_html` , `vendor` , `product_type` , `tags` , `images` , `available` , `created_at` , `updated_at` , `published_at` , `price_range` , `options` , `original_options` , `metafields` , `named_tags` , `calculated` , `category` , `featured_media` , `is_gift_card` , `has_variants_that_require_components` , `combined_listing_parent_product_id` , `combined_listing_role` , and `first_or_matched_variant` . See the for detailed descriptions."}],"filter_group":[{"type":"object","properties":{},"description":"Storefront endpoints accept nested `AND` / `OR` filter groups up to two levels deep. Each nested group must contain at least one expression; empty nested groups are rejected. Metafield filter properties may include hyphens in their namespace or key, for example `metafields.my-app.fit-type` . Refer to the dedicated Filter Expressions guide to learn more about filter expressions."}],"pagination":[{"type":"object","properties":{"page":[{"type":"integer","description":"The current page of results to fetch."}],"limit":[{"type":"integer","description":"The max results to fetch per page."}]}}],"facets":[{"type":"array","items":[{"type":"string"}],"description":"Facets to be included. Accepts both exact facet codes (e.g., `\"vendor\"` , `\"options.Size\"` ) and wildcard patterns (e.g., `\"options.*\"` , `\"metafields.product.*\"` ). Wildcard patterns expand to all matching attribute codes. For example, `\"options.*\"` expands to all option facets like `\"options.Size\"` and `\"options.Color\"` . Wildcards must match at least one attribute code to be valid. Examples:"}],"retrieveFacetCount":[{"type":"boolean","description":"If the count of each facet value should be calculated."}],"includeFacetRanges":[{"type":"boolean","description":"If you want a min/max range for numeric facets such as price."}],"enrichFacetMetaobjects":[{"type":"boolean","description":"When `true` , any facet backed by a `metaobject_reference` or `list.metaobject_reference` metafield is returned with a companion `facetDisplay` object. Each entry maps a facet value (the metaobject handle) to the referenced metaobject’s `display_name` and `fields` . When the metaobject defines a color or image field, the entry also carries a resolved `swatch` object. Use this when your storefront filter UI needs human-readable labels or nested field data (for example, a color name or swatch hex) instead of the raw handle. When `false` or omitted, only the handles are returned in `facets` . Values are looked up from the local metaobject cache. Handles with no matching cached metaobject are omitted from `facetDisplay` and remain as plain values in `facets` . See Metaobjects and reference metafields for the normalized shape of each entry."}],"identity":[{"type":"object","properties":{"deviceId":[{"type":"string","description":"Persistent browser identifier that remains constant across sessions. Used to recognize returning visitors for long-term personalization. Automatically generated and managed by the Storefront Pixel."}],"sessionId":[{"type":"string","description":"Temporary session identifier. Layers-generated sessions expire after 30 minutes without activity. The Storefront Pixel refreshes the rolling window at page load and on every route change, including pages without tracked events. When a legacy Shopify or fallback cookie is available, Layers prefers it and does not control its lifetime. Without consent, the pixel uses a sessionStorage or in-memory fallback and does not write an analytics cookie."}],"customerId":[{"type":"string","description":"Shopify customer ID for authenticated users. Only present when the customer is signed in to their account."}],"companyLocationId":[{"type":"string","description":"Shopify B2B company location GID (e.g. `gid://shopify/CompanyLocation/123456789` ) for the authenticated buyer. Layers resolves the catalog assigned to the company location and uses it to scope results: only products in the catalog are returned, prices come from the catalog’s price list, and excluded collections return 404. Omit for retail (DTC) traffic. When you pass `companyLocationId` , you must also pass the buyer’s `customerId` . Layers verifies with Shopify that the customer belongs to the company that owns the location before resolving the catalog; unauthorized or unauthenticated requests return a `403` . See B2B catalogs ."}]},"description":"User identity information for tracking and personalization. Automatically managed by the Storefront Pixel; required for headless integrations."}],"context":[{"type":"object","properties":{"geo":[{"type":"object","properties":{"country":[{"type":"string","description":"Country code or name (e.g., “US”, “Canada”)."}],"province":[{"type":"string","description":"State or province name (e.g., “California”, “Ontario”)."}],"city":[{"type":"string","description":"City name (e.g., “Los Angeles”, “Toronto”)."}]},"description":"Geographic location information for regional personalization and merchandising. Layers determines it from the IP address for client-side requests. For server-side API calls (headless integrations), provide `geo` explicitly."}],"productsInCart":[{"type":"array","items":[{"type":"object","properties":{"title":[{"type":"string","description":"Product title. Each entry needs at least a `productId` , `variantId` , or non-empty `title` . Layers drops entries with none of these."}],"price":[{"type":"number","description":"Unit price in the request currency’s major units (e.g. `29.00` for $29), not cents. Accepts a JSON number or a numeric string such as `\"29.00\"` ."}],"type":[{"type":"string","description":"Product type or category."}],"productId":[{"type":"string","description":"Product identifier. Accepts a numeric ID (e.g., `\"8234567890123\"` ) or a Shopify GID (e.g., `\"gid://shopify/Product/8234567890123\"` )."}],"variantId":[{"type":"string","description":"Product variant identifier."}],"options":[{"type":"object","properties":{},"description":"Product variant options (e.g., `{\"Size\": \"11\", \"Color\": \"Red\"}` )."}],"quantity":[{"type":"integer","description":"Number of units of this line in the cart. Layers rounds fractional values down to a whole number. Missing values, non-numeric values, and values below `1` count as `1` . Layers uses it to calculate the cart subtotal for Free Shipping Picks ."}]}}],"description":"Products currently in the customer’s cart. Used to surface complementary products and influence relevance scoring."}],"freeShippingThreshold":[{"type":"number","description":"The cart subtotal at which the shopper qualifies for free shipping, in the request currency’s major units (e.g. `75.00` for $75), not cents. Layers ignores values that aren’t a number greater than `0` . Required for Free Shipping Picks blocks."}],"productsViewed":[{"type":"array","items":[{"type":"object","properties":{"id":[{"type":"string","description":"Product identifier. Accepts a numeric ID or a Shopify GID. Also accepted as `productId` ."}],"at":[{"type":"integer","description":"Timestamp of the view in Unix milliseconds. Views without `at` still count but skip recency weighting."}],"title":[{"type":"string","description":"Product title."}],"type":[{"type":"string","description":"Product type or category."}],"variantId":[{"type":"string","description":"Variant identifier, if the shopper viewed a specific variant."}],"options":[{"type":"object","properties":{},"description":"Product variant options (e.g., `{\"Size\": \"11\", \"Color\": \"Red\"}` )."}]}}],"description":"Products the shopper has viewed during the current session. Layers uses these as short-lived personalization signals, with recent views weighted more heavily. Only the 20 most recent views are used. The Storefront Pixel populates this automatically; send it manually only for headless integrations. See Recently viewed products ."}],"productsPurchased":[{"type":"array","items":[{"type":"object","properties":{"title":[{"type":"string","description":"Product title. Each entry needs at least a `productId` , `variantId` , or non-empty `title` . Layers drops entries with none of these."}],"price":[{"type":"number","description":"Unit price in the request currency’s major units (e.g. `29.00` for $29), not cents, at time of purchase. Accepts a JSON number or a numeric string such as `\"29.00\"` ."}],"type":[{"type":"string","description":"Product type or category."}],"productId":[{"type":"string","description":"Product identifier. Accepts a numeric ID (e.g., `\"8234567890123\"` ) or a Shopify GID (e.g., `\"gid://shopify/Product/8234567890123\"` )."}],"variantId":[{"type":"string","description":"Product variant identifier."}],"options":[{"type":"object","properties":{},"description":"Product variant options (e.g., `{\"Size\": \"11\", \"Color\": \"Red\"}` )."}]}}],"description":"Products the customer has previously purchased. Informs recommendations and prevents over-promotion of owned items."}],"priorSearches":[{"type":"array","items":[{"type":"object","properties":{"searchQuery":[{"type":"string","description":"The search query text.","required":true}],"hadClick":[{"type":"boolean","description":"Whether the customer clicked on any results from this search."}],"hasResults":[{"type":"boolean","description":"Whether the search returned any results."}],"fromPage":[{"type":"string","description":"The page the search was started from (e.g., the referring page URL or page type). Layers accepts this field but doesn’t currently use it for ranking or rules."}]}}],"description":"Recent search queries and their outcomes. Helps understand customer intent and refine relevance models."}],"marketing":[{"type":"object","properties":{"source":[{"type":"string","description":"Marketing source (e.g., “google”, “facebook”)."}],"medium":[{"type":"string","description":"Marketing medium (e.g., “cpc”, “email”, “social”)."}],"campaign":[{"type":"string","description":"Campaign name."}],"term":[{"type":"string","description":"Search term or keyword."}],"content":[{"type":"string","description":"Ad or link variant, such as the value of `utm_content` ."}],"clickIds":[{"type":"object","properties":{},"description":"Click identifiers from the landing URL, keyed by parameter name (e.g., `fbclid` , `gclid` ). Layers derives the originating network from them as `marketing.clickSource` and discards the raw tokens. See Context data structure ."}],"referrer":[{"type":"string","description":"Host or URL of the site that linked the shopper to the storefront (e.g., “google.com”). Layers normalizes it to a lowercase host without `www.` ."}],"landingPath":[{"type":"string","description":"Storefront path the shopper first landed on this visit (e.g., “/collections/sale”). Layers removes the query string and keeps up to 512 characters."}],"channel":[{"type":"string","description":"Arrival channel. Layers derives it from UTMs, click identifiers, and the referring site, and keeps a value you send only when it can’t derive one. See Arrival channel ."}]},"description":"UTM parameters and marketing campaign information for attribution tracking."}],"experiments":[{"type":"object","properties":{},"description":"A/B test assignments for the shopper, keyed by experiment ID with the assigned group ID as the value (e.g., `{\"exp_123\": \"group_b\"}` ). Used by the Experiment Group contextual condition. The Layers app embed fills this from Intelligems automatically; values your storefront sends for the same experiment take precedence. Entries whose value isn’t a string are dropped."}],"customer":[{"type":"object","properties":{"signedIn":[{"type":"boolean","description":"Whether the customer is currently authenticated."}],"returning":[{"type":"boolean","description":"Whether this is a returning customer."}],"numberOfOrders":[{"type":"integer","description":"Total number of orders placed."}],"averageOrderValue":[{"type":"number","description":"Average order value in store currency."}],"daysBetweenOrders":[{"type":"integer","description":"Average days between orders."}],"daysSinceLastOrder":[{"type":"integer","description":"Days since the most recent order."}],"daysSinceOldestOrder":[{"type":"integer","description":"Days since the first order."}],"totalSpent":[{"type":"number","description":"Total amount spent in store currency."}],"tags":[{"type":"array","items":[{"type":"object","properties":{}}],"description":"Shopify customer tags on the shopper’s profile (e.g., `[\"vip\", \"wholesale\"]` ). Collected by the Storefront Pixel for signed-in customers; `null` for guests."}],"segments":[{"type":"array","items":[{"type":"object","properties":{}}],"description":"Shopify customer segment IDs the shopper belongs to. Server-resolved: Layers populates this from the signed-in `identity.customerId` on every request and ignores any value you send. `null` for guests and customers with no segment memberships. Available as `context.customer.segments` in contextual conditions ."}]},"description":"Aggregated customer behavior and purchase patterns for personalization."}],"market":[{"type":"string","description":"Explicitly set the Shopify Market for this request. Must be provided inside `context` ; it is not a top-level request body parameter. Used for market-specific product availability filtering and contextual pricing. Accepts a two-letter country code (e.g., `\"US\"` , `\"CA\"` ), a numeric Shopify Market ID (e.g., `\"12345\"` ), or a Shopify Market GID (e.g., `\"gid://shopify/Market/12345\"` ). When not provided, the market is automatically resolved from `context.geo.country` (or the shopper’s detected country for client-side requests). If no matching market is found, the store’s primary market is used as the fallback. When you send a two-letter country code that belongs to the resolved market, Layers also prices for that country, ahead of the shopper’s detected location. See Market resolution . Behavior depends on the store’s market application mode (set under Settings > Search \u0026 Discovery > Search Behavior , in the Markets card): Restrict to market catalog — Products are filtered to only those available in the resolved market, and market-specific pricing is applied Adjust pricing only — The full catalog remains visible, but variant prices are swapped to market-specific values where available Ignore markets (default) — Market resolution is skipped entirely; base catalog and base pricing are used for all shoppers"}],"session":[{"type":"object","properties":{"returning":[{"type":"boolean","description":"Whether the current session belongs to a returning visitor. Layers derives this from the storefront’s session cookie when not provided."}]},"description":"Session-level signals about the current visit."}],"locale":[{"type":"string","description":"Storefront locale code (e.g., `\"en\"` , `\"fr\"` , `\"pt-br\"` ). Case-insensitive; Layers normalizes to lowercase. When the locale is published in Shopify and served by the resolved market, Layers returns translated display text (titles, descriptions, option values, filter labels) while IDs, prices, and filter values stay in the source language. Regional locales fall back to their base language ( `pt-br` uses `pt` ). The store’s primary locale returns source text. See Translations ."}],"currency":[{"type":"string","description":"ISO 4217 currency code (e.g., `\"USD\"` , `\"EUR\"` ). Case-insensitive; Layers normalizes to uppercase. When Layers can resolve a currency from the shopper’s market or pricing context, the server-resolved value takes precedence."}],"b2bCompany":[{"type":"string","description":"Shopify B2B company location identifier. When `identity.companyLocationId` is provided, Layers resolves the company location server-side and the server value takes precedence."}],"shoppingChannel":[{"type":"string","description":"The shopping channel the customer is browsing from. Used for channel-specific merchandising, sorting, and analytics segmentation. Automatically detected from request headers when not provided (e.g., mobile app requests via Tapcart, Fuego, or Mobiloud Canvas are detected as `\"app\"` ). Accepted values: `\"web\"` — Standard web browser (default) `\"app\"` — Mobile app (e.g., Tapcart, Fuego, Mobiloud Canvas)"}],"custom":[{"type":"object","properties":{},"description":"Custom contextual data specific to your implementation. Structure is flexible and can contain any key-value pairs relevant to your use case."}]},"description":"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."}]}}],"examples":{"example":{"value":{"attributes":["\u003cstring>"],"filter_group":{},"pagination":{"page":123,"limit":123},"facets":["\u003cstring>"],"retrieveFacetCount":true,"includeFacetRanges":true,"enrichFacetMetaobjects":true,"identity":{"deviceId":"\u003cstring>","sessionId":"\u003cstring>","customerId":"\u003cstring>","companyLocationId":"\u003cstring>"},"context":{"geo":{"country":"\u003cstring>","province":"\u003cstring>","city":"\u003cstring>"},"productsInCart":[{"title":"\u003cstring>","price":123,"type":"\u003cstring>","productId":"\u003cstring>","variantId":"\u003cstring>","options":{},"quantity":123}],"freeShippingThreshold":123,"productsViewed":[{"id":"\u003cstring>","at":123,"title":"\u003cstring>","type":"\u003cstring>","variantId":"\u003cstring>","options":{}}],"productsPurchased":[{"title":"\u003cstring>","price":123,"type":"\u003cstring>","productId":"\u003cstring>","variantId":"\u003cstring>","options":{}}],"priorSearches":[{"searchQuery":"\u003cstring>","hadClick":true,"hasResults":true,"fromPage":"\u003cstring>"}],"marketing":{"source":"\u003cstring>","medium":"\u003cstring>","campaign":"\u003cstring>","term":"\u003cstring>","content":"\u003cstring>","clickIds":{},"referrer":"\u003cstring>","landingPath":"\u003cstring>","channel":"\u003cstring>"},"experiments":{},"customer":{"signedIn":true,"returning":true,"numberOfOrders":123,"averageOrderValue":123,"daysBetweenOrders":123,"daysSinceLastOrder":123,"daysSinceOldestOrder":123,"totalSpent":123,"tags":[{}],"segments":[{}]},"market":"\u003cstring>","session":{"returning":true},"locale":"\u003cstring>","currency":"\u003cstring>","b2bCompany":"\u003cstring>","shoppingChannel":"\u003cstring>","custom":{}}}}}}}},"response":{"200":{"application/json":{"schemaArray":[{"type":"object","properties":{"search_id":[{"type":"string","description":"ULID identifier for the prepared search. Valid for 15 minutes."}]}}],"examples":{"example":{"value":{"search_id":"\u003cstring>"}}}}}},"deprecated":false}},"jsLinks":["/_mintlify/custom/protoninc/d2da920448b9ce07/track.js"],"subdomain":"protoninc","siteName":"Layers","title":"Text Search: Prepare Search - Layers","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-03T14:45:11.611Z","originalFileLocation":"api-reference/search-prepare.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Prepare Search API endpoint that starts a search asynchronously so personalization and ranking can run in the background during a redirect or page load.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Layers\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/protoninc/-Zid9_7urMZu-aPC/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/protoninc/-Zid9_7urMZu-aPC/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/protoninc/-Zid9_7urMZu-aPC/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/protoninc/-Zid9_7urMZu-aPC/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/protoninc/-Zid9_7urMZu-aPC/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/protoninc/-Zid9_7urMZu-aPC/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/protoninc/-Zid9_7urMZu-aPC/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/protoninc/-Zid9_7urMZu-aPC/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/protoninc/-Zid9_7urMZu-aPC/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Text Search: Prepare Search - Layers\">\u003cmeta data-mint-head property=\"og:description\" content=\"Prepare Search API endpoint that starts a search asynchronously so personalization and ranking can run in the background during a redirect or page load.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Layers\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.uselayers.com/api-reference/search-prepare\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://protoninc.mintlify.site/_mintlify/api/og/v2?division=Text+Search\u0026amp;title=Text+Search%3A+Prepare+Search\u0026amp;description=Prepare+Search+API+endpoint+that+starts+a+search+asynchronously+so+personalization+and+ranking+can+run+in+the+background+during+a+redirect+or+page+load.\u0026amp;theme=a10a6113a77cea89cec87611\u0026amp;signature=07668e17946634efb59d2ed3da2ce8e253708a97f1b16f504de4da8f3b19796d\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Text Search: Prepare Search - Layers\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Prepare Search API endpoint that starts a search asynchronously so personalization and ranking can run in the background during a redirect or page load.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://protoninc.mintlify.site/_mintlify/api/og/v2?division=Text+Search\u0026amp;title=Text+Search%3A+Prepare+Search\u0026amp;description=Prepare+Search+API+endpoint+that+starts+a+search+asynchronously+so+personalization+and+ranking+can+run+in+the+background+during+a+redirect+or+page+load.\u0026amp;theme=a10a6113a77cea89cec87611\u0026amp;signature=07668e17946634efb59d2ed3da2ce8e253708a97f1b16f504de4da8f3b19796d\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/protoninc/-Zid9_7urMZu-aPC/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Layers\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#607FFD\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.uselayers.com/api-reference/search-prepare\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/search-prepare.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.uselayers.com/#organization\",\"name\":\"Layers\",\"url\":\"https://docs.uselayers.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/protoninc/PNs-gxGUVcdBDEEC/logo.svg?fit=max\u0026auto=format\u0026n=PNs-gxGUVcdBDEEC\u0026q=85\u0026s=989e3194cb32f07e7018b8b7186b9007\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.uselayers.com#website\",\"name\":\"Layers\",\"url\":\"https://docs.uselayers.com\",\"publisher\":{\"@id\":\"https://docs.uselayers.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.uselayers.com/api-reference/search-prepare#webpage\",\"url\":\"https://docs.uselayers.com/api-reference/search-prepare\",\"name\":\"Text Search: Prepare Search\",\"description\":\"Prepare Search API endpoint that starts a search asynchronously so personalization and ranking can run in the background during a redirect or page load.\",\"dateModified\":\"2026-11-03T14:45:11.611Z\",\"isPartOf\":{\"@id\":\"https://docs.uselayers.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.uselayers.com/api-reference/search-prepare#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.uselayers.com/api-reference/search-prepare#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Layers\",\"item\":\"https://docs.uselayers.com\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Text Search: Prepare Search\",\"item\":\"https://docs.uselayers.com/api-reference/search-prepare\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.uselayers.com/api-reference/search-prepare#apireference\",\"headline\":\"Text Search: Prepare Search\",\"name\":\"Text Search: Prepare Search\",\"description\":\"Prepare Search API endpoint that starts a search asynchronously so personalization and ranking can run in the background during a redirect or page load.\",\"url\":\"https://docs.uselayers.com/api-reference/search-prepare\",\"mainEntityOfPage\":{\"@id\":\"https://docs.uselayers.com/api-reference/search-prepare#webpage\"},\"dateModified\":\"2026-11-03T14:45:11.611Z\",\"publisher\":{\"@id\":\"https://docs.uselayers.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.uselayers.com#website\"}}]}\u003c/script>","siteName":"Layers","nav":{"global":null,"anchors":[{"anchor":"Documentation","pages":[{"title":"Documentation","href":"/introduction"}]},{"anchor":"Help Center","icon":"map","pages":[{"title":"Help Center","href":"/help/onboarding/install"}]},{"anchor":"Developers","icon":"code","pages":[{"title":"Developers","href":"/developers/overview"}]},{"anchor":"API Reference","icon":"rectangle-terminal","tabs":[{"tab":"Storefront API","groups":[{"group":"Browse","pages":[{"api":"POST /browse/{collection_handle}","title":"Browse API: Browse Collection Page","sidebarTitle":"Collection Page","description":"Browse API endpoint to fetch, filter, sort, and paginate merchandised collection pages in your catalog with facets, pins, and personalization applied.","href":"/api-reference/browse"}]},{"group":"Product Search","pages":[{"group":"Text Search","pages":[{"api":"POST /search/{searchQuery}/prepare","title":"Text Search: Prepare Search","sidebarTitle":"Prepare Search","href":"/api-reference/search-prepare"},{"api":"POST /search/{searchQuery}/execute","title":"Text Search: Execute Search","sidebarTitle":"Execute Search","description":"Text Search API endpoint to run semantic product searches with typo tolerance, query understanding, faceting, and personalization across your catalog.","href":"/api-reference/search"},{"api":"POST /search/feedback","title":"Text Search: Submit Feedback","sidebarTitle":"Submit Feedback","href":"/api-reference/search-feedback"}]},{"group":"Image Search","pages":[{"api":"POST /images/upload","title":"Image Search: Upload Image","sidebarTitle":"Upload Image","href":"/api-reference/upload-image"},{"api":"POST /search/image","title":"Image Search: Execute Search","sidebarTitle":"Execute Search","href":"/api-reference/search-image"}]},{"group":"Autocomplete","pages":[{"api":"GET /search/complete?query={query}","title":"Autocomplete: Get Suggestions","sidebarTitle":"Get Suggestions","href":"/api-reference/predict"}]},{"api":"POST /search/product/{searchProductId}","title":"Search API: Similar Products","sidebarTitle":"Similar Products","href":"/api-reference/similar-products"}]},{"group":"Content Search","pages":[{"api":"POST /search/content/{searchQuery}/execute","title":"Content Search: Execute Search","sidebarTitle":"Execute Search","href":"/api-reference/search-content"}]},{"group":"Blocks","pages":[{"api":"POST /blocks/{blockId}/products","title":"Blocks API: Get Block Products","sidebarTitle":"Block Products","href":"/api-reference/blocks"}]},{"group":"Facets","pages":[{"api":"POST /{collection_handle}/facets","title":"Facets API: Get Collection Facets","sidebarTitle":"Collection Facets","href":"/api-reference/facets"}]},{"group":"Utilities","pages":[{"api":"GET /sort-orders","title":"Sort Orders API: Get Available Sort Orders","sidebarTitle":"Sort Orders","href":"/api-reference/sort-orders"}]}]},{"tab":"Tracking API","pages":[{"title":"Tracking API","href":"/tracking-api/overview"}]}]},{"anchor":"Integrations","icon":"plug","href":"https://www.uselayers.com/integrations?utm_source=docs\u0026utm_medium=referral\u0026utm_campaign=docs-to-site"}]},"basePath":"","title":"Text Search: Prepare Search - Layers","buildId":"dpl_8LJbrAiZvr1K98WQNZXCyY5AvT34","deploymentId":"dpl_8LJbrAiZvr1K98WQNZXCyY5AvT34","dynamics":["c2aa737661","2b790eda92","b0f84f53ff"],"chunks":["OpenApiReferenceProvider-i2a3QZ8E.js","utils-ChLwp8m0.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-DRktVTDc.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-CA2pEs4T.js","snippetPresets-ClQ6XrKD.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-Ct_Lv36y.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-Cn2PYw9e.js","shallow-rkyymjXQ.js","getApiPlaygroundDisplay-BB9vkXtE.js","CodeSnippet-Bm5RU7m1.js","CodeSnippets-BgU9Deuz.js","Page-BUDYNlhG.js","getPastedJson-BD-6NNum.js","icon-8Z6tud2e.js","MethodPill-Tuzr4g3V.js","DuplicateIcon-0ceWFYhN.js","createIcon-FBXow_ST.js","DynamicMarkdown-CD8713Yy.js","SectionHeading-7zgzQbH-.js","axios-vUo_bRtp.js"]}