TheDocumentation Index
Fetch the complete documentation index at: https://docs.uselayers.com/llms.txt
Use this file to discover all available pages before exploring further.
context parameter accepts the following structured data:
Geographic information
Location data used for regional merchandising and localized search results. For client-side requests, Layers automatically determines the customer’s location based on their IP address. For headless integrations making server-side API calls, you should pass geo information explicitly.Products in cart
Current cart contents help surface complementary products and influence relevance scoring.title(string, required): Product titleprice(string, optional): Product price as a stringtype(string, optional): Product typeproductId(string, optional): Shopify product IDvariantId(string, optional): Shopify variant IDoptions(object, optional): Key-value pairs of variant options
Purchase history
Previously purchased products inform recommendations and prevent over-promotion of already-owned items.title(string, required): Product titleprice(string, optional): Product price as a stringtype(string, optional): Product typeproductId(string, optional): Shopify product IDvariantId(string, optional): Shopify variant IDoptions(object, optional): Key-value pairs of variant options
Prior searches
Recent search queries and their outcomes help understand customer intent and refine relevance models.searchQuery(string, required): The search query texthadClick(boolean, required): Whether the customer clicked on any resultshadResults(boolean, required): Whether the search returned any results
Marketing attribution
UTM parameters and marketing campaign information for attribution tracking.source(string, optional): Marketing source (e.g., “google”, “facebook”)medium(string, optional): Marketing medium (e.g., “cpc”, “email”, “social”)campaign(string, optional): Campaign nameterm(string, optional): Search term or keyword
Customer profile
Aggregated customer behavior and purchase patterns for personalization.signedIn(boolean, optional): Whether the customer is currently authenticatedreturning(boolean, optional): Whether this is a returning customernumberOfOrders(integer, optional): Total number of orders placedaverageOrderValue(float, optional): Average order value in store currencydaysBetweenOrders(integer, optional): Average days between ordersdaysSinceLastOrder(integer, optional): Days since the most recent orderdaysSinceOldestOrder(integer, optional): Days since the first ordertotalSpent(float, optional): Total amount spent in store currency
Market
Identifies the Shopify Market for the current request. Used for market-specific product availability filtering, contextual pricing, and market-targeted merchandising rules.market(string, optional): The market identifier. 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").
market is not provided, Layers automatically resolves the market from the shopper’s country (via the geo.country field or IP-based geolocation for client-side requests). If no matching market is found, the store’s primary market is used as a fallback.
Application modes:
The store’s market application mode (configured in the Layers dashboard under Settings > Search & Discovery) controls how the resolved market affects results:
- Strict — Only products available in the resolved market appear in results, and market-specific pricing is applied to variants
- Pricing only — All products remain visible, but variant prices are swapped to market-specific values where available
- Off — Market resolution is skipped entirely; the base catalog and base pricing apply for all shoppers
price_range and variant price fields in API responses reflect the market-specific prices rather than the store’s base currency prices.
Shopping channel
Identifies the channel the customer is browsing from (web browser vs mobile app). Used for channel-specific merchandising rules, sorting, and analytics segmentation.shoppingChannel(string, optional): The shopping channel. Accepted values:"web"(default) or"app". When not provided, the platform automatically detects the channel from request headers (e.g., mobile app requests via Fuego, Tapcart or Mobiloud Canvas are detected as"app").
Custom context
Additional custom contextual data specific to your implementation.custom field accepts any arbitrary key-value pairs for implementation-specific context that doesn’t fit into the standard categories.