Skip to content

Get search facets

Request

Get facet definitions and counts for building filter UIs or refining search. Facet counts are optionally computed in the context of a search query and applied filters. Facet type can be: multi-select, select, tags, and so on, as configured in search filters.

Bodyapplication/jsonrequired
localestringrequired

Locale code (same as search).

fieldstring

If set, returns only the facet for this field (with values and counts). If omitted, returns all configured facets.

querystring

Search query; facet counts are computed in the context of this query.

filterArray of objects(FacetFilter)

Counts are computed with these filters applied.

facetQuerystring

Filter facet values using this string (for type-ahead in facet controls).

curl -i -X POST \
  https://redocly.com/_mock/docs/realm/customization/search-api/openapi/_search-facets \
  -H 'Content-Type: application/json' \
  -d '{
    "locale": "en"
  }'

Responses

Facet definitions with values and counts. If field is set in the request, returns an array with a single facet object; otherwise returns all configured facets.

Bodyapplication/json
Array [
namestring

Display name of the facet as shown in the UI.

fieldstring

Facet field name (for example: redocly_category, redocly_product).

typestring

Facet type (for example: multi-select, select, tags) as configured in search filters.

valuesArray of objects(FacetValueCount)

Available facet values with their result counts.

]
Response
[ { "name": "string", "field": "string", "type": "string", "values": [] } ]