Discovery

Count records matching criteria

Returns the number of records matching the given criteria. Counts the bytes scanned toward your organization's compute limit. Requires 'discovery' scope. Provide exactly one of: filters (flat array), filter_groups (compound AND/OR groups), segment_id (a saved segment), audience_id (a saved audience), or segment_ids + set_logic (combine multiple segments). Sending both filters and filter_groups returns 400 AMBIGUOUS_INPUT; sending none returns 400 NO_INPUT_SPECIFIED. Count, lookup, crosstab, and overlap all preserve full group/combinator structure: each included segment's own AND/OR groups are evaluated intact, and an audience's excluded segments are always subtracted (AND NOT), regardless of set_logic.

post/v1/discovery/count

Request

  • Base URL: https://api.infiniteaudience.ai
  • URL: https://api.infiniteaudience.ai/v1/discovery/count
  • Auth: HTTP bearer

Request body

segment_idstring

ID of a saved segment to count.

audience_idstring

ID of a saved audience to count.

segment_idsstring[]

IDs of multiple segments to combine (requires set_logic).

set_logic'union' | 'intersection'

How to combine segment_ids: union = match ANY segment (OR); intersection = match EVERY segment (AND).

excluded_segment_idsstring[]

Ad-hoc "A minus B" preview — segments to subtract from the segment_ids composition, without persisting an audience. Only meaningful alongside segment_ids; do not send set_logic: 'exclusion' (invalid) — exclusion is always modeled via this separate param.

group_bystring

Optional attribute to group counts by (e.g. 'state', 'gender').

Response

Record count result.

countinteger
matched_countinteger

Only present when the resolved composition includes at least one included matched-subtype segment — the subset of count that came from an identity-resolution match.

warningsstring[]

Present only when the resolved segment_id/segment_ids/ audience_id composition includes a non-filter or mixed subtype AND group_by/breakdowns were requested — those are not yet available for non-filter or mixed-subtype compositions, so the count is still returned but without the requested grouping.

Example response

{
  "groups": [
    {
      "group_value": "California",
      "count": 1200000
    },
    {
      "group_value": "Texas",
      "count": 980000
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.