Skip to main content
POST
Simulate a rule
Evaluates a single saved rule against sample event data or a stored event_id without modifying balances, state, or ledger history.
  • Participant context: Pass participant_id to load live state and balances, or participant_state for synthetic inputs. Omitting both evaluates against empty defaults (with a missing_participant_context warning if the condition reads participant state), except with event_id, which loads the stored event’s participant as they are now.
  • Scope: Single-rule simulation does not inspect live lots or evaluate other rules; use a rule configuration simulation to test cross-rule ordering, stop_after_match, and lot-level effects.
When the condition matches, evaluation.results previews each action’s resolved outcome (targeted actions also include resolved_target, or error if unresolvable):
For simulation workflows and examples, see the Testing guide.

Authorizations

Authorization
string
header
default:sk_...
required

Send your API key as Authorization: Bearer <key>.

Path Parameters

rule_id
string<uuid>
required

The rule's id.

Body

application/json

Sample event and optional participant state

Simulates a saved rule against an event and a participant state. Nothing is saved.

diagnostics
boolean

Include clause-by-clause CEL evaluation diagnostics in the response.

Example:

true

event
object

Sample event data to evaluate against the rule. Numbers with a magnitude greater than 2^53 are rejected to prevent loss of precision. Supply exactly one of event or event_id.

Example:
event_id
string<uuid>

ID of a stored event to test. Uses its original data and timestamp, and the rule version recorded for that event when available.

Example:

"e5dc1b6a-7f3d-4e2a-8c1b-9a0f4d7e6c05"

event_timestamp
string<date-time>

When the sample event occurred. Used to check whether it falls within the rule's active window. Cannot be used with event_id, which uses the stored timestamp.

Example:

"2027-01-15T10:30:00Z"

event_type
string

The name of the sample event, such as purchase: the event_type an ingested event carries. Required with event, and the rule reads it as event.type. The event object must not contain a type key. Omit it with event_id, which uses the stored event's name.

Example:

"purchase"

participant_id
string<uuid>

Real participant whose current tags, counters, attributes, and tiers are loaded as simulation context. Mutually exclusive with participant_state.

Example:

"f7a8b9c0-1d2e-4f3a-b4c5-d6e7f8a9b006"

participant_state
object

Synthetic participant state (tags, counters, attributes, tier). Mutually exclusive with participant_id.

Example:

Response

Simulation result

The result of a rule simulation: the rule, the evaluation and any warnings.

evaluation
object

Evaluation contains the simulation results

rule
object

Rule contains metadata about the rule that was simulated

warnings
object[]

Advisories about the simulation context. For example, missing_participant_context means the condition reads participant state but the request sent neither participant_id nor participant_state, so the condition ran against empty defaults.