List Rules

GET /api/v1/rules

Returns a paginated list of rules, sorted by priority.

Query Parameters

ParameterTypeDefaultDescription
pagenumber1Page number
limitnumber100Items per page (max 500)
fieldsstringallComma-separated field names
enabledboolean-Filter by enabled status (true or false)
namestring-Case-insensitive substring match on rule name
condition_operatorsstring-Comma-separated operator names (e.g. equals,contains). Matches rules where any condition uses any of the given operators (OR-combined).
condition_fieldsstring-Comma-separated field names (e.g. particulars,category). Matches rules where any condition references any of the given fields (OR-combined).
action_fieldsstring-Comma-separated field names. Matches rules where any action references any of the given fields (OR-combined).
sort_bystringprioritypriority, name, or created_at
sort_orderstringASCASC or DESC

Default sort is priority ASC, created_at DESC (unchanged if sort_by is omitted). condition_operators/condition_fields/action_fields values may only contain letters, numbers, and underscores.

If both condition_fields and action_fields are given, they are AND-combined with each other (each is still OR-combined internally) — e.g. condition_fields=particulars&action_fields=category matches rules whose conditions reference particulars and whose actions reference category.

Example Request

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

Example: List Only Enabled Rules

curl -X GET "https://statements.finopsbricks.com/api/v1/rules?enabled=true" \
  -H "api-key: fob_stm_xxxxxxxxxxxx" \
  -H "api-secret: xxxxxxxxxxxxxxxx"

Example: Filter and Sort

curl -X GET "https://statements.finopsbricks.com/api/v1/rules?name=salary&sort_by=name&sort_order=asc" \
  -H "api-key: fob_stm_xxxxxxxxxxxx" \
  -H "api-secret: xxxxxxxxxxxxxxxx"

curl -X GET "https://statements.finopsbricks.com/api/v1/rules?condition_operators=contains&condition_fields=particulars" \
  -H "api-key: fob_stm_xxxxxxxxxxxx" \
  -H "api-secret: xxxxxxxxxxxxxxxx"

Response

{
  "data": [
    {
      "id": "rule123xyz",
      "name": "Categorize Salary",
      "description": "Auto-categorize salary payments",
      "priority": 10,
      "conditions": [
        {
          "field": "particulars",
          "operator": "contains",
          "value": "SALARY"
        }
      ],
      "actions": [
        {
          "field": "category",
          "value": "income"
        },
        {
          "field": "entity",
          "value": "Employer Inc"
        }
      ],
      "enabled": true,
      "rationale": "LLM-generated: matches the user's primary income source",
      "created_at": "2025-01-01T00:00:00.000Z",
      "updated_at": "2025-01-15T12:34:56.000Z",
      "cache": {
        "match_count": 42,
        "last_matched_at": "2025-06-20T08:15:00.000Z",
        "computed_at": "2025-06-21T00:00:00.000Z"
      }
    }
  ],
  "page_context": {
    "count": 1,
    "page": 1,
    "per_page": 100,
    "total": 15,
    "has_more": false
  }
}

Response Fields

See Rule Object for field descriptions.

Errors

CodeDescription
400Invalid sort_by, or condition_operators/condition_fields/action_fields contains characters other than letters, numbers, and underscores
401Invalid or missing API credentials
403API key lacks rules:read permission