Menu

Preview segment rules

POST/v1/segments/preview

Requires an API key with the segments:read scope. About keys and scopes

Evaluates a rule tree that has not been saved and returns who it would match. Use this to check a segment definition before creating it.

Request body

rulesobjectrequired

The unsaved rule tree to evaluate.

One of 2 shapes
Match all
1 child attribute
allobject[]required

Every rule or nested group must match.

at least 1 item · at most 20 items

Match any
1 child attribute
anyobject[]required

At least one rule or nested group must match.

at least 1 item · at most 20 items

Returns

Returns 200 OK with a AudienceCount in data. Otherwise returns an error; Errors lists every code and which to retry.

countintegerrequired

Contacts the rules match, counted up to 10000.

min 0 · max 9007199254740991

countExactbooleanrequired

False when count is the cap and more contacts match.