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
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
This endpoint returns facet metadata only — it does not return product results, pagination fields, or anattributionToken. If you need products alongside facets, use the Browse API with retrieveFacetCount enabled instead.
Object whose keys are facet attribute codes and whose values are objects mapping each facet value to its result count. Only returned when
retrieveFacetCount is true.Object whose keys are facet attribute codes and whose values are objects with
min and max numeric properties. Only returned when includeFacetRanges is true.Echo of the filter group expressions that were applied when computing the counts. Useful for verifying that the request’s
filter_group was interpreted as expected.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.