Skip to main content
POST
Preview a rule

Authorizations

Authorization
string
header
required

A project key (Developers → API keys). Keep it on your server, not in an app.

Headers

traceparent
string

W3C Trace Context; joins your trace to ours

Path Parameters

id
string
required

A rule_… ID or the rule's key

Example:

"order-points"

Body

application/json
days
integer
default:30

How many past days to look at, 1 to 90

Required range: 1 <= x <= 90
Example:

30

definition
object

Preview this instead of the saved version: an edit that is not saved yet

Response

Preview a rule

Nothing is given. The engine replays recorded events in memory

trigger
enum<string>
required

What starts the rule. Only an event rule has a replay: for the others the replay numbers are zero and schedule or balance says what can be known

Available options:
event,
schedule,
balance
schedule
object | null
required

Set for a rule that starts on a schedule

balance
object | null
required

Set for a rule that starts when a balance moves

rule
string
required

The rule's key

version
integer | null
required

The version previewed: the newest. Null when a definition was sent

period
object
required

The days a preview or the statistics looked at

events
integer
required

Events the rule listens for that were replayed

Required range: x >= 0
users
integer
required

People it would have reached

Required range: x >= 0
receipts
integer
required

Times it would have changed something

Required range: x >= 0
held
integer
required

Times it would have waited for a person (a hold); these change nothing until given

Required range: x >= 0
given
object[]
required

What it would have given, per unit. Negative for taking

effects
object[]
required

Not available yet. What its effects would have done, as counts. Never sent. Empty for a rule with no effects

skipped
object[]
required

Times it would not have applied, by reason

top_users
object[]
required

The people it would have changed the most for, largest first, up to 10

Maximum array length: 10
truncated
boolean
required

True when there were more events than a preview reads; it replayed the earliest ones

notes
string[]
required

What the preview does not know, so its numbers are read as an estimate