API reference OpenAPI 3.1
POST /decide

One-call transaction decision

Bearer API key or staff session application/json operation decide

Parameters

NameInTypeRequiredDescription
Idempotency-Key header string No stable per payment; retries replay safely

Request

Content type: application/json · required

FieldTypeRequiredDescription
transaction object No nested or flat txn fields
customer_ref string No —
mode string No one of enforce, shadow · default "enforce"
timeout_ms integer No min 1000 · max 30000
shadow_rule_set_version integer No —
curl -X POST "$MONICHEK_API/decide" \
  -H "Authorization: Bearer $MONICHEK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "transaction": {},
  "customer_ref": "string",
  "mode": "enforce",
  "timeout_ms": 1000,
  "shadow_rule_set_version": 1
}'
const res = await fetch(`${MONICHEK_API}/decide`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${MONICHEK_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "transaction": {},
    "customer_ref": "string",
    "mode": "enforce",
    "timeout_ms": 1000,
    "shadow_rule_set_version": 1
  }),
});

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

res = requests.post(
    f"{os.environ['MONICHEK_API']}/decide",
    headers={"Authorization": f"Bearer {os.environ['MONICHEK_API_KEY']}"},
    json={
      "transaction": {},
      "customer_ref": "string",
      "mode": "enforce",
      "timeout_ms": 1000,
      "shadow_rule_set_version": 1
    },
)
print(res.json())
$ch = curl_init(getenv('MONICHEK_API') . '/decide');
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([
        'transaction' => [],
        'customer_ref' => 'string',
        'mode' => 'enforce',
        'timeout_ms' => 1000,
        'shadow_rule_set_version' => 1,
    ]),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;

Responses

200 OK decision with triggered rules, latency and budget application/json
{
  "decision": "ALLOW",
  "mode": "shadow",
  "score": 99,
  "would_decide": {
    "decision": "BLOCK",
    "score": 99,
    "reason_codes": [
      "TM-SANC-003"
    ],
    "rule_set_version": 0,
    "triggered_rules": [
      {
        "rule_key": "tm_sanc_counterparty",
        "why": "sandbox counterparty"
      }
    ],
    "degraded": false
  },
  "reason_codes": [
    "TM-SANC-003"
  ],
  "triggered_rules": [
    {
      "rule_key": "tm_sanc_counterparty",
      "why": "sandbox counterparty"
    }
  ],
  "source": "decide",
  "latency_ms": 1,
  "degraded": false,
  "alert_ids": []
}

Error responses

StatusMeaningBody
401 Unauthorized RFC 9457 problem
422 Unprocessable Entity RFC 9457 problem
429 Too Many Requests RFC 9457 problem

Errors use the RFC 9457 problem format with a stable code.