Create decision
POST/v2/illuminate/decisions
Creates a new decision for configuring rules, conditions, and actions based on events, metrics, or queries.
Warning: The
rulesarray must be empty[]on POST. The server rejects decisions that include populated rules during creation. Rules are added in a subsequent PUT request.
Warning: The decision must be created with
enabled: false. You cannot setenabled: trueuntil rules are configured via PUT.
Creation workflow
Decisions require a multi-step creation process:
- POST /v2/decisions — Create the decision with
inputFields,outputFields,actions, andrules: []. Omitidon all sub-objects — the API auto-generates them. - Read the POST response — Extract the auto-generated IDs:
inputFields[].id,outputFields[].id, andactions[].id. - PUT /v2/decisions/{id} — Send the full decision body including
rulesthat reference those IDs viainputValues[].inputFieldId,outputValues[].outputFieldId, andactionValues[].actionId. - PUT /v2/decisions/{id} — Set
enabled: trueto activate (optionally setactiveFrom/activeUntilfor scheduled activation).
Source type behavior
sourceType | inputFields | executionFrequency |
|---|---|---|
BUSINESSOBJECT | Required — define manually with sourceType: "FIELD" | Not used |
METRIC | Auto-populated from the metric — do not include | Required |
QUERY | Auto-populated from the query — do not include | Required |
Action template schemas
The template object shape depends on actionType:
actionType | Template fields |
|---|---|
PUBNUB_PUBLISH | pubkey, subkey, channel, body, meta |
WEBHOOK_EXECUTION | webhookUrl, headers, payload |
APPCONTEXT_SET_USER_METADATA | userId, custom |
APPCONTEXT_SET_CHANNEL_METADATA | channelId, custom |
APPCONTEXT_SET_MEMBERSHIP_METADATA | userId, channelId, custom |
Template values support ${variable} interpolation using output field variable names or input field IDs.
Common errors
| Code | Condition |
|---|---|
| 400 | Non-empty rules array on POST |
| 400 | enabled: true on POST |
| 400 | inputFields included when sourceType is METRIC or QUERY |
| 400 | Missing executionFrequency when sourceType is METRIC or QUERY |
Request
Example
{
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z",
"createdBy": "string",
"updatedBy": "string",
"id": "string",
"name": "string",
"description": "string",
"accountId": "string",
"businessObjectId": "string",
"sourceType": "BUSINESSOBJECT",
"sourceId": "string",
"hitType": "SINGLE",
"enabled": false,
"activeFrom": "2024-01-01T00:00:00.000Z",
"activeUntil": "2024-01-01T00:00:00.000Z",
"executeOnce": false,
"executionFrequency": 0,
"inputFields": [
{
"id": "string",
"sourceType": {},
"sourceId": "string",
"name": "string"
}
],
"outputFields": [
{
"id": "string",
"name": "string",
"variable": "string"
}
],
"rules": [
{
"id": "string",
"inputValues": [
{}
],
"outputValues": [
{}
],
"actionValues": [
{}
]
}
],
"actions": [
{
"id": "string",
"actionType": "WEBHOOK_EXECUTION",
"description": "string",
"name": "string",
"template": {},
"note": "string"
}
],
"businessObject": {
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z",
"createdBy": "string",
"updatedBy": "string",
"id": "string",
"name": "string",
"isActive": false,
"description": "string",
"fields": [
{
"id": "string",
"name": "string",
"jsonPath": "string",
"jsonFieldType": "TEXT",
"isKeyset": false,
"source": "JSONPATH",
"derivation": {}
}
],
"accountId": "string",
"subkeys": [
"string"
],
"metrics": [
{
"id": "string",
"name": "string",
"measureId": "string",
"businessObjectId": "string",
"evaluationWindow": 0,
"function": "string",
"dimensionIds": [],
"dimensions": [],
"filters": []
}
],
"decisions": [],
"dashboards": [
{
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z",
"createdBy": "string",
"updatedBy": "string",
"id": "string",
"name": "string",
"accountId": "string",
"dateRange": "30 minutes",
"startDate": "2024-01-01T00:00:00.000Z",
"endDate": "2024-01-01T00:00:00.000Z",
"charts": [],
"customer": {}
}
],
"queries": [
{
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z",
"createdBy": "string",
"updatedBy": "string",
"decisions": [],
"customer": {},
"businessObjects": [],
"id": "string",
"name": "string",
"description": "string",
"definition": {},
"template": "string",
"accountId": "string"
}
],
"customers": [
{
"id": "string",
"name": "string"
}
]
},
"metric": {
"id": "string",
"name": "string",
"measureId": "string",
"businessObjectId": "string",
"evaluationWindow": 0,
"function": "string",
"dimensionIds": [
"string"
],
"dimensions": [
{
"id": "string",
"name": "string",
"jsonPath": "string",
"jsonFieldType": "TEXT",
"isKeyset": false,
"source": "JSONPATH",
"derivation": {}
}
],
"filters": [
{
"id": "string",
"sourceType": "MEASURE",
"sourceId": "string",
"operation": "NUMERIC_GREATER_THAN",
"arguments": []
}
],
"businessObject": {
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z",
"createdBy": "string",
"updatedBy": "string",
"id": "string",
"name": "string",
"isActive": false,
"description": "string",
"fields": [
{}
],
"accountId": "string",
"subkeys": [
"string"
],
"metrics": [],
"decisions": [],
"dashboards": [
{}
],
"queries": [
{}
],
"customers": [
{}
]
}
},
"query": {
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z",
"createdBy": "string",
"updatedBy": "string",
"decisions": [],
"customer": {
"id": "string",
"name": "string"
},
"businessObjects": [
{
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z",
"createdBy": "string",
"updatedBy": "string",
"id": "string",
"name": "string",
"isActive": false,
"description": "string",
"fields": [],
"accountId": "string",
"subkeys": [],
"metrics": [],
"decisions": [],
"dashboards": [],
"queries": [],
"customers": []
}
],
"id": "string",
"name": "string",
"description": "string",
"definition": {
"version": "2.0",
"pipeline": {
"sources": [],
"transforms": [],
"output": {}
},
"meta": {}
},
"template": "string",
"accountId": "string"
},
"customer": {
"id": "string",
"name": "string"
}
}