Blocks API endpoint that returns product recommendations for a specific block using its configured strategy, fallback chain, and merchandising rules.
Documentation Index
Fetch the complete documentation index at: https://docs.uselayers.com/llms.txt
Use this file to discover all available pages before exploring further.
<YOUR_LAYERS_TOKEN>."8234567890123") or Shopify GID (e.g., "gid://shopify/Product/8234567890123"). Both formats are resolved automatically."456789012345") or collection handle (e.g., "summer-collection"). The system automatically resolves both numeric IDs and string handles.context.productsInCart instead)anchor_id instead. For collection anchors, anchor_id now accepts both collection IDs and handles.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, first_or_matched_variant, and variants. See the Product Schema for detailed descriptions."8234567890123") or a Shopify GID (e.g., "gid://shopify/Product/8234567890123"). Both formats are accepted and resolved automatically.Excluded products are filtered out before strategy ranking, safeguard checks, and fallback evaluation. If excluding products causes the primary block to fall below its minimum products safeguard, the fallback chain is used and exclusions are applied to fallback blocks as well."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:first_or_matched_variant and variants) includes the inventory_quantity, inventory_policy, and inventory_levels fields. This behavior is consistent across all storefront API endpoints — search, browse, and blocks. See Variant Schema Fields for details on these fields.totalResults and the requested page size. When a maximum products safeguard is configured, this reflects the capped total. When variant breakouts are enabled, the calculation is based on tile count.limit parameter from the request).retrieveFacetCount is true then an object with keys and values of the specified attributes. When variant breakouts are enabled, facet counts reflect tile counts rather than product counts. Empty values and literal "null" strings are automatically excluded from facet results.includeFacetRanges is true then an object with keys of the facet attribute code and value is an object with min/max.true when the block’s interaction strategy data is still being computed. In this state, the primary block returns empty results and the fallback chain is used instead. Once the strategy data is ready, this field is no longer included in the response.| Header | Description |
|---|---|
x-request-id | A unique identifier (ULID) for the request. This matches the attributionToken in the response body. |
x-layers-build | The Layers build version that served the request. |
X-Layers-Results-Cache | Indicates whether the response was served from the results cache. Returns HIT or MISS. |
Link | Contains rel="preload" directives for product images (up to 6 items). See Early hints for details. Only included when early hints are enabled (enabled by default). |
404 - Block not found
404 - Unable to get products
401 - Unauthorized