API reference OpenAPI 3.1
POST /rules:simulate

Simulate rule

Bearer API key or staff session application/json operation simulateRule

Request

Content type: application/json · required

FieldTypeRequiredDescription
rule object Yes
Show 13 nested fields
FieldTypeRequiredDescription
key string Yes —
name string Yes —
description string No —
typology string No —
trigger object No
Show 2 nested fields
FieldTypeRequiredDescription
events array of string No —
filter string No —
features array of object No
Show 6 nested fields
FieldTypeRequiredDescription
name string Yes —
agg string Yes one of count, sum, avg, max, min, distinct_count, last, first, stddev
window string Yes —
group_by array of string No —
where string No —
field string No —
condition string Yes max length 4096
suppress_if string No max length 1024
groups array of object No
Show 2 nested fields
FieldTypeRequiredDescription
op string Yes one of all_of, any_of, not
conditions array of string Yes —
outcome object Yes
Show 5 nested fields
FieldTypeRequiredDescription
severity string Yes one of low, medium, high, critical
score number No —
decision string Yes one of ALLOW, REVIEW, HOLD, BLOCK
reason_code string Yes —
explain string No —
actions array of object No —
params object No —
schedule object No
Show 2 nested fields
FieldTypeRequiredDescription
mode string No one of realtime, cron, manual
cron string No —
transactions array of object Yes —
curl -X POST "$MONICHEK_API/rules:simulate" \
  -H "Authorization: Bearer $MONICHEK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "rule": {
    "key": "rule_key",
    "name": "Ada Okafor",
    "description": "Example note",
    "typology": "string",
    "trigger": {
      "events": [
        "string"
      ],
      "filter": "string"
    },
    "features": [
      {
        "name": "Ada Okafor",
        "agg": "count",
        "window": "string",
        "group_by": [
          "string"
        ],
        "where": "string",
        "field": "string"
      }
    ],
    "condition": "string",
    "suppress_if": "string",
    "groups": [
      {
        "op": "all_of",
        "conditions": [
          "string"
        ]
      }
    ],
    "outcome": {
      "severity": "low",
      "score": 0,
      "decision": "ALLOW",
      "reason_code": "string",
      "explain": "string"
    },
    "actions": [
      {}
    ],
    "params": {},
    "schedule": {
      "mode": "realtime",
      "cron": "string"
    }
  },
  "transactions": [
    {}
  ]
}'
const res = await fetch(`${MONICHEK_API}/rules:simulate`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${MONICHEK_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "rule": {
      "key": "rule_key",
      "name": "Ada Okafor",
      "description": "Example note",
      "typology": "string",
      "trigger": {
        "events": [
          "string"
        ],
        "filter": "string"
      },
      "features": [
        {
          "name": "Ada Okafor",
          "agg": "count",
          "window": "string",
          "group_by": [
            "string"
          ],
          "where": "string",
          "field": "string"
        }
      ],
      "condition": "string",
      "suppress_if": "string",
      "groups": [
        {
          "op": "all_of",
          "conditions": [
            "string"
          ]
        }
      ],
      "outcome": {
        "severity": "low",
        "score": 0,
        "decision": "ALLOW",
        "reason_code": "string",
        "explain": "string"
      },
      "actions": [
        {}
      ],
      "params": {},
      "schedule": {
        "mode": "realtime",
        "cron": "string"
      }
    },
    "transactions": [
      {}
    ]
  }),
});

const data = await res.json();
import os
import requests

res = requests.post(
    f"{os.environ['MONICHEK_API']}/rules:simulate",
    headers={"Authorization": f"Bearer {os.environ['MONICHEK_API_KEY']}"},
    json={
      "rule": {
        "key": "rule_key",
        "name": "Ada Okafor",
        "description": "Example note",
        "typology": "string",
        "trigger": {
          "events": [
            "string"
          ],
          "filter": "string"
        },
        "features": [
          {
            "name": "Ada Okafor",
            "agg": "count",
            "window": "string",
            "group_by": [
              "string"
            ],
            "where": "string",
            "field": "string"
          }
        ],
        "condition": "string",
        "suppress_if": "string",
        "groups": [
          {
            "op": "all_of",
            "conditions": [
              "string"
            ]
          }
        ],
        "outcome": {
          "severity": "low",
          "score": 0,
          "decision": "ALLOW",
          "reason_code": "string",
          "explain": "string"
        },
        "actions": [
          {}
        ],
        "params": {},
        "schedule": {
          "mode": "realtime",
          "cron": "string"
        }
      },
      "transactions": [
        {}
      ]
    },
)
print(res.json())
$ch = curl_init(getenv('MONICHEK_API') . '/rules:simulate');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('MONICHEK_API_KEY'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'rule' => [
            'key' => 'rule_key',
            'name' => 'Ada Okafor',
            'description' => 'Example note',
            'typology' => 'string',
            'trigger' => [
                'events' => [
                    'string',
                ],
                'filter' => 'string',
            ],
            'features' => [
                [
                    'name' => 'Ada Okafor',
                    'agg' => 'count',
                    'window' => 'string',
                    'group_by' => [
                        'string',
                    ],
                    'where' => 'string',
                    'field' => 'string',
                ],
            ],
            'condition' => 'string',
            'suppress_if' => 'string',
            'groups' => [
                [
                    'op' => 'all_of',
                    'conditions' => [
                        'string',
                    ],
                ],
            ],
            'outcome' => [
                'severity' => 'low',
                'score' => 0,
                'decision' => 'ALLOW',
                'reason_code' => 'string',
                'explain' => 'string',
            ],
            'actions' => [
                [],
            ],
            'params' => [],
            'schedule' => [
                'mode' => 'realtime',
                'cron' => 'string',
            ],
        ],
        'transactions' => [
            [],
        ],
    ]),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;

Responses

200 OK simulation application/json

No response example is published for this status.