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.
| Endpoint | GET /api/v2/facets |
| Auth | key |
| Returns | FacetCounts |
| Retryable | yes |
| Idempotent | yes |
Example
Section titled “Example”const facets = await crate.facets(); // requires apiKeyThrows
Section titled “Throws”api_key_required— if constructed without an apiKey.CrateAPIError— on a non-2xx response (401/402 if the key lacks access).