Skip to content

crate.facets()

facets(opts?: RequestOptions): Promise<FacetCounts>

A precomputed facet snapshot — the available filter values and their counts. Call it before building a search UI (or an agent query) so you filter by values that actually return results. Key-gated.

EndpointGET /api/v2/facets
Authkey
ReturnsFacetCounts
Retryableyes
Idempotentyes
const facets = await crate.facets(); // requires apiKey
  • api_key_required — if constructed without an apiKey.
  • CrateAPIError — on a non-2xx response (401/402 if the key lacks access).