Discovery

Cross-tabulate two dimensions across a population

Returns a pivot table of counts for two categorical dimensions (e.g. state × gender). Requires 'discovery' scope. Provide exactly one of: filters, filter_groups, segment_id, audience_id, or segment_ids + set_logic to define the population (same input shapes as /v1/discovery/count). Sending more than one returns 400 AMBIGUOUS_INPUT; sending none returns 400 NO_INPUT_SPECIFIED. A 400 SAME_FIELD is returned if row_field equals col_field. If you pass a segment, audience, or filter groups, full group/combinator structure is preserved — each segment's own AND/OR groups are evaluated intact, multiple composed segments are combined by set_logic, and an audience's excluded segments are always subtracted (AND NOT), regardless of set_logic. A total population below the 50-record privacy floor returns 422. Individual pivot cells may contain fewer than 50 records when the total population qualifies.

post/v1/discovery/crosstab

Request

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

Request body

segment_idstring

ID of a saved segment defining the population.

audience_idstring

ID of a saved audience defining the population.

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.

row_fieldstring required

Attribute for the row dimension (e.g. "state").

col_fieldstring required

Attribute for the column dimension (e.g. "gender"). Must differ from row_field.

row_labelstring

Human-readable row label (defaults to row_field).

col_labelstring

Human-readable column label (defaults to col_field).

max_rowsinteger

Max distinct row values, ordered by total count desc.

max_colsinteger

Max distinct column values, ordered by total count desc.

Response

Pivot table result.

row_fieldstring required
col_fieldstring required
row_labelstring required

Echoes row_label (defaults to row_field).

col_labelstring required

Echoes col_label (defaults to col_field).

rowsstring[] required

Distinct row values, ordered by total count desc.

columnsstring[] required

Distinct column values, ordered by total count desc.

cellsobject required

cells[rowValue][colValue] = record count.

displayed_countinteger

Sum of the returned visible cells.

truncatedboolean

True when row or column limits omit categories.

total_countinteger required

Total records matching the population input.

Changes

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