# Get Bank Rule

`GET /banking/bank-rules/{id}`

Group: Banking › Bank Rules · Operation ID: `getBankRule`

Fetch a single bank rule by its id (a UUID), bound from the :id path segment. Returns the full record: the header plus its criteria, the bank accounts it watches and its action object — the same item schema as POST banking/bank-rules/search. Read-only. Raises NOT_FOUND when no rule has that id (should map to 404). Every request must carry the Api-Version header.

Fetch one bank rule by its `id` (a UUID), bound from the `:id` path segment. Returns the whole rule: the header, every criterion a transaction must meet, the bank accounts the rule watches, and the action object describing the entry it creates.

Same item schema as `POST banking/bank-rules/search`; both read through `core/bankRule/searchBankRule.ts`, so they cannot drift. `GET banking/bank-rules` is a data-set and returns the header only — a data-set cannot express a nested array.

`status` is `active` or `inactive`. Only an active rule can be run; deactivate a rule with `PATCH banking/bank-rules/{id}` rather than deleting it.

[Open in the interactive reference](https://docs.api.lensing.ai/?op=getBankRule)

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Api-Version` | header | `"v1"` | yes | The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version `v1`. |
| `id` | path | string | yes | Id of the bank rule to fetch (a UUID); bound from the :id path segment. |

## Response

`200` Success

Under `data` (getBankRuleOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | Id of the bank rule (a UUID) — the public identifier used by this route. |
| `bankRuleNumber` | string | no | Human-readable document number assigned from the BankRule number range, e.g. BR-000014. |
| `rule` | string | yes | Name of the rule. Unique across the tenant. |
| `action` | string | yes | What the rule does when a transaction matches. One of 'createBankEntry', 'createCreditCardEntry'. |
| `status` | string | yes | Whether the rule is in force. One of 'active', 'inactive'. Only an active rule can be run. |
| `priority` | number | yes | Evaluation order relative to other rules; lower runs first. |
| `description` | string | no | Free-text note on what the rule is for. |
| `externalId` | string | no | External system identifier, when this rule was migrated from another system. |
| `lastModifiedDate` | string (date-time) | yes | Instant the rule last changed, as ISO 8601 UTC (YYYY-MM-DDTHH:mm:ss.sssZ). Poll on this to sync incrementally rather than re-reading the whole collection. |
| `criteria` | array of object | yes | The conditions a bank transaction must meet, combined by each criterion's logicalOperator. Every rule has at least one. |
| `criteria[].id` | string | yes | Id of the criterion row (a UUID). |
| `criteria[].criteria` | string | yes | Which field of the transaction is tested. One of 'amount', 'description', 'payeePayor'. |
| `criteria[].operator` | string | yes | How the field is compared. Numeric operators ('equal', 'notEqual', 'greaterThan', 'greaterThanOrEqual', 'lessThan', 'lessThanOrEqual') apply only to 'amount'; text operators ('is', 'isNot', 'contains', 'doesNotContain' and their caseInsensitive variants) apply only to 'description' and 'payeePayor'. |
| `criteria[].logicalOperator` | string | no | How this criterion joins the next. One of 'and', 'or'. |
| `criteria[].value` | string | yes | The value compared against. A decimal string for 'amount', free text otherwise. |
| `accounts` | array of object | yes | The bank accounts this rule watches. Every rule has at least one, and all of them belong to one legal entity and are either all credit card accounts or all not. |
| `accounts[].id` | string | yes | Id of the mapping row (a UUID). |
| `accounts[].bankAccountId` | string | yes | [fk: BankAccountApi.bankAccounts.id] The watched bank account, given as its id (a UUID). |
| `accounts[].accountName` | string | no | Name of the bank account, denormalised for convenience. |
| `actionObject` | object | no | The entry the rule creates when a transaction matches. Present on every rule created through this api. |
| `actionObject.id` | string | yes | Id of the action object (a UUID). |
| `actionObject.accountId` | string | no | [fk: AccountApi.accounts.id] Account the created entry line books to, given as its id (a UUID). |
| `actionObject.name` | string | no | Name stamped on the created entry. |
| `actionObject.description` | string | no | Description stamped on the created entry and its line. |
| `actionObject.billableExpense` | string | no | Whether the created credit card entry line is a billable expense. One of 'yes', 'no'. Customer applies only when this is 'yes'. |
| `actionObject.businessUnitId` | string | no | [fk: BusinessUnitApi.businessUnits.id] Business unit stamped on the created line, given as its id (a UUID). |
| `actionObject.departmentId` | string | no | [fk: DepartmentApi.departments.id] Department stamped on the created line, given as its id (a UUID). |
| `actionObject.customerId` | string | no | [fk: CustomerApi.customers.id] Customer stamped on the created line, given as its id (a UUID). |
| `actionObject.vendorId` | string | no | [fk: VendorApi.vendors.id] Vendor stamped on the created line, given as its id (a UUID). |
| `actionObject.intercompanyPartnerId` | string | no | [fk: BusinessPartnerApi.businessPartners.id] Intercompany partner, given as its id (a UUID). Applied only when the booking account is paired for elimination; ignored otherwise. |
| `actionObject.valueAllocationTags` | array of string | no | Value-allocation tag codes stamped on the created line. Applied only for dimensions still enabled on the document the rule creates. |

## Errors

| Code | Status |
| --- | --- |
| `NOT_FOUND` | 400 |

## Statuses

- `400` — Invalid request or business failure. Codes: NOT_FOUND
- `401` — Missing or invalid access token
- `403` — Not authorized
- `404` — Not found
- `429` — Too many requests
- `500` — Internal server error
