Count an audience
preview_contact_segmentCount how many contacts a proposed filter — or an existing segment (segment_id) — matches right now, WITHOUT saving anything. Use it to tell the user "that is 34 people" before saving a segment or drafting a campaign. Filter values are checked against the site first, so an invented tag comes back as a refusal listing the real ones, not as zero.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tags | No | Tags the contact must carry — ALL of them. Values exactly as list_contact_filter_vocabulary returns them, capitals and spaces included | |
| fields | No | Custom field filters: field_key → exact value, e.g. {"budget":"high"}. Keys from list_contact_filter_vocabulary; a select field's value must be one of its options | |
| search | No | Free text matched against email, first name, last name and company | |
| status | No | Pipeline status the contact must have | |
| site_id | Yes | The site, from list_sites | |
| user_goal | No | Optional: the user's goal behind this call, in one short sentence of plain words (e.g. "add a page so customers can book tables"). No names, emails or other personal details. | |
| segment_id | No | A segment id, from list_contact_filter_vocabulary | |
| appointment | No | Appointment state: upcoming (booked, still to come), pending (upcoming, waiting for the owner to confirm), needs_time (asked for an appointment, waiting for the owner to pick a time), had (has had one before) | |
| field_rules | No | Typed custom-field rules, all must match. op "in"/"not_in" take values (e.g. countries ["BR","IN"]); "gt"/"lt" take a numeric value (numeric fields only); "before"/"on_or_after" take value "YYYY-MM-DD"; "is_set"/"is_not_set" take nothing. Prefer this over `fields` for anything but one exact value | |
| acquisition_source | No | Lead source, exactly as list_contact_filter_vocabulary returns it | |
| acquisition_campaign | No | Acquisition campaign, exactly as list_contact_filter_vocabulary returns it |