Skip to main content
POST
Check an audience expression

Authorizations

Authorization
string
header
required

Your project's secret key (pk_…, without the pub segment). Server-side only — never ship it to a browser. Get it from Settings → Projects in the dashboard.

Body

application/json

Provide exactly one of expression (inline) or segment (+ optional version) — both run through the identical validator and evaluator.

expression
object
required

Versioned, strictly validated audience rule. Example: { "version": 1, "root": { "kind": "all", "children": [ { "kind": "field", "field": { "kind": "trait", "key": "plan" }, "op": "eq", "value": "free" }, { "kind": "not", "child": { "kind": "event", "event": "used_csv_export" } } ] } }

Example:
sampleLimit
integer
default:10

Matching-user samples to return (0 to skip samples).

Required range: 0 <= x <= 25
segment
string

Saved segment to evaluate, by id (seg_…) or machine key. Provide exactly one of expression or segment.

version
integer

Segment version to evaluate; omitted = current.

Required range: x >= 1

Response

Check result.

expression
object
required

The normalized canonical expression (stable key order, event counts defaulted, membership lists sorted/deduped).

Example:
expressionHash
string
required

sha256 of the canonical serialization — equal hashes mean identical semantics.

summary
string
required

Deterministically derived readable summary. Display text, not a parseable format.

Example:

"trait plan is \"free\" and not (performed used_csv_export)"

diagnostics
object[]
required

Warnings that don't block: unobserved traits/events (with typo suggestions), zero matches, and similar.

evaluatedAt
integer
required

The single instant (epoch ms) every relative rule in this evaluation used.

countType
enum<string>
required
Available options:
exact
matchedCount
integer
required

Exact number of users currently matching.

totalUsers
integer
required

Total identified users in the project.

samples
object[]
required

Bounded, context-efficient sample of matching users: lifecycle fields plus only the referenced traits and event aggregates.

segment
object

Present when the evaluated audience came from a saved segment.