workspaces_leads_facets
Returns distinct values and their counts for a given field across workspace leads. Use this to understand data distribution before building filter conditions — especially to check whether a field uses NULL vs a zero/empty value.
Supports context fields and Lead model fields (status, contact_type). Discovery fields are not supported yet.
Results are ordered by count descending, capped at limit. Each entry is {value, count}, plus label for fields with display choices (status, contact_type) — filter on value, show label.
This powers the value checklist in the lead list's column menus, so it accepts the same qf parameter as workspaces_leads_list: pass the other columns' active quick filters and the counts returned here will match what is on screen. Any qf entry for field itself is ignored, so unticking a value does not make the other values disappear.
Method: GET /api/v1/workspaces/{workspace_sqid}/leads/facets/
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"field": "<field>"
},
"name": "workspaces_leads_facets"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | No | Only return values containing this substring — for the search box above a value checklist. | |
| qf | No | Ad-hoc column filters (same JSON format as `workspaces_leads_list`). Entries for `field` itself are ignored. | |
| field | Yes | Field key to facet on (e.g. `churn_reason`, `status`). | |
| limit | No | Max distinct values to return (default 50, max 200). | |
| filter | No | FilterConfig sqid — apply this filter before computing the facet. | |
| segment | No | Segment sqid — scope the facet to leads in this segment. |