Skip to main content
POST
/
api
/
v3
/
transmon
/
rules
Create new rule
curl --request POST \
  --url https://api.dataspike.io/api/v3/transmon/rules \
  --header 'Content-Type: application/json' \
  --header 'ds-api-token: <api-key>' \
  --data '{
  "name": "limit price for new users",
  "status": "active",
  "event_type": "payment_pre",
  "rank": 20,
  "expression": "event.user_ds_registration == 0 && event.checkout_price > 1000",
  "causes": [
    "TST",
    "HI_PR"
  ],
  "action": "reject"
}'
"f81d4fae-7dec-11d0-a765-00a0c91e6bf6"

Authorizations

ds-api-token
string
header
required

Body

application/json

New rule definition

name
string
required

The name for rule

Example:

"limit price for new users"

status
enum<string>
required

The status of the rule (active or inactive)

Available options:
inactive,
active
Example:

"active"

event_type
enum<string>
required

The type of event should be processed with (transaction/payment) and when ("pre" - before AML/Anti-fraud checks, "post" - after). For example, "payment_pre" rule will be used for payments only and before AML/Anti-fraud checks

Available options:
transaction_pre,
transaction_post,
payment_pre,
payment_post
Example:

"payment_pre"

rank
integer
required

Rules are executed in order of sorting by the "rank" field

Example:

20

expression
string
required

The expression that should be checked by rule. Is the expression is true, than "causes" field will be added to the result and "action" will be performed (if given)

Example:

"event.user_ds_registration == 0 && event.checkout_price > 1000"

causes
string[]
required

The set of short strings that you'll see in result if the expression is true

Example:
["TST", "HI_PR"]
action
enum<string>

The action should be performed if the expression is true. "Reject" stops all other rules and checks

Available options:
reject
Example:

"reject"

Response

Created rule ID

UUID of created rule

Example:

"f81d4fae-7dec-11d0-a765-00a0c91e6bf6"