Skip to main content
POST
Preview segment
Use this endpoint to test filter conditions against an audience’s contacts without saving a segment — powers the “Preview Contacts” step of the Create Segment modal.

Endpoint

POST /segment/preview Content-Type: application/json Authentication: Required (workspace auth)

Request Body

Filter Condition Operators

operator must be one of:
This flat { field, operator, value } format is different from the CONDITIONLIST tree accepted by Create Segment’s filter_conditions. Passing a CONDITIONLIST payload here will not be understood — it is read as { conditions: [...] } and, having no conditions array of its own, is treated as an empty filter (matches everything).

Response

Behavior

  • Nothing is persisted — this endpoint only evaluates the filter.
  • Only active (non-soft-deleted) audience contacts are considered.
  • mobile_no in the sample is masked when the workspace’s company has phone number masking enabled.

Error Cases

Example cURL

Headers

token
string
required

API token for authentication

Body

application/json
audience_id
integer
required

Audience to preview against.

conditions
object[]

Flat filter conditions. Alias: filter_conditions. Omitted/empty matches every contact of the audience.

match_type
enum<string>

all = AND across conditions (default), any = OR across conditions.

Available options:
all,
any
sample_limit
integer

Max number of sample contacts to return (default 20).

Response

Preview computed successfully

size
integer

Number of contacts matching the filter

baselist_size
integer

Total active contacts in the audience

percentage
number

size / baselist_size * 100, rounded to 2 decimals

sample
object[]