Preview Rule
GET /api/v1/rules/:id/preview
Shows which transactions a rule would match, using the same matching logic as Run Rule — but read-only. No actions are applied and nothing is persisted. Use this to sanity-check a rule before running it.
By default, previews only against transactions where type = 'unknown',
matching run's default scope. Use force_all=true to preview against all
matching transactions regardless of type.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | Rule ID |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| page | number | 1 | Page number |
| limit | number | 100 | Items per page (max 500) |
| force_all | boolean | false | If true, preview against all matching transactions regardless of type. |
Example: Preview Against Unknown Transactions (Default)
curl -X GET "https://statements.finopsbricks.com/api/v1/rules/rule123xyz/preview" \
-H "api-key: fob_stm_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx"
Example: Preview Against All Matching Transactions
curl -X GET "https://statements.finopsbricks.com/api/v1/rules/rule123xyz/preview?force_all=true" \
-H "api-key: fob_stm_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx"
Response
Uses the standard paginated list envelope (same shape as
List Transactions); page_context.total
is the full match count, not just the current page's size.
{
"data": [
{
"id": "txn123abc",
"date": "2026-04-12",
"particulars": "UBER TRIP 04/12",
"inflow": 0,
"outflow": 450000,
"balance": 12345670,
"entity": null,
"category": null,
"po": null,
"comments": null,
"type": "unknown",
"account": "acc123xyz",
"statement": "stmt123xyz"
}
],
"page_context": {
"count": 1,
"page": 1,
"per_page": 100,
"total": 150,
"has_more": true
}
}
Money fields (inflow, outflow, balance) are raw integer milli-units, same
convention as List Transactions —
divide by 1000 for currency units.
Notes
- Matching uses the same
evaluateRulelogic asrun— same conditions, same operators, same case-sensitivity handling. - The rule does not need to be enabled to preview it.
- Pagination applies to the response, not the matching pass — the server
still evaluates every transaction in the org before slicing a page, same as
rundoes internally.
Errors
| Code | Description |
|---|---|
| 401 | Invalid or missing API credentials |
| 403 | API key lacks rules:read permission |
| 404 | Rule not found |