Count documents by type
Faceted counts over the archive — how many documents fall under each type, plus an optional second count bucketed by type, status or direction. Answers "how many" without paging through documents_search to count rows yourself: it takes the SAME filters, so call this first to see the shape of an answer before deciding whether to list the documents behind it. The per-type counts ignore the type filter itself, so «quante fatture in entrata» stays visible even while another type is already selected. A count stops at 1000: count_capped: true means 1000 OR MORE — say so, never report it as an exact number.
Examples
- How many invoices do we have per status? GET /api/v1/rest/documents/facets?type=fattura_entrata&group=status
- How many documents are still being processed right now? GET /api/v1/rest/documents/facets?status=extracting
Request
- Base URL: https://api.custodo.ai
- URL: https://api.custodo.ai/api/v1/rest/documents/facets
- Auth: HTTP bearer
Query parameters
Free text, same grammar as documents_search. Omit to count everything.
Document type, by its key or its Italian name — narrows the group counts, never the per-type counts themselves (see above).
Filed on or after this day (inclusive).
Filed on or before this day (inclusive).
The same metadata-filter grammar as documents_search.
A second count, alongside the per-type one, bucketed by this axis — the totals a grid section heading would show. Keys: type a type id, area a macroarea key, status/direction their codes, created a YYYY-MM-DD day (Europe/Rome), size the lower bound in bytes of its order of magnitude, version/pages the number, extension e.g. PDF, title the title, labels/party the comma-joined ids of the labels or anagrafiche a document carries (one section per combination). An empty key is the documents with no value.
Headers
The organisation to act in. An API key is bound to exactly one, so this is optional for a key and must match the one it was minted for.
Response
Done. data is the tool’s own answer.
Changes
No recorded changes to this operation across all 1 revision of this API.