Update Rule
PUT /api/v1/rules/:id
Updates an existing rule. Only provided fields will be updated.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | Rule ID |
Request Body
All fields are optional. Only provided fields will be updated.
| Field | Type | Description |
|---|---|---|
| name | string | Rule name |
| description | string | Rule description |
| rationale | string | Why this rule exists (pattern observed, business logic) |
| priority | number | Execution priority (lower = first) |
| conditions | array | Array of condition objects |
| actions | array | Array of action objects |
| enabled | boolean | Whether rule is active |
Example: Disable a Rule
curl -X PUT "https://statements.finopsbricks.com/api/v1/rules/rule123xyz" \
-H "api-key: fob_stm_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"enabled": false
}'
Example: Change Priority
curl -X PUT "https://statements.finopsbricks.com/api/v1/rules/rule123xyz" \
-H "api-key: fob_stm_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"priority": 5
}'
Example: Update Conditions
When updating conditions or actions, provide the complete array (it replaces the existing one):
curl -X PUT "https://statements.finopsbricks.com/api/v1/rules/rule123xyz" \
-H "api-key: fob_stm_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"conditions": [
{"field": "particulars", "operator": "contains", "value": "SALARY"},
{"field": "inflow", "operator": "greater_than", "value": 50000}
]
}'
Response
{
"data": {
"id": "rule123xyz",
"name": "Categorize Salary",
"description": "Auto-categorize salary payments",
"rationale": "Salary credits always contain SALARY keyword",
"priority": 5,
"conditions": [
{"field": "particulars", "operator": "contains", "value": "SALARY"},
{"field": "inflow", "operator": "greater_than", "value": 50000}
],
"actions": [
{"field": "category", "value": "income"},
{"field": "entity", "value": "Employer Inc"}
],
"enabled": false,
"created_at": "2025-01-01T00:00:00.000Z",
"updated_at": "2025-01-15T10:30:00.000Z"
}
}
Errors
| Code | Description |
|---|---|
| 400 | Validation error (invalid condition, invalid action) |
| 401 | Invalid or missing API credentials |
| 403 | API key lacks rules:edit permission |
| 404 | Rule not found |