Rules

Update Rule

PATCH
/v1/households/{household_id}/rules/{rule_id}

Updates a rule in place, keeping its priority order. Send only the fields you want to change; omitted fields keep their latest values, including edits made by another client. Lists and amount_filter replace the whole field, and null clears nullable fields. All set criteria must match; a rule with none matches nothing.

When sending amount_filter, currency is required and cannot be null; omit amount_filter completely to leave it unchanged.

Set apply_to_existing: true to run the updated rule over existing visible transactions and return applied_count. Manually locked categories and merchants are preserved, and tag actions add to existing tags. Saving and applying happen atomically.

Authorization

PersonalApiToken
AuthorizationBearer <token>

Personal API token (penny_pat_…). Paste only the token; the Bearer prefix is added automatically. Read-only tokens only allow read requests, and read/write tokens follow your current household membership and role. See https://penny.finance/docs/api#authentication.

In: header

Path Parameters

household_id*string

ID of the household that owns the resource. GET /v1/households lists the households you can access.

rule_id*string

ID of the categorization rule.

Request Body

application/json

filter_uncategorized?boolean

Whether the rule only matches transactions that have no category. A rule with this criterion is a fallback: it runs after all other rules, only when none of them assigned a category, and only fills in actions that no other rule took.

account_ids?array<string>|

Only match transactions on one of these accounts. Omit it, or send null or [], to match any account. Deleted accounts' transactions are skipped by dry runs and apply_to_existing, though transactions synced while deleted still run through rules. Saving a rule rejects a deleted account it doesn't already have.

merchant_ids?array<string>|

Only match transactions assigned to one of these merchants (transactions without a merchant never match). Omit it, or send null or [], to skip this check. A deleted merchant matches nothing, and saving rejects one the rule doesn't already have.

category_ids?array<string>|

Only match transactions currently in one of these categories (uncategorized transactions never match). Omit it, or send null or [], to skip this check. A deleted category matches nothing, and saving rejects one the rule doesn't already have.

amount_filter?|

Replaces the rule's direction and amount criterion. Unlike on create, currency is required. Send null to remove the criterion.

classifications?array<>|

Only match transactions whose classification is one of these values (transactions without one never match). Omit it, or send null or [], to skip this check.

name_conditions?array<>|

Only match transactions whose name matches at least one of these conditions. Omit it, or send null or [], to skip this check.

set_category_id?|

Category action: the category assigned to matching transactions. null leaves the category alone. A category set directly on a transaction is never overwritten, and when several matching rules set one, the highest-priority rule wins. A deleted category is never assigned, and saving a rule refuses one the rule doesn't already have.

set_merchant_id?|

Merchant action: the merchant assigned to matching transactions. null leaves the merchant alone. A merchant set directly on a transaction is never overwritten, and when several matching rules set one, the highest-priority rule wins. A deleted merchant is never assigned, and saving a rule refuses one the rule doesn't already have.

apply_tag_ids?array<string>|

Tag action: tags added to matching transactions. Existing tags are kept, and the tags of every matching rule are combined. null or [] adds none. A deleted tag is never added, and saving a rule refuses one the rule doesn't already have.

set_hidden?boolean

Whether the rule hides matching transactions, which takes them out of regular lists and totals. false takes no action: a rule never unhides a transaction.

set_needs_review?|

Whether the rule changes a matching transaction's needs_review flag: true flags it for review, false clears the flag, and null leaves the flag alone. When several matching rules set it, the highest-priority rule wins.

apply_to_existing?boolean

Whether to also apply the saved rule to the household's existing transactions, skipping hidden and deleted ones; the response reports how many as applied_count. Only this rule is evaluated, so it takes effect even where a higher-priority rule would otherwise win. When false, the rule only affects transactions created or changed afterwards.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PATCH "https://api.penny.finance/v1/households/Hh4vK8pQ2sLm/rules/Rl9cF3nV7sQa" \  -H "Authorization: Bearer $PENNY_API_TOKEN" \  -H "Content-Type: application/json" \  --data-raw '{  "set_category_id": "Ct5nR8wY1jFu",  "apply_to_existing": true}'
{  "id": "Rl9cF3nV7sQa",  "priority": 1,  "account_ids": [    "Ac7kP2mN9qRs"  ],  "deleted_accounts": [],  "merchant_ids": null,  "deleted_merchants": [],  "category_ids": null,  "deleted_categories": [],  "amount_filter": {    "currency": "USD",    "direction": "expense",    "operator": "between",    "value": "20.00",    "value_upper": "200.00"  },  "classifications": [    "FOOD_AND_DRINK_GROCERIES"  ],  "name_conditions": [    {      "pattern": "trader joe",      "mode": "contains"    }  ],  "filter_uncategorized": false,  "set_category_id": "Ct5nR8wY1jFu",  "set_merchant_id": null,  "apply_tag_ids": [    "Tg8qN1cK5rWd"  ],  "deleted_tags": [],  "set_hidden": false,  "set_needs_review": null,  "applied_count": null}