add_category_rule
Add a rule to automatically categorize transactions based on merchant pattern, with optional filters on amount range and day-of-month. Supports per-account scoping and excluding transfers.
Instructions
Add a category rule: a merchant match (+ optional predicates) -> category.
field is description, payee, or any. priority is
lowest-wins. Set is_transfer=True for internal transfers / card payments
so they are excluded from spending totals. Set account_id to scope the
rule to a single account (so a generic descriptor like "FUNDS TRAN" can be
reclassified on one account without affecting the same text elsewhere);
leave it None to apply to every account.
The merchant match defaults to a case-insensitive substring; set
match_mode='regex' to match pattern as a case-insensitive regular
expression instead (useful when a store number splits a merchant name).
Optional predicates further narrow a rule and must all hold to match:
amount_min/amount_max bound the amount magnitude (abs(amount),
so 200-350 matches a $304 charge), and day_min/day_max bound the
posted day-of-month (1-31) — together they isolate a recurring charge like a
mid-month insurance premium from other charges at the same merchant.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| field | No | any | |
| day_max | No | ||
| day_min | No | ||
| pattern | Yes | ||
| category | Yes | ||
| priority | No | ||
| account_id | No | ||
| amount_max | No | ||
| amount_min | No | ||
| match_mode | No | substring | |
| is_transfer | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||