Run Rule

POST /api/v1/rules/:id/run

Execute a rule on transactions that match its conditions. By default, only applies to transactions where type = 'unknown'. Use force_all to apply to all matching transactions.

Path Parameters

ParameterTypeDescription
idstringRule ID

Request Body

FieldTypeDefaultDescription
force_allbooleanfalseIf true, apply to all matching transactions. If false, only apply to unknown transactions.

Example: Run on Unknown Transactions (Default)

Applies the rule only to transactions where type = 'unknown':

curl -X POST "https://statements.finopsbricks.com/api/v1/rules/rule123xyz/run" \
  -H "api-key: fob_stm_xxxxxxxxxxxx" \
  -H "api-secret: xxxxxxxxxxxxxxxx"

Example: Force Run on All

Applies the rule to all transactions matching the conditions, regardless of their current type:

curl -X POST "https://statements.finopsbricks.com/api/v1/rules/rule123xyz/run" \
  -H "api-key: fob_stm_xxxxxxxxxxxx" \
  -H "api-secret: xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"force_all": true}'

Response

{
  "data": {
    "matched_count": 150,
    "updated_count": 42,
    "rule_id": "rule123xyz"
  }
}
FieldDescription
matched_countNumber of transactions that matched the rule conditions (and type filter if applicable)
updated_countNumber of transactions that were actually updated
rule_idThe ID of the rule that was executed

Notes

  • Default behavior (force_all: false): Only updates transactions where type = 'unknown'. This is the safe default that won't overwrite manually categorized transactions.

  • Force mode (force_all: true): Updates all transactions matching the rule conditions. Use with caution as this will overwrite any manual categorizations.

  • The rule does not need to be enabled to run it via this endpoint. This allows you to test rules before enabling them for automatic application.

Errors

CodeDescription
400Invalid JSON body
401Invalid or missing API credentials
403API key lacks rules:edit permission
404Rule not found