Facets API: Get Collection Facets
Facets
Facets API: Get Collection Facets
Facets API endpoint that returns facet values and result counts for a collection without running a full browse query, ideal for filter sidebars.
POST
Facets API: Get Collection Facets
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.
Authorization
Token-based authentication header in the form of
<YOUR_LAYERS_TOKEN>.Headers
Path parameters
The handle of the collection to retrieve facets for.
Body
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:If the count of each facet value should be calculated
If you want a min/max range for numeric facets such as price.
Refer to our dedicated Filter Expressions guide to learn more about filter expressions.
Response
An object where each key is a facet attribute code and the value is an object of facet values with their counts. Only returned when
retrieveFacetCount is true.An object where each key is a facet attribute code and the value is an object with
min and max properties. Only returned when includeFacetRanges is true.When to use
Use this endpoint when you need facet data without fetching product results. Common scenarios include:- Pre-loading filter options: Fetch available filter values before the user starts browsing
- Sidebar filters: Build filter UIs that show available options and counts independently of the product grid
- Reducing payload size: Avoid fetching full product data when you only need facet information
retrieveFacetCount enabled instead.