Ruleset Rules API
List all engagement scoring rules within a specific ruleset, and reorder them by priority. Use this to audit scoring logic, compare rulesets, export ruleset configuration, or programmatically update rule evaluation order.
GET /engagement-scoring/rulesets/{id}/rules
Returns all engagement rules for the specified ruleset.
Request
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Ruleset identifier (path parameter) |
Response
200 OK
{
"rules": [
{
"id": "rule-123",
"ruleset_id": "ruleset-abc",
"event_type": "Email Open",
"weight": 5,
"active": true,
"created_at": "2025-01-15T10:00:00Z"
},
{
"id": "rule-456",
"ruleset_id": "ruleset-abc",
"event_type": "Page View",
"weight": 10,
"active": true,
"created_at": "2025-01-15T10:05:00Z"
},
{
"id": "rule-789",
"ruleset_id": "ruleset-abc",
"event_type": "Demo Request",
"weight": 50,
"active": true,
"created_at": "2025-01-15T10:10:00Z"
}
]
}
Response Fields
| Field | Type | Description |
|---|---|---|
rules | array | Array of rule objects |
rules[].id | string | Unique rule identifier |
rules[].ruleset_id | string | Parent ruleset identifier |
rules[].event_type | string | Event type this rule scores |
rules[].weight | integer | Points awarded per event |
rules[].active | boolean | Whether the rule is active |
rules[].created_at | timestamp | When the rule was created |
Example
curl -X GET "https://api.kenbun.io/engagement-scoring/rulesets/ruleset-abc/rules" \
-H "Authorization: Bearer <token>"
Common Errors
| Status | Meaning | Solution |
|---|---|---|
| 401 | Unauthorized | Check authentication credentials |
| 404 | Not Found | Verify the ruleset ID is correct |
PUT /engagement-scoring/rulesets/{id}/reorder
Atomically reorder all rules within a ruleset by providing the desired priority order. Use this endpoint to persist a drag-and-drop reorder operation or to set rule priority programmatically.
All rules in the ruleset must be included in the request; the order of the rule_ids array becomes the new priority order (first item = highest priority).
Request
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Ruleset identifier (path parameter) |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
rule_ids | array of strings | Yes | Rule IDs in the desired priority order (highest priority first) |
Response
204 No Content — Order updated successfully. No response body.
Example
curl -X PUT "https://api.kenbun.io/engagement-scoring/rulesets/ruleset-abc/reorder" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"rule_ids": ["rule-789", "rule-123", "rule-456"]
}'
In this example, rule-789 becomes the highest-priority rule, followed by rule-123, then rule-456.
Common Errors
| Status | Meaning | Solution |
|---|---|---|
| 400 | Empty or missing rule_ids | Provide at least one rule ID |
| 400 | Invalid rule ID format | Ensure all IDs are valid rule identifiers |
| 400 | Rule does not belong to ruleset | Only include rules that are part of this ruleset |
| 401 | Unauthorized | Check authentication credentials |
| 404 | Ruleset not found | Verify the ruleset ID is correct |
Notes
- Each rule belongs to exactly one ruleset
- The same event type can have different weights in different rulesets (e.g.,
Email Openworth 5 points in one ruleset and 10 in another) - When multiple rules match the same event, the highest-priority rule (lowest index in the ordered list) is credited for scoring attribution
- Use
PUT /engagement-scoring/rulesets/{id}/reorderto set priority order; useGET /engagement-scoring/rulesets/{id}/rulesto read the current order
Related Endpoints
- Engagement Rulesets - List and create rulesets
- Engagement Rules - Create engagement rules
- Engagement Rule by ID - Update or delete a rule
- Profile Scoring Rules - Profile scoring rules