Skip to main content

POST /api/v1/segments/overlap

Computes pairwise overlap between 2-10 segments by querying their underlying PostgreSQL views. Returns overlap counts, percentages, and warnings for high-overlap pairs.

Request Body

FieldTypeRequiredDescription
segmentIdsstring[]YesArray of 2-10 segment IDs to compare
sampleSizeintegerNoMax customers per segment to sample (100-50000, default: 5000)

Example

Response

Response Fields

FieldTypeDescription
segmentsarrayEach segment’s ID, name, and sampled size
overlapsarrayPairwise overlap results
overlaps[].segmentsstring[]Pair of segment IDs
overlaps[].countintegerNumber of shared customers
overlaps[].percentintegerOverlap as percentage of the smaller segment
totalUniqueCustomersintegerDistinct customers across all segments
overlapWarningsstring[]Warnings when overlap is 30% or higher

Error Codes

CodeReason
400Fewer than 2 or more than 10 segment IDs
400Segment not found or segment has no materialized view

Roles

admin, editor, viewer See also: Segments