Workflow
Forward-chaining rules engine API
Runs a when/then rules engine: fires all (or highest-priority) rules whose JsonLogic condition is truthy, merging their consequents into the fact set and returning the derived facts. Answers 'Which rules fire on these facts?', 'What new facts are derived?'.
Price$0.02per request
MethodPOST
Route/v1/workflow/rules-engine
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
rules-enginewhen-thenforward-chainingjsonlogicfactsinferenceworkflowautomation
API URL
Integration docshttps://x402.hexl.dev/v1/workflow/rules-engineExample request
{
"rules": [
{
"id": "vip",
"when": {
">": [
{
"var": "spend"
},
1000
]
},
"then": {
"vip": true
}
}
],
"facts": {
"spend": 1500
}
}Example response
{
"firedCount": 1,
"fired": [
{
"id": "vip",
"index": 0
}
],
"facts": {
"spend": 1500,
"vip": true
},
"derived": {
"vip": true
},
"interpretation": "Fired 1 rule(s): vip."
}Input schema
{
"type": "object",
"required": [
"rules",
"facts"
],
"properties": {
"rules": {
"type": "array",
"examples": [
[
{
"id": "vip",
"when": {
">": [
{
"var": "spend"
},
1000
]
},
"then": {
"vip": true
}
}
]
]
},
"facts": {
"type": "object",
"examples": [
{
"spend": 1500
}
]
},
"mode": {
"type": "string",
"enum": [
"all",
"first"
]
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}