Update Rule

PUT /api/v1/rules/:id

Updates an existing rule. Only provided fields will be updated.

Path Parameters

ParameterTypeDescription
idstringRule ID

Request Body

All fields are optional. Only provided fields will be updated.

FieldTypeDescription
namestringRule name
descriptionstringRule description
rationalestringWhy this rule exists (pattern observed, business logic)
prioritynumberExecution priority (lower = first)
conditionsarrayArray of condition objects
actionsarrayArray of action objects
enabledbooleanWhether 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

CodeDescription
400Validation error (invalid condition, invalid action)
401Invalid or missing API credentials
403API key lacks rules:edit permission
404Rule not found