---
title: "Update a transaction rule"
method: PATCH
path: "/v1/transaction/rules/{rule_id}"
tags: ["Transaction rule"]
---

# Update a transaction rule

`PATCH /v1/transaction/rules/{rule_id}`

Updates a transaction rule and its custom-column change effects. Requires the
`transactions_rules_manage` permission. All fields are optional. Effects can be updated
(include `id`), added, or removed (`_destroy: true`).

## Path parameters

- `rule_id` string, uuid, required

## Headers

- `company-id` string, uuid, required

## Request body

- TransactionRuleUpdate — Payload to update a transaction rule. Requires the `transactions_rules_manage` permission. All fields are optional; only the provided fields are changed. `company_id` and `user_id` cannot be changed via this endpoint (they are fixed from the rule's creation context).
  - `name` string
  - `enabled` boolean
  - `hidden` boolean
  - `constraints` object — Match expression evaluated against transactions.
  - `custom_column_change_effects` object[] — The custom-column changes to apply. Include an `id` to update an existing effect and `_destroy: true` to remove one. `target_custom_column_id` is accepted as an alias for `custom_column_id`.
    - `id` string, uuid
    - `custom_column_id` string, uuid
    - `target_custom_column_id` string, uuid
    - `target_value` string
    - `_destroy` boolean

## Response `200`

Rule updated

- TransactionRule — A transaction rule — an automation that matches transactions against `constraints` and applies custom-column change effects (categorization). Rules are company-scoped and gated by the `transactions_rules_view` / `transactions_rules_manage` permissions.
  - `id` string, uuid, required
  - `company_id` string, uuid, required
  - `user_id` string — The user who created the rule.
  - `name` string, required
  - `constraints` object — Match expression evaluated against transactions (MongoDB-style operators, e.g. `$or` with per-merchant clauses).
  - `enabled` boolean
  - `hidden` boolean
  - `related_merchants` object[] — Merchants referenced by the rule's constraints.
    - `id` string, uuid
    - `name` string
    - `image_url` string, nullable
  - `custom_column_change_effects` object[] — The custom-column changes applied when the rule matches.
    - `id` string, uuid
    - `rule_id` string, uuid
    - `type` string
    - `custom_column_id` string, uuid, nullable
    - `target_attribute` string, nullable
    - `target_value` string, nullable
    - `created_at` string, date-time
    - `updated_at` string, date-time
  - `created_at` string, date-time
  - `updated_at` string, date-time

## Other responses

- `401` — Unauthorized
- `404` — Rule not found, or the `company-id` header is missing / not a member company
- `422` — Validation error

---

[API](https://skmtc.net/cardda/apis/banking-api.md) · [All operations](https://skmtc.net/cardda/apis/banking-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cardda/banking-api/versions/ff1aeb3fda8b/schema)
