Skip to content

Preview who a rule would match

POST
/audience/management/v1/audiences/preview
curl --request POST \
--url https://api.ebitex.io/audience/management/v1/audiences/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "predicate": "example", "behaviours": [ { "id": "example", "kind": "example", "filter": "example", "minCount": 1, "days": 1, "scope": "example", "minMembers": 1 } ] }'

Counts the people a draft rule matches today and returns a sample of ten (the most recently changed), without saving anything. Send { "predicate": { … } }. A rule that reads the visit has no count: available is false and reason says why. The count stops at 100,000 (countCapped), and when the 6 second time budget runs out isEstimate is true and count is the matched share of the scanned people scaled to total. The sample carries each person’s name and primary email or phone.

It changes nothing, so it needs only the read scope although it is a POST, but it is the heaviest read here: each call costs ten requests of the key’s per-minute budget, and a call refused for the budget spends none.

Key: an Audience management key with audience.management.read (write also needs read; erase needs both).

Media typeapplication/json
object
predicate
required
One of:
null
behaviours
Array<object> | null
object
id
required
string
kind
required
string
filter
required
null | string
minCount
required
integer | string format: int32
/^-?(?:0|[1-9]\d*)$/
days
required
integer | string format: int32
/^-?(?:0|[1-9]\d*)$/
scope
null | string
minMembers
null | integer | string format: int32
/^-?(?:0|[1-9]\d*)$/
Examplegenerated
{
"predicate": "example",
"behaviours": [
{
"id": "example",
"kind": "example",
"filter": "example",
"minCount": 1,
"days": 1,
"scope": "example",
"minMembers": 1
}
]
}

{ "available", "reason", "count", "countCapped", "isEstimate", "scanned", "total", "computedAtUtc", "sample": [ { "id", "name", "channel" } ] }.

validation_failed: the rule is not a valid rule, or it nests more levels than a rule may.

missing_api_key or invalid_api_key: no key was sent, or it is unknown, revoked or expired, or it was not created from the Audience settings page.

payment_required: the organization’s subscription needs attention.

scope_denied: the key lacks this route’s scope. ip_denied: the caller’s address is outside the key’s allowed ranges. app_not_available: Audience is not enabled for the organization.

not_found: no such route.

rate_limited: the key spent its requests-per-minute budget; Retry-After says how long to wait. too_many_failed_authentications: too many bad keys from this address.