Skip to main content

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.

OperationMethod and pathScope
preview-transaction-rule-on-existing-transactionsPOST /v1/workspaces/{workspaceID}/transaction-rules/preview-existingtransaction-rules:read
apply-transaction-rule-to-existing-transactionsPOST /v1/workspaces/{workspaceID}/transaction-rules/apply-existingtransaction-rules:write and transactions:write
apply-all-transaction-rules-to-existing-transactionsPOST /v1/workspaces/{workspaceID}/transaction-rules/apply-all-existingtransaction-rules:write and transactions:write
get-transaction-rule-runGET /v1/workspaces/{workspaceID}/transaction-rules/runs/{runID}transaction-rules:read
undo-transaction-rule-runPOST /v1/workspaces/{workspaceID}/transaction-rules/runs/{runID}/undotransaction-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.

Response changed

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. truncated is true when more would fit the filters.
  • One run changes at most applyLimit (500) transactions. remainingCount is 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 skippedReconciledCount unless includeReconciled is true. Transfers are never changed, and a category action never changes a split transaction (skippedSplitCount).
  • Each changed transaction gets one audit row with the trigger retroactive and sends transaction.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​

statusMeaning
runningThe apply is working in the background.
completedThe apply finished.
failedA batch errored, or the run made no progress for 5 minutes (see below). The changes it already made are kept.
undoingAn undo is working in the background.
undoneThe 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​

Statuscodedetail nameWhen
403FORBIDDENinsufficientRoleToManageTransactionRulesYour role can't manage transaction rules.
404NOT_FOUNDtransactionRuleRunNotFoundThe run doesn't exist in this workspace.
409CONFLICTtransactionRuleRunInProgressUndo was requested while the run is running or undoing. Poll it and try again when it finishes.
409CONFLICTtransactionRuleRunAlreadyUndoneThe run was already undone.
409CONFLICTtransactionRuleApplyUnavailableApplying 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.