Rule Instance - Create

POST

Create Rule Instance

POST /rule-instances endpoint is used to create a new rule instance. A rule instance can be thought of as a live entity, that runs checks for for transactions. Rule instances use Rule templates as the blueprint.

Every rule instance has an associated ruleId of the rule from which it is derived. The details of the rule and the required parameters is found by GET /rules endpoint.

Once a rule instance is created, flagright generates an ID for the rule instance and also stores related metadata like:

  • id - unique identifier for the rule instance
  • runCount - how many times the rule instance was run
  • hitCount - how many times a rule was hit
  • createdAt & updatedAt - timestamps

They are generated and maintained by the flagright system and are not updatable by the API.

Request

This endpoint expects an object.
ruleId
stringOptional
filters
map from strings to anyOptional
Rule filters. A key-value json object corresponding to the json schema returned by /rule-filters-schema endpoint.
parameters
map from strings to anyOptional
ruleNameAlias
stringOptional
riskLevelParameters
objectOptional
action
enumOptional
Model for rule action if a rule is hit. This is returned in the API response and can be configured on Console by operational accounts like a Compliance Analyst
Allowed values: ALLOWFLAGBLOCKSUSPEND
riskLevelActions
objectOptional
triggersOnHit
objectOptional
riskLevelsTriggersOnHit
objectOptional
status
enumOptional
Allowed values: ACTIVEINACTIVE
casePriority
enumOptional
Allowed values: P1P2P3P4

Response

This endpoint returns an object
id
string
type
enum
Allowed values: TRANSACTIONUSERUSER_ONGOING_SCREENING
ruleId
string
checksFor
list of strings
runCount
doubleOptional
hitCount
integerOptional
createdAt
doubleOptional
updatedAt
doubleOptional
filters
map from strings to anyOptional
Rule filters. A key-value json object corresponding to the json schema returned by /rule-filters-schema endpoint.
parameters
map from strings to anyOptional
ruleNameAlias
stringOptional
riskLevelParameters
objectOptional
action
enumOptional
Model for rule action if a rule is hit. This is returned in the API response and can be configured on Console by operational accounts like a Compliance Analyst
Allowed values: ALLOWFLAGBLOCKSUSPEND
riskLevelActions
objectOptional
triggersOnHit
objectOptional
riskLevelsTriggersOnHit
objectOptional
status
enumOptional
Allowed values: ACTIVEINACTIVE
casePriority
enumOptional
Allowed values: P1P2P3P4

Errors

POST
1curl -X POST https://sandbox.api.flagright.com/management/rule-instances \
2 -H "x-api-key: <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{}'
1{
2 "id": "string",
3 "type": "TRANSACTION",
4 "ruleId": "string",
5 "checksFor": [
6 "checksFor"
7 ],
8 "runCount": 0,
9 "hitCount": 0,
10 "createdAt": 0,
11 "updatedAt": 0,
12 "filters": {
13 "filters": {
14 "key": "value"
15 }
16 },
17 "parameters": {
18 "parameters": {
19 "key": "value"
20 }
21 },
22 "ruleNameAlias": "ruleNameAlias",
23 "riskLevelParameters": {
24 "VERY_HIGH": {
25 "VERY_HIGH": {
26 "key": "value"
27 }
28 },
29 "HIGH": {
30 "HIGH": {
31 "key": "value"
32 }
33 },
34 "MEDIUM": {
35 "MEDIUM": {
36 "key": "value"
37 }
38 },
39 "LOW": {
40 "LOW": {
41 "key": "value"
42 }
43 },
44 "VERY_LOW": {
45 "VERY_LOW": {
46 "key": "value"
47 }
48 }
49 },
50 "action": "FLAG",
51 "riskLevelActions": {
52 "VERY_HIGH": "ALLOW",
53 "HIGH": "ALLOW",
54 "MEDIUM": "ALLOW",
55 "LOW": "ALLOW",
56 "VERY_LOW": "ALLOW"
57 },
58 "triggersOnHit": {
59 "usersToCheck": "ALL",
60 "userStateDetails": {
61 "reason": "reason",
62 "state": "UNACCEPTABLE",
63 "userId": "userId",
64 "description": "description"
65 },
66 "kycStatusDetails": {
67 "reason": "reason",
68 "status": "SUCCESSFUL",
69 "userId": "userId",
70 "description": "description"
71 }
72 },
73 "riskLevelsTriggersOnHit": {
74 "VERY_HIGH": {
75 "usersToCheck": "ALL",
76 "userStateDetails": {
77 "reason": "reason",
78 "state": "UNACCEPTABLE"
79 },
80 "kycStatusDetails": {
81 "reason": "reason"
82 }
83 },
84 "HIGH": {
85 "usersToCheck": "ALL",
86 "userStateDetails": {
87 "reason": "reason",
88 "state": "UNACCEPTABLE"
89 },
90 "kycStatusDetails": {
91 "reason": "reason"
92 }
93 },
94 "MEDIUM": {
95 "usersToCheck": "ALL",
96 "userStateDetails": {
97 "reason": "reason",
98 "state": "UNACCEPTABLE"
99 },
100 "kycStatusDetails": {
101 "reason": "reason"
102 }
103 },
104 "LOW": {
105 "usersToCheck": "ALL",
106 "userStateDetails": {
107 "reason": "reason",
108 "state": "UNACCEPTABLE"
109 },
110 "kycStatusDetails": {
111 "reason": "reason"
112 }
113 },
114 "VERY_LOW": {
115 "usersToCheck": "ALL",
116 "userStateDetails": {
117 "reason": "reason",
118 "state": "UNACCEPTABLE"
119 },
120 "kycStatusDetails": {
121 "reason": "reason"
122 }
123 }
124 },
125 "status": "ACTIVE",
126 "casePriority": "P1"
127}