Skip to main content
POST

Authorizations

Authorization
string
header
required

Path Parameters

project_id
string
required

Body

application/json
rule
object
required

The rule body on a create or update. On an update, send only the fields you are changing.

Response

201

A data rule on a project. The rule's identity is stable across edits; the condition lives on its latest version.

id
string

Rule friendly ID.

Example:

"rule_Qb3k9TzdL0pWnXyz"

name
string
rule_type
enum<string>

Derived from action. Read-only.

Available options:
alert,
substitution
action
enum<string>

alert flags the matching record and changes nothing. substitute replaces the matching value with one derived from method_chain. Only data point rules may substitute.

Available options:
alert,
substitute
method_chain
object[]

Ordered substitution candidates. The first method that resolves wins. Empty on alert rules.

target_type
enum<string>

data_point evaluates event data as it arrives. model evaluates model outputs after a batch calculation.

Available options:
data_point,
model
status
enum<string>
Available options:
active
enabled
boolean
rule_text
string

The condition, in the rule expression language.

Example:

"{{data-point.ambient-temperature-c}} < 0"

subject_slugs
string[]

On an alert rule, narrows which of the values the condition reads may be flagged. On a substitute rule, names the single value the rule corrects.

alert_message
string | null

Shown on the records this rule flags. Required on an alert rule. Optional on a substitute rule, where it covers the records whose method chain resolved nothing, and Mangrove supplies a default.

version
integer
effective_from
string<date> | null
effective_to
string<date> | null
model_id
string | null

Model rules only.

model_name
string | null
created_by
string
created_at
string<date-time>
updated_at
string<date-time>