Skip to main content
POST
/
browse
/
{collection_handle}
Browse API: Browse Collection Page
curl --request POST \
  --url https://app.uselayers.com/api/storefront/v1/browse/{collection_handle} \
  --header 'Accept: <accept>' \
  --header 'Content-Type: <content-type>' \
  --header 'X-Storefront-Access-Token: <x-storefront-access-token>' \
  --data '
{
  "sort_order_code": "<string>",
  "dynamicLinking": {
    "products": [
      {}
    ]
  },
  "defaultSelectedOptions": [
    {
      "optionCode": "<string>",
      "value": "<string>"
    }
  ],
  "attributes": [
    "<string>"
  ],
  "filter_group": {},
  "pagination": {
    "page": 123,
    "limit": 123
  },
  "facets": [
    "<string>"
  ],
  "retrieveFacetCount": true,
  "includeFacetRanges": true,
  "discountEntitlements": [
    {
      "entitled": {
        "all": true,
        "products": [
          "<string>"
        ],
        "variants": [
          {}
        ],
        "collections": [
          "<string>"
        ]
      },
      "discount": {
        "type": "<string>",
        "value": 123
      }
    }
  ],
  "identity": {
    "deviceId": "<string>",
    "sessionId": "<string>",
    "customerId": "<string>"
  },
  "preview_id": "<string>",
  "forceHideOutOfStock": true,
  "context": {
    "geo": {
      "country": "<string>",
      "province": "<string>",
      "city": "<string>"
    },
    "productsInCart": [
      {
        "title": "<string>",
        "price": 123,
        "type": "<string>",
        "productId": "<string>",
        "variantId": "<string>",
        "options": {}
      }
    ],
    "productsPurchased": [
      {
        "title": "<string>",
        "price": 123,
        "type": "<string>",
        "productId": "<string>",
        "variantId": "<string>",
        "options": {}
      }
    ],
    "priorSearches": [
      {
        "searchQuery": "<string>",
        "hadClick": true,
        "hasResults": true,
        "fromPage": "<string>"
      }
    ],
    "marketing": {
      "source": "<string>",
      "medium": "<string>",
      "campaign": "<string>",
      "term": "<string>"
    },
    "customer": {
      "signedIn": true,
      "returning": true,
      "numberOfOrders": 123,
      "averageOrderValue": 123,
      "daysBetweenOrders": 123,
      "daysSinceLastOrder": 123,
      "daysSinceOldestOrder": 123,
      "totalSpent": 123
    },
    "shoppingChannel": "<string>",
    "custom": {}
  }
}
'
POST /storefront/v1/browse/summer-collection

{
  "sort_order_code": "best-sellers",
  "pagination": {
    "page": 1,
    "limit": 20
  },
  "retrieveFacetCount": true,
  "facets": ["vendor", "product_type"],
  "context": {
    "geo": {
      "country": "US",
      "province": "California"
    },
    "marketing": {
      "source": "google",
      "medium": "cpc",
      "campaign": "summer-sale"
    },
    "shoppingChannel": "web"
  },
  "identity": {
    "sessionId": "abc123",
    "deviceId": "device-uuid"
  }
}

Authorization

X-Storefront-Access-Token
string
required
Token-based authentication header in the form of <YOUR_LAYERS_TOKEN>.

Headers

Content-Type
string
default:"application/json"
required
Accept
string
default:"application/json"
required

Path parameters

collection_handle
string
required
The handle of the collection you wish to browse.

Body

sort_order_code
string
Code of the sort order. If omitted, the collection’s default sort order will be used (configured via the Layers dashboard or the layers.default_sort_order metafield on the collection).
dynamicLinking
object
Dynamic Linking allows you to promote specific products to the top of the first page of results. This feature takes priority over merchandising rules and sort orders.
If the Layers tracking pixel is installed, this parameter is automatically injected when customers arrive with a utm_products URL parameter (e.g., ?utm_products=summer-dress-blue_classic-tee-white_beach-hat). See Dynamic Linking for ads for details.
defaultSelectedOptions
array
Specify which product variants should be selected by default in the first_or_matched_variant field. This is useful for scenarios like defaulting to a specific birthstone option in a jewelry collection.Behavior:
  • Uses OR logic - selects the first variant matching ANY of the specified option values
  • Falls back to the first variant by position if no match is found
  • Automatically skipped when any option or variant filters are applied (filters take precedence)
  • Only affects the first_or_matched_variant field in the response
  • Works with Variant Breakouts - product tiles respect your default selected options, and variant tiles respect non-breakout default selected options (preferring variants that match your preferences within each breakout group, with fallback to position ordering)
Example:
{
  "defaultSelectedOptions": [
    {
      "optionCode": "birthstone",
      "value": "February"
    }
  ]
}
Multiple options example (OR logic):
{
  "defaultSelectedOptions": [
    {
      "optionCode": "birthstone",
      "value": "February"
    },
    {
      "optionCode": "birthstone",
      "value": "March"
    }
  ]
}
This will select variants with either February OR March birthstone, preferring the first match found.
attributes
string[]
Product attributes to include in the response. By default, all attributes are included. 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, first_or_matched_variant, and variants. See the Product Schema for detailed descriptions.
filter_group
object
Refer to our dedicated Filter Expressions guide to learn more about filter expressions.
pagination
Pagination Object
facets
string[]
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:
// Exact facet codes
"facets": ["vendor", "options.Size", "options.Color"]

// Wildcard pattern
"facets": ["options.*"]

// Mixed exact and wildcard
"facets": ["vendor", "options.*", "metafields.product.*"]
retrieveFacetCount
boolean
If the count of each facet value should be calculated
includeFacetRanges
boolean
If you want a min/max range for numeric facets such as price.
discountEntitlements
array
Apply discounts to products, variants, or collections. When provided, price-based sorting and filtering will use discounted prices. See the Discount Entitlements guide for detailed usage.
identity
object
User identity information for tracking and personalization. Automatically managed by the Storefront Pixel; required for headless integrations.
preview_id
string
When provided, the Browse API loads the specified preview rule instead of the collection’s active merchandising rule. Preview rules are temporary and expire one hour after creation.This parameter is automatically included when you open a preview URL from the Layers dashboard. You do not need to set it manually in production integrations.Behavior:
  • Overrides normal merchandising rule resolution for this request
  • Analytics and beacon events are not recorded for preview requests
  • Returns a 404 if the preview has expired or does not exist
forceHideOutOfStock
boolean
default:"false"
When set to true, products with no available variants are excluded from results regardless of the store-level out-of-stock visibility setting. If your store has location-based stock checking configured, the same location rules apply.This is useful when a specific browse integration or page requires strict in-stock filtering even though the store default allows out-of-stock products to appear.
Store-level out-of-stock demoting (the “At the end” option) does not apply to browse results. Browse relies on the Shopify collection itself for product ordering. When you set forceHideOutOfStock to true on a browse request, out-of-stock products are hidden entirely rather than demoted.
context
object
Contextual information about the customer’s session, behavior, and environment. Automatically collected by the Storefront Pixel; must be manually provided for headless integrations. See Contextual Information for implementation guidance.

Response

results
Array of Objects
totalResults
number
The total number of results. When variant breakouts are enabled, this reflects the count of tiles (both product and variant tiles) rather than just products.
page
number
The current page number.
totalPages
number
The total number of pages. Calculated based on tile count when variant breakouts are enabled.
facets
object
If 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.
facetRanges
object
If includeFacetRanges is true then an object with keys of the facet attribute code and value is an object with min/max.
attributionToken
string
A unique request identifier (ULID) for this API call. Use this token to correlate browse requests with analytics events via the Beacon API, and to match requests to entries in the Search Inspector.
_meta
object
_workflow
array of objects
An ordered trace of processing steps the engine performed to produce results for this request. Each entry represents a stage in the browse pipeline, recorded in the order it was executed. Use this field to understand which merchandising rules, sort orders, and boosts were applied.This field is useful for debugging browse behavior in development and is also surfaced in the Search Inspector panel.

Response headers

Every API response includes the following headers for request tracing and performance optimization:
HeaderDescription
x-request-idA unique identifier (ULID) for the request. This matches the attributionToken in the response body. Use it to correlate requests across your infrastructure or when contacting support.
x-layers-buildThe Layers build version that served the request.
X-Layers-Results-CacheIndicates whether the response was served from the results cache. Returns HIT when cached results were used, or MISS when results were computed fresh.
LinkContains rel="preload" directives for product images in the response (up to 6 items), enabling browsers and CDNs to begin fetching images before your application processes the JSON body. See Early hints for configuration options. Only included when early hints are enabled (enabled by default).

Variant breakouts

When variant breakouts are configured, results may include both product tiles and variant tiles. Each result includes a __typename field to identify the tile type:
__typename
string
Identifies the type of tile in the results:
  • "Product" - A standard product tile
  • "Variant" - An individual variant tile from a product with a configured breakout option

Variant tile fields

Variant tiles include additional fields to identify the specific variant:
product_id
number
The parent product ID. Use this to link back to the full product or group variants from the same product.
variant_id
number
The specific variant ID. For variant tiles, this matches the id field.
For variant tiles, the id field contains the variant ID (not the product ID). The title field is formatted as "{product title} - {option value}" by default (e.g., “Amethyst Ring - Rose Quartz”), but this can be configured per breakout. If the breakout’s “Include Option Value in Title” setting is disabled, the title will be the original product title. See the Variant Breakouts documentation for more details.
POST /storefront/v1/browse/summer-collection

{
  "sort_order_code": "best-sellers",
  "pagination": {
    "page": 1,
    "limit": 20
  },
  "retrieveFacetCount": true,
  "facets": ["vendor", "product_type"],
  "context": {
    "geo": {
      "country": "US",
      "province": "California"
    },
    "marketing": {
      "source": "google",
      "medium": "cpc",
      "campaign": "summer-sale"
    },
    "shoppingChannel": "web"
  },
  "identity": {
    "sessionId": "abc123",
    "deviceId": "device-uuid"
  }
}