Transaction Rule Runs
A run applies one transaction rule to transactions that already exist, or
reverses an earlier run. Runs work in the background, in small batches, so
other changes to the workspace (bank sync, manual edits) are never blocked for
the length of a whole run. The calls that start a run answer at once with
202 Accepted; you then poll the run until it finishes.
| Operation | Method and path | Scope |
|---|---|---|
preview-transaction-rule-on-existing-transactions | POST /v1/workspaces/{workspaceID}/transaction-rules/preview-existing | transaction-rules:read |
apply-transaction-rule-to-existing-transactions | POST /v1/workspaces/{workspaceID}/transaction-rules/apply-existing | transaction-rules:write and transactions:write |
apply-all-transaction-rules-to-existing-transactions | POST /v1/workspaces/{workspaceID}/transaction-rules/apply-all-existing | transaction-rules:write and transactions:write |
get-transaction-rule-run | GET /v1/workspaces/{workspaceID}/transaction-rules/runs/{runID} | transaction-rules:read |
undo-transaction-rule-run | POST /v1/workspaces/{workspaceID}/transaction-rules/runs/{runID}/undo | transaction-rules:write and transactions:write |
apply-all-existing runs every enabled rule instead of one, takes the same filters as its preview (preview-all-existing: accountId, dateFrom, dateTo and includeReconciled, all optional, and all listed in the OpenAPI request body so generated clients can send them) and answers the same 202 with a run; everything below applies to its runs too.
Your role in the workspace must allow managing transaction rules, and the plan must include transaction rules.
apply-existing and undo used to answer 200 with runId and applied.
They now answer 202 with the run object described below. Read the run's
id instead of runId and its appliedCount instead of applied, and poll
until the status settles.
Apply a rule
apply-existing takes the same body as preview-existing, so you can preview
and then apply exactly what you saw:
{
"rule": {
"name": "Costco default",
"conditions": { "version": 1, "operator": "and", "conditions": [
{ "field": "payeeId", "operator": "equals", "value": "vnd_2Rt7Km4Xb9Nz3Wq6Hd1Lp" }
] },
"actions": [{ "type": "setCategory", "categoryId": "cat_4Xn8Vb2Qw7Lc3Rt9Hm5Pd", "mode": "ifEmpty" }]
},
"ruleId": "trule_9Wk3Zb6Nd1Qx5Hv8Lc2Rm",
"accountId": "acct_7Hd2Mc5Vk9Pw3Xt6Rn1Qb",
"dateFrom": "2026-01-01",
"dateTo": "2026-06-30",
"includeReconciled": false
}
ruleId, accountId, dateFrom, dateTo and includeReconciled are
optional. ruleId links the audit rows to a saved rule.
- At most the newest 5000 matching-scope transactions are examined, newest
first.
truncatedistruewhen more would fit the filters. - One run changes at most
applyLimit(500) transactions.remainingCountis how many more the rule would still change; send the same body again to change the next ones. Each run has its own undo. - The set of transactions is fixed when the run starts. A transaction created while the run is working is never touched.
- Each transaction is read again just before it is changed. One that was
edited or deleted since the run started and no longer matches is left alone
and counted in
skippedChangedCount. - Reconciled transactions are skipped and counted in
skippedReconciledCountunlessincludeReconciledistrue. Transfers are never changed, and a category action never changes a split transaction (skippedSplitCount). - Each changed transaction gets one audit row with the trigger
retroactiveand sendstransaction.updated, attributed to you (or to the personal access token or connected app you used).
The response is 202 with the run as it started:
{
"id": "trrun_3Fq8Lm2Zc6Vb1Hd5Xk9Rw",
"ruleId": "trule_9Wk3Zb6Nd1Qx5Hv8Lc2Rm",
"ruleName": "Costco default",
"status": "running",
"includeReconciled": false,
"scannedCount": 4800,
"matchedCount": 1200,
"appliedCount": 0,
"skippedReconciledCount": 0,
"skippedSplitCount": 0,
"skippedChangedCount": 0,
"failedCount": 0,
"remainingCount": 700,
"applyLimit": 500,
"truncated": false,
"createdAt": "2026-11-16T10:00:00Z",
"progressAt": "2026-11-16T10:00:00Z",
"undoRevertedCount": 0,
"undoSkippedCount": 0
}
scannedCount, matchedCount, remainingCount and applyLimit are fixed when the run starts. The other
counts grow as it works.
Poll the run
Call get-transaction-rule-run with the run's id every few seconds until
status is no longer running (or undoing). It returns the same object,
with the counts so far and progressAt, the time the run last finished a
batch. A run of the full 500 transactions takes seconds to a minute.
Statuses
status | Meaning |
|---|---|
running | The apply is working in the background. |
completed | The apply finished. |
failed | A batch errored, or the run made no progress for 5 minutes (see below). The changes it already made are kept. |
undoing | An undo is working in the background. |
undone | The undo finished. |
A run that is running or undoing and has not finished a batch for 5
minutes (for example because the API restarted) is reported as failed. It
keeps the changes it made, and you can still undo it.
A transaction that could not be edited is left unchanged and counted in
failedCount; the rest of the run continues.
Undo a run
undo-transaction-rule-run puts back the payee, category, memo, tags and
review flag the run changed, newest change first. It answers 202 with the
run in status undoing; poll get-transaction-rule-run until it is undone
(or failed). A completed or failed run can be undone, and a failed run's
partial changes are reversed too.
A field is put back only if it still holds the value the run gave it. A
transaction edited since the run keeps its edit and is counted in
undoSkippedCount; undoRevertedCount counts the transactions put back.
A run can be undone once.
Errors
| Status | code | detail name | When |
|---|---|---|---|
403 | FORBIDDEN | insufficientRoleToManageTransactionRules | Your role can't manage transaction rules. |
404 | NOT_FOUND | transactionRuleRunNotFound | The run doesn't exist in this workspace. |
409 | CONFLICT | transactionRuleRunInProgress | Undo was requested while the run is running or undoing. Poll it and try again when it finishes. |
409 | CONFLICT | transactionRuleRunAlreadyUndone | The run was already undone. |
409 | CONFLICT | transactionRuleApplyUnavailable | Applying rules to existing transactions isn't available. |
Two undo calls for the same run can't both succeed: the status changes in one
conditional step, so the second one gets a 409. See Errors
for the response format.
AI assistants
The apply_transaction_rule_to_existing_transactions
and undo_transaction_rule_run
MCP tools wait up to 20 seconds and return the run, then the assistant polls
with get_transaction_rule_run.