Rules Engine API
Define and evaluate the policy rules behind identity decisions.
The Rules Engine evaluates the policy rules that drive identity decisions across the platform. Define rules once and let services consult them at runtime to gate authentication, verification and authorization.
14 endpoints
across 5 resource groups.
ECDSA-signed
every request is signed with your key pair.
JSON over HTTPS
predictable REST, conventional status codes.
OpenAPI 3.0
Base URL
All Rules Engine endpoints are relative to your environment host. Examples on this page use the 1Kosmos pilot environment — swap in your production root when you go live.
Content type
Requests and responses use application/json.
curl -X GET 'https://pilot-root.1kosmos.net/rules-engine/healthz' \ -H 'licensekey: YOUR_LICENSE_KEY' \ -H 'license: YOUR_LICENSE_KEY'
Authentication
Rules Engine uses ECDSA key-pair authentication. Each request carries your credentials as
HTTP headers; verification-grade calls additionally sign the request body. Retrieve the system signing
key from /publickeys.
curl -X GET 'https://pilot-root.1kosmos.net/rules-engine/healthz' \ -H 'licensekey: YOUR_LICENSE_KEY' \ -H 'license: YOUR_LICENSE_KEY'
const res = await fetch("https://pilot-root.1kosmos.net/rules-engine/healthz", {
method: "GET",
headers: {
"licensekey": "YOUR_LICENSE_KEY",
"license": "YOUR_LICENSE_KEY"
}
});
const data = await res.json();import requests
res = requests.get(
"https://pilot-root.1kosmos.net/rules-engine/healthz",
headers={
"licensekey": "YOUR_LICENSE_KEY",
"license": "YOUR_LICENSE_KEY"
}
)
print(res.json())Errors
Rules Engine uses conventional HTTP status codes: 2xx success, 4xx a problem
with the request, 5xx a service-side error.
| Status | Meaning | Description |
|---|---|---|
| 200 / 204 | OK | The request succeeded. |
| 400 | Bad Request | Validation failed. |
| 401 | Unauthorized | Missing or invalid credentials. |
| 403 | Forbidden | Authenticated, but not permitted. |
| 404 | Not Found | The resource does not exist. |
| 500 | Server Error | Something went wrong on our side. |
{
"statusCode": 400,
"error": "Bad Request",
"message": "Validation error"
}Rule
Create, update and evaluate policy rules.
Get Single Rule By Id
Fetch a single rule by tenantId, communityId, ruleId.
- valid community license with authlevel system, service, service_ext.
Headers
licensekey (required)
License key
requestid (optional)
JSON string
Request Body
Returns
Returns the fetched rule ...
This API throw an error if something goes wrong.
| Name | Type | Description |
|---|---|---|
| tenantIdrequired | string | ID of tenant |
| communityIdrequired | string | ID of community |
| ruleIdrequired | string | ID for a single rule |
| Name | Type | Description |
|---|---|---|
| licensekeyrequired | string | License key / Try Authorize 🔒 |
| requestid | string | Request Id (string, plain text) |
curl -X GET 'https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rule/xxxxxxxxxxxxxxxxxxxxxxxx' \ -H 'licensekey: YOUR_LICENSE_KEY' \ -H 'requestid: <ecdsa-requestid>'
const res = await fetch("https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rule/xxxxxxxxxxxxxxxxxxxxxxxx", {
method: "GET",
headers: {
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>"
}
});
const data = await res.json();import requests
res = requests.get(
"https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rule/xxxxxxxxxxxxxxxxxxxxxxxx",
headers={
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>"
}
)
print(res.json())[
{
"name": "string",
"category": "string",
"tags": [
"string"
],
"description": "string",
"enabled": true,
"criteria": "string",
"conditions": [
{
"factName": "string",
"valueType": "string",
"value": "string",
"operator": "string"
}
],
"onMatch": {
"decision": "string",
"params": {}
},
"onNoMatch": {
"decision": "string",
"params": {}
},
"defaultDecision": {
"decision": "string",
"params": {}
}
}
]// no response body
// no response body
Enable/Disable Rule
Enable or Diasable a rule by ruleId.
- valid community license with authlevel system, service, service_ext.
Headers
licensekey (required)
License key
requestid (optional)
JSON string
Returns
Returns the OK status ...
| Name | Type | Description |
|---|---|---|
| tenantIdrequired | string | ID of tenant |
| communityIdrequired | string | ID of community |
| ruleIdrequired | string | Rule _id |
| actionrequired | string | — |
| Name | Type | Description |
|---|---|---|
| licensekeyrequired | string | License key / Try Authorize 🔒 |
| requestid | string | Request Id (string, plain text) |
curl -X GET 'https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rule/xxxxxxxxxxxxxxxxxxxxx/<action>' \ -H 'licensekey: YOUR_LICENSE_KEY' \ -H 'requestid: <ecdsa-requestid>'
const res = await fetch("https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rule/xxxxxxxxxxxxxxxxxxxxx/<action>", {
method: "GET",
headers: {
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>"
}
});
const data = await res.json();import requests
res = requests.get(
"https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rule/xxxxxxxxxxxxxxxxxxxxx/<action>",
headers={
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>"
}
)
print(res.json())// no response body
// no response body
// no response body
Evaluate Rules
Evaluate rules by tenantId, communityId
- license key authorized for given community
Headers
licensekey (required)
License key
requestid (optional)
JSON string
Request Body
category (required)
Category for evaluation.
facts (required)
facts for evaluation.
Returns
Returns the evaluated rules ...
| Name | Type | Description |
|---|---|---|
| tenantIdrequired | string | ID of tenant |
| communityIdrequired | string | ID of community |
| Name | Type | Description |
|---|---|---|
| licensekeyrequired | string | License key / Try Authorize 🔒 |
| requestid | string | Request Id (string, plain text) |
Request body contains below fields to evaluate rules.
{
"category": "string required",
"facts": {}
}| Field | Type | Description |
|---|---|---|
| category | string | — |
| facts | object | — |
curl -X POST 'https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/evaluate' \
-H 'licensekey: YOUR_LICENSE_KEY' \
-H 'requestid: <ecdsa-requestid>' \
-H 'Content-Type: application/json' \
-d '{"category": "string", "facts": {}}'const res = await fetch("https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/evaluate", {
method: "POST",
headers: {
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"category": "string",
"facts": {}
})
});
const data = await res.json();import requests
res = requests.post(
"https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/evaluate",
headers={
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>"
},
json={
"category": "string",
"facts": {}
},
)
print(res.json()){
"rules": [
{
"id": "string",
"tags": [
"string"
],
"category": "string",
"decision": {},
"reason": "string",
"factsChecked": [
"string"
]
}
]
}// no response body
// no response body
// no response body
Delete Rules matching tags and/or ids
Delete Rules matching tags and/or ids.
- valid community license with authlevel system, service, service_ext.
Headers
licensekey (required)
License key
requestid (optional)
JSON string
Returns
Returns the deleted status ...
| Name | Type | Description |
|---|---|---|
| tenantIdrequired | string | ID of tenant |
| communityIdrequired | string | ID of community |
| Name | Type | Description |
|---|---|---|
| licensekeyrequired | string | License key / Try Authorize 🔒 |
| requestid | string | Request Id (string, plain text) |
Request body contains below fields to update rules.
At least one of ids or tags is mandatory
{
"ids": [ "string" ] //optional
"tags": [ "string" ] //optional,
}| Field | Type | Description |
|---|---|---|
| tags | array<string> | — |
| ids | array<string> | — |
curl -X POST 'https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rules/delete' \
-H 'licensekey: YOUR_LICENSE_KEY' \
-H 'requestid: <ecdsa-requestid>' \
-H 'Content-Type: application/json' \
-d '{"tags": ["string"], "ids": ["string"]}'const res = await fetch("https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rules/delete", {
method: "POST",
headers: {
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"tags": [
"string"
],
"ids": [
"string"
]
})
});
const data = await res.json();import requests
res = requests.post(
"https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rules/delete",
headers={
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>"
},
json={
"tags": [
"string"
],
"ids": [
"string"
]
},
)
print(res.json())// no response body
// no response body
// no response body
// no response body
// no response body
Fetch Rules
Fetch rules by tenantId, communityId, category (optional), tags ([tag1, ... tagN], optional).
- valid community license with authlevel system, service, service_ext.
Headers
licensekey (required)
License key
requestid (optional)
JSON string
Request Body
category (optional)
Category of rules.
tags (optional)
Tags of rules.
Returns
Returns the fetched rules ...
This API throw an error if something goes wrong.
| Name | Type | Description |
|---|---|---|
| tenantIdrequired | string | ID of tenant |
| communityIdrequired | string | ID of community |
| Name | Type | Description |
|---|---|---|
| licensekeyrequired | string | License key / Try Authorize 🔒 |
| requestid | string | Request Id (string, plain text) |
Request body contains below fields to fetch rules:
{
"category": "string optional",
"tags": [
"string optional"
]
}| Field | Type | Description |
|---|---|---|
| category | string | — |
| tags | array<string> | optional, default empty array |
curl -X POST 'https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rules/fetch' \
-H 'licensekey: YOUR_LICENSE_KEY' \
-H 'requestid: <ecdsa-requestid>' \
-H 'Content-Type: application/json' \
-d '{"category": "string", "tags": ["string"]}'const res = await fetch("https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rules/fetch", {
method: "POST",
headers: {
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"category": "string",
"tags": [
"string"
]
})
});
const data = await res.json();import requests
res = requests.post(
"https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rules/fetch",
headers={
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>"
},
json={
"category": "string",
"tags": [
"string"
]
},
)
print(res.json())[
{
"name": "string",
"category": "string",
"tags": [
"string"
],
"description": "string",
"enabled": true,
"criteria": "string",
"conditions": [
{
"factName": "string",
"valueType": "string",
"value": "string",
"operator": "string"
}
],
"onMatch": {
"decision": "string",
"params": {}
},
"onNoMatch": {
"decision": "string",
"params": {}
},
"defaultDecision": {
"decision": "string",
"params": {}
}
}
]// no response body
// no response body
Create Rule
Create rule.
- valid community license with authlevel system, service, service_ext
- key must be authorized for community
- creates a new rule
- returns created rule
Headers
licensekey (required)
License key
requestid (optional)
JSON string
Request Body
name (required)
Name of rule.
category (required)
Category of rule.
tags (required)
Tags of rule.
description (required)
Description of rule.
enabled (required)
Status of rule (true or false).
createdBy (required)
Urn of person that created the rule.
criteria (required)
Criteria for rule (any, all).
conditions (required)
List of conditions for the rule.
onMatch (required)
onMatch data of rule with decision and parameters.
onNoMatch (required)
onNoMatch data of rule with decision and parameters.
defaultDecision (required)
Default decision of rule with decision and parameters
Returns
Returns the created rule.
This API throws an error if something goes wrong
| Name | Type | Description |
|---|---|---|
| tenantIdrequired | string | ID of tenant |
| communityIdrequired | string | ID of community |
| Name | Type | Description |
|---|---|---|
| licensekeyrequired | string | License key / Try Authorize 🔒 |
| requestid | string | Request Id (string, plain text) |
Request body contains below fields to create rules.
{
"name": "string required",
"category": "string required",
"tags": [
"string required"
],
"description": "string optional",
"enabled": "boolean required",
"createdBy": "string required",
"criteria": "string required - any or all",
"conditions": [
{
"factName": "string required",
"valueType": "string required - STRING, NUMBER, IP, CIDR (192.98.70.00/20), ARRAY, GEODISTANCE",
"value": " 'string' | 10 | '192.98.70.00' | '192.98.70.00/20' | '192.98.70.00-192.98.70.12' | ['some string'] | [] required",
"operator": "string required [eq, neq, gt, lt, in, nin, overlap, nooverlap, isempty]"
}
],
"onMatch": {
"decision": "string required",
"params": {}
},
"onNoMatch": {
"decision": "string required",
"params": {}
},
"defaultDecision": {
"decision": "string required",
"params": {}
}
}
For valueType STRING operators [eq, neq, startswith, notstartswith, endswith, notendswith, contains, notcontains] are valid
For valueType NUMBER operators [eq, neq, gt, lt] are valid
For valueType IP operators [eq, neq, in, nin] are valid
For valueType CIDR operators [eq, neq] are valid
For valueType ARRAY (String arrays is supported) operators [in, nin, overlap, nooverlap, isempty, startswith, notstartswith, endswith, notendswith, contains, notcontains] are valid
For valueType GEODISTANCE operators [gt, lt] are valid
For IP/CIDR please follow below examples:
{
"factName": "SingleIP",
"valueType": "IP",
"value": "192.98.70.00",
"operator": "eq/neq"
}
{
"factName": "cidr_range",
"valueType": "CIDR",
"value": "192.98.70.00/20",
"operator": "eq/neq"
}
{
"factName": "ip_range",
"valueType": "IP",
"value": "192.98.70.00-192.98.70.12",
"operator": "eq,neq"
}
{
"factName": "ip_cidr_array",
"valueType": "IP",
"value": ["192.98.70.00-192.98.70.12", "192.98.70.00/10", "192.98.70.00", "192.98.70.12"],
"operator": "in/nin"
}
For Array:
{
"factName": "factStartsWithArrayElement",
"valueType": "ARRAY",
"value": ["da", "sa"],
"operator": "startsWith"
}
{
"factName": "factEndsWithArrayElement",
"valueType": "ARRAY",
"value": ["ir", "sa"],
"operator": "endsWith"
}
{
"factName": "factcontainsArrayElement",
"valueType": "ARRAY",
"value": ["le", "ac"],
"operator": "contains"
}
fact : { "factStartsWithArrayElement" : "darshan", "factEndsWithArrayElement" : "samir", factcontainsArrayElement: "jack"} | matched
For GEODISTANCE
{
"factName": "mobile_user_distance || browser_user_distance || mobile_browser_distance",
"valueType": "GEODISTANCE",
"value": 100 //this is expected in meters,
"operator": "gt/lt"
}
facts : {"browserLocation" : { "lat" : 37.7749, "lon" : -122.4194 } , "mobileLocation" : { "lat" : 37.7749, "lon" : -122.4194 }}
| Field | Type | Description |
|---|---|---|
| name | string | — |
| category | string | — |
| tags | array<string> | optional, default empty array |
| description | string | — |
| enabled | boolean | — |
| createdBy | string | — |
| criteria | string | — |
| conditions | array<object> | if empty, no conditions defined, rule assumed "diasbled" |
| onMatch | object | — |
| onNoMatch | object | — |
| defaultDecision | object | — |
curl -X PUT 'https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rule' \
-H 'licensekey: YOUR_LICENSE_KEY' \
-H 'requestid: <ecdsa-requestid>' \
-H 'Content-Type: application/json' \
-d '{"name": "string", "category": "string", "tags": ["string"], "description": "string", "enabled": true, "createdBy": "string", "criteria": "string", "conditions": [{"factName": "string", "valueType": "string", "value": "string", "operator": "string"}], "onMatch": {"decision": "string", "params": {}}, "onNoMatch": {"decision": "string", "params": {}}, "defaultDecision": {"decision": "string", "params": {}}}'const res = await fetch("https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rule", {
method: "PUT",
headers: {
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"name": "string",
"category": "string",
"tags": [
"string"
],
"description": "string",
"enabled": true,
"createdBy": "string",
"criteria": "string",
"conditions": [
{
"factName": "string",
"valueType": "string",
"value": "string",
"operator": "string"
}
],
"onMatch": {
"decision": "string",
"params": {}
},
"onNoMatch": {
"decision": "string",
"params": {}
},
"defaultDecision": {
"decision": "string",
"params": {}
}
})
});
const data = await res.json();import requests
res = requests.put(
"https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rule",
headers={
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>"
},
json={
"name": "string",
"category": "string",
"tags": [
"string"
],
"description": "string",
"enabled": true,
"createdBy": "string",
"criteria": "string",
"conditions": [
{
"factName": "string",
"valueType": "string",
"value": "string",
"operator": "string"
}
],
"onMatch": {
"decision": "string",
"params": {}
},
"onNoMatch": {
"decision": "string",
"params": {}
},
"defaultDecision": {
"decision": "string",
"params": {}
}
},
)
print(res.json()){
"name": "string",
"category": "string",
"tags": [
"string"
],
"description": "string",
"enabled": true,
"createdBy": "string",
"criteria": "string",
"conditions": [
{
"factName": "string",
"valueType": "string",
"value": "string",
"operator": "string"
}
],
"onMatch": {
"decision": "string",
"params": {}
},
"onNoMatch": {
"decision": "string",
"params": {}
},
"defaultDecision": {
"decision": "string",
"params": {}
}
}// no response body
// no response body
Create Rules in batch
Create rules in batch.
- valid community license with authlevel system, service, service_ext
- key must be authorized for community
- creates a new rules in given array
- returns created rules
Headers
licensekey (required)
License key
requestid (optional)
JSON string
Request Body
name (required)
Name of rule.
category (required)
Category of rule.
tags (required)
Tags of rule.
description (required)
Description of rule.
enabled (required)
Status of rule (true or false).
createdBy (required)
Urn of person that created the rule.
criteria (required)
Criteria for rule (any, all).
conditions (required)
List of conditions for the rule.
onMatch (required)
onMatch data of rule with decision and parameters.
onNoMatch (required)
onNoMatch data of rule with decision and parameters.
defaultDecision (required)
Default decision of rule with decision and parameters
Returns
Returns the created rule.
This API throws an error if something goes wrong
| Name | Type | Description |
|---|---|---|
| tenantIdrequired | string | ID of tenant |
| communityIdrequired | string | ID of community |
| Name | Type | Description |
|---|---|---|
| licensekeyrequired | string | License key / Try Authorize 🔒 |
| requestid | string | Request Id (string, plain text) |
curl -X PUT 'https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rules' \
-H 'licensekey: YOUR_LICENSE_KEY' \
-H 'requestid: <ecdsa-requestid>' \
-H 'Content-Type: application/json' \
-d '[{"name": "string", "category": "string", "tags": ["string"], "description": "string", "enabled": true, "createdBy": "string", "criteria": "string", "conditions": [{"factName": "string", "valueType": "string", "value": "string", "operator": "string"}], "onMatch": {"decision": "string", "params": {}}, "onNoMatch": {"decision": "string", "params": {}}, "defaultDecision": {"decision": "string", "params": {"message": "string"}}}]'const res = await fetch("https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rules", {
method: "PUT",
headers: {
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>",
"Content-Type": "application/json"
},
body: JSON.stringify([
{
"name": "string",
"category": "string",
"tags": [
"string"
],
"description": "string",
"enabled": true,
"createdBy": "string",
"criteria": "string",
"conditions": [
{
"factName": "string",
"valueType": "string",
"value": "string",
"operator": "string"
}
],
"onMatch": {
"decision": "string",
"params": {}
},
"onNoMatch": {
"decision": "string",
"params": {}
},
"defaultDecision": {
"decision": "string",
"params": {
"message": "string"
}
}
}
])
});
const data = await res.json();import requests
res = requests.put(
"https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rules",
headers={
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>"
},
json=[
{
"name": "string",
"category": "string",
"tags": [
"string"
],
"description": "string",
"enabled": true,
"createdBy": "string",
"criteria": "string",
"conditions": [
{
"factName": "string",
"valueType": "string",
"value": "string",
"operator": "string"
}
],
"onMatch": {
"decision": "string",
"params": {}
},
"onNoMatch": {
"decision": "string",
"params": {}
},
"defaultDecision": {
"decision": "string",
"params": {
"message": "string"
}
}
}
],
)
print(res.json())[
{
"name": "string",
"category": "string",
"tags": [
"string"
],
"description": "string",
"enabled": true,
"createdBy": "string",
"criteria": "string",
"conditions": [
{
"factName": "string",
"valueType": "string",
"value": "string",
"operator": "string"
}
],
"onMatch": {
"decision": "string",
"params": {}
},
"onNoMatch": {
"decision": "string",
"params": {}
},
"defaultDecision": {
"decision": "string",
"params": {}
}
}
]// no response body
// no response body
Update Rule
Update a rule by ruleId.
- tenantId, communityId and createdBy cannot be updated.
Headers
licensekey (required)
License key
requestid (optional)
JSON string
Request Body
name (optional)
Name of Rule.
category (optional)
Category of rule.
tags (optional)
Tags of rule.
description (optional)
Description of rule.
enabled (required)
Status of rule (true or false).
criteria (optional)
Criteria for rule (any, all).
conditions (optional)
List of conditions for the rule.
onMatch (optional)
onMatch data of rule with decision and parameters.
onNoMatch (optional)
onNoMatch data of rule with decision and parameters.
defaultDecision (optional)
Default decision of rule with decision and parameters
Returns
Returns the updated rule ...
| Name | Type | Description |
|---|---|---|
| tenantIdrequired | string | ID of tenant |
| communityIdrequired | string | ID of community |
| ruleIdrequired | string | Rule _id |
| Name | Type | Description |
|---|---|---|
| licensekeyrequired | string | License key / Try Authorize 🔒 |
| requestid | string | Request Id (string, plain text) |
Request body contains below fields to update rules.
{
"name": "string optional"
"category": "string optional",
"tags": [
"string optional"
],
"description": "string optional",
"enabled": "boolean optional",
"criteria": "string optional - any or all",
"conditions": [
{
"factName": "string optional",
"valueType": "string required - STRING, NUMBER, IP, CIDR (192.98.70.00/20), ARRAY",
"value": " 'string' | 10 | '192.98.70.00' | '192.98.70.00/20' | '192.98.70.00-192.98.70.12' | ['some string'] | [] required",
"operator": "string required [eq, neq, gt, lt, in, nin, overlap, nooverlap, isempty]"
}
],
"onMatch": {
"decision": "string optional",
"params": {}
},
"onNoMatch": {
"decision": "string optional",
"params": {}
},
"defaultDecision": {
"decision": "string optional",
"params": {}
}
}
For valueType STRING operators [eq, neq] are valid
For valueType NUMBER operators [eq, neq, gt, lt] are valid
For valueType IP operators [eq, neq] are valid
For valueType CIDR operators [eq, neq] are valid
For valueType ARRAY operators [in, nin, overlap, nooverlap, isempty] are valid
| Field | Type | Description |
|---|---|---|
| name | string | — |
| category | string | — |
| tags | array<string> | optional, default empty array |
| description | string | — |
| enabled | boolean | — |
| criteria | string | — |
| conditions | array<object> | if empty, no conditions defined, rule assumed "diasbled" |
| onMatch | object | — |
| onNoMatch | object | — |
| defaultDecision | object | — |
curl -X PATCH 'https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rule/xxxxxxxxxxxxxxxxxxxxx' \
-H 'licensekey: YOUR_LICENSE_KEY' \
-H 'requestid: <ecdsa-requestid>' \
-H 'Content-Type: application/json' \
-d '{"name": "string", "category": "string", "tags": ["string"], "description": "string", "enabled": true, "criteria": "string", "conditions": [{"factName": "string", "valueType": "string", "value": "string", "operator": "string"}], "onMatch": {"decision": "string", "params": {}}, "onNoMatch": {"decision": "string", "params": {}}, "defaultDecision": {"decision": "string", "params": {}}}'const res = await fetch("https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rule/xxxxxxxxxxxxxxxxxxxxx", {
method: "PATCH",
headers: {
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"name": "string",
"category": "string",
"tags": [
"string"
],
"description": "string",
"enabled": true,
"criteria": "string",
"conditions": [
{
"factName": "string",
"valueType": "string",
"value": "string",
"operator": "string"
}
],
"onMatch": {
"decision": "string",
"params": {}
},
"onNoMatch": {
"decision": "string",
"params": {}
},
"defaultDecision": {
"decision": "string",
"params": {}
}
})
});
const data = await res.json();import requests
res = requests.patch(
"https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rule/xxxxxxxxxxxxxxxxxxxxx",
headers={
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>"
},
json={
"name": "string",
"category": "string",
"tags": [
"string"
],
"description": "string",
"enabled": true,
"criteria": "string",
"conditions": [
{
"factName": "string",
"valueType": "string",
"value": "string",
"operator": "string"
}
],
"onMatch": {
"decision": "string",
"params": {}
},
"onNoMatch": {
"decision": "string",
"params": {}
},
"defaultDecision": {
"decision": "string",
"params": {}
}
},
)
print(res.json()){
"name": "string",
"category": "string",
"tags": [
"string"
],
"description": "string",
"enabled": true,
"criteria": "string",
"conditions": [
{
"factName": "string",
"valueType": "string",
"value": "string",
"operator": "string"
}
],
"onMatch": {
"decision": "string",
"params": {}
},
"onNoMatch": {
"decision": "string",
"params": {}
},
"defaultDecision": {
"decision": "string",
"params": {}
}
}// no response body
// no response body
// no response body
// no response body
Delete Rule
Delete a rule by ruleId.
- valid community license with authlevel system, service, service_ext.
Headers
licensekey (required)
License key
requestid (optional)
JSON string
Returns
Returns the deleted status ...
| Name | Type | Description |
|---|---|---|
| tenantIdrequired | string | ID of tenant |
| communityIdrequired | string | ID of community |
| ruleIdrequired | string | Rule _id |
| Name | Type | Description |
|---|---|---|
| licensekeyrequired | string | License key / Try Authorize 🔒 |
| requestid | string | Request Id (string, plain text) |
curl -X DELETE 'https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rule/xxxxxxxxxxxxxxxxxxxxx' \ -H 'licensekey: YOUR_LICENSE_KEY' \ -H 'requestid: <ecdsa-requestid>'
const res = await fetch("https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rule/xxxxxxxxxxxxxxxxxxxxx", {
method: "DELETE",
headers: {
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>"
}
});
const data = await res.json();import requests
res = requests.delete(
"https://pilot-root.1kosmos.net/rules-engine/tenant/xxxxxxxxxx/community/xxxxxxxxxxxxxxxxxxxxxxxx/rule/xxxxxxxxxxxxxxxxxxxxx",
headers={
"licensekey": "YOUR_LICENSE_KEY",
"requestid": "<ecdsa-requestid>"
}
)
print(res.json())// no response body
// no response body
// no response body
// no response body
// no response body
Service Key
Service Key endpoints.
Get service keys (Not Implemented)
This endpoint returns available service keys. The license you are using must be of authLevel 'system'
Headers
licensekey (required)
License key
Returns
Returns array with service keys
| Name | Type | Description |
|---|---|---|
| licensekeyrequired | string | License key encrypted with ECDSA / Try Authorize 🔒 |
curl -X GET 'https://pilot-root.1kosmos.net/rules-engine/servicekeys' \ -H 'licensekey: YOUR_LICENSE_KEY'
const res = await fetch("https://pilot-root.1kosmos.net/rules-engine/servicekeys", {
method: "GET",
headers: {
"licensekey": "YOUR_LICENSE_KEY"
}
});
const data = await res.json();import requests
res = requests.get(
"https://pilot-root.1kosmos.net/rules-engine/servicekeys",
headers={
"licensekey": "YOUR_LICENSE_KEY"
}
)
print(res.json())[
{
"tag": "xxxxx",
"keyId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx",
"keySecret": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx",
"type": "xxxxx"
}
]// no response body
// no response body
// no response body
// no response body
Reset Service Key (Not Implemented)
This endpoint resets service key for given keyId. Deletes current one and recreates a new one. The license you are using must be of authLevel 'system'
Parameters
keyId (required)
The keyId of service key to reset
Headers
licensekey (required)
License key encrypted with ECDSA
requestid (required)
JSON string encrypted with ECDSA which should contain "appid" (string), "uuid" (string) and "ts" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 'environment.allowed_time_span' seconds from now
publickey (required)
Public key
Returns
Returns re-created service key
| Name | Type | Description |
|---|---|---|
| keyIdrequired | string | keyId of service key to reset |
| Name | Type | Description |
|---|---|---|
| licensekeyrequired | string | License key encrypted with ECDSA / Try Authorize 🔒 |
curl -X DELETE 'https://pilot-root.1kosmos.net/rules-engine/servicekey/<keyId>' \ -H 'licensekey: YOUR_LICENSE_KEY'
const res = await fetch("https://pilot-root.1kosmos.net/rules-engine/servicekey/<keyId>", {
method: "DELETE",
headers: {
"licensekey": "YOUR_LICENSE_KEY"
}
});
const data = await res.json();import requests
res = requests.delete(
"https://pilot-root.1kosmos.net/rules-engine/servicekey/<keyId>",
headers={
"licensekey": "YOUR_LICENSE_KEY"
}
)
print(res.json())[
{
"tag": "xxxxx",
"keyId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx",
"keySecret": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx",
"type": "xxxxx"
}
]// no response body
// no response body
// no response body
// no response body
Environment
Environment endpoints.
/environment
Provide details regarding the environments.
Returns
Returns an environment object
curl -X GET 'https://pilot-root.1kosmos.net/rules-engine/environment' \ -H 'license: YOUR_LICENSE_KEY'
const res = await fetch("https://pilot-root.1kosmos.net/rules-engine/environment", {
method: "GET",
headers: {
"license": "YOUR_LICENSE_KEY"
}
});
const data = await res.json();import requests
res = requests.get(
"https://pilot-root.1kosmos.net/rules-engine/environment",
headers={
"license": "YOUR_LICENSE_KEY"
}
)
print(res.json())// no response body
Healthz
Healthz endpoints.
Get healthz.
Get healthz
Returns
Returns a healthz object
- ``
version = <git-tag>.<commit-id>.<dob>``
- ``
git-tag``: When code is compiled from a git-tag, this must carry the tag name. This should match one of the git tags. - ``
commit-id``: This is the git-commit-id. eg: When code is built from this, the hex code, in the end, is the commit it. - ``
dob``: Date Of Build. This is epoch-time in seconds when the build was created. - if the code is not built from a git-tag, then the ``
version =<commit-id>.<dob>``
curl -X GET 'https://pilot-root.1kosmos.net/rules-engine/healthz' \ -H 'licensekey: YOUR_LICENSE_KEY' \ -H 'license: YOUR_LICENSE_KEY'
const res = await fetch("https://pilot-root.1kosmos.net/rules-engine/healthz", {
method: "GET",
headers: {
"licensekey": "YOUR_LICENSE_KEY",
"license": "YOUR_LICENSE_KEY"
}
});
const data = await res.json();import requests
res = requests.get(
"https://pilot-root.1kosmos.net/rules-engine/healthz",
headers={
"licensekey": "YOUR_LICENSE_KEY",
"license": "YOUR_LICENSE_KEY"
}
)
print(res.json()){
"status": "all services operational",
"publicKey": "//same as <service>/publickeys endpoint",
"code": "200",
"version": "xxxx.xxxx.xxxx"
}Service Directory
Service Directory endpoints.
Get all service directories.
Get all service directories.
Returns
Returns all service directories.
curl -X GET 'https://pilot-root.1kosmos.net/rules-engine/sd' \ -H 'licensekey: YOUR_LICENSE_KEY' \ -H 'license: YOUR_LICENSE_KEY'
const res = await fetch("https://pilot-root.1kosmos.net/rules-engine/sd", {
method: "GET",
headers: {
"licensekey": "YOUR_LICENSE_KEY",
"license": "YOUR_LICENSE_KEY"
}
});
const data = await res.json();import requests
res = requests.get(
"https://pilot-root.1kosmos.net/rules-engine/sd",
headers={
"licensekey": "YOUR_LICENSE_KEY",
"license": "YOUR_LICENSE_KEY"
}
)
print(res.json()){
"name1": "https://xxx.xxxxxx.xxx/xxxxx",
"name2": "https://xxx.xxxxxx.xxx/xxxxx",
"name3": "https://xxx.xxxxxx.xxx/xxxxx"
}// no response body