# Get Account Determination Rule

`GET /inventory/account-determination-rules/{id}`

Group: Inventory › Account Determination Rules · Operation ID: `getAccountDeterminationRule`

Returns the account determination rule with the given identifier, with its dimensions, accounts and overrides.

The response has the same fields as POST inventory/account-determination-rules/search. The collection GET inventory/account-determination-rules returns the header only and none of the dimensions, accounts or overrides. Read matching as a set of wildcards: an absent dimension matches every value of it, and only entityId is always present. accounts contains only the accounts the rule assigns. An account it leaves unset is absent, and a less specific rule decides that posting.

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

## 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 | The unique identifier for the rule to return. |

## Response

`200` Success

Under `data` (getAccountDeterminationRuleOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | The unique identifier for the rule. |
| `ruleName` | string | yes | A free-text label for the rule. It is not unique and is never read when matching. |
| `priority` | number | no | The tie-breaker between rules of equal specificity. The lower number wins. An absent priority counts as 0, which outranks any positive value. |
| `isActive` | boolean | no | Whether the rule takes part in account determination. When false, the rule is skipped. |
| `matching` | object | yes | The dimensions this rule is pinned to. An absent dimension matches every value of it. |
| `matching.entityId` | string | yes | The legal entity this rule belongs to. See id on GET base/entities. Matching is always scoped to one entity, so this is never absent. |
| `matching.bookId` | string | no | The accounting book this rule is pinned to. See id on GET accounting/books/:id. Absent means the rule matches every value of this dimension. |
| `matching.itemTypeId` | string | no | The item type this rule is pinned to. See id on GET inventory/item-types/:id. Absent means the rule matches every value of this dimension. |
| `matching.itemCategoryId` | string | no | The item category this rule is pinned to. See id on GET inventory/item-categories/:id. Absent means the rule matches every value of this dimension. |
| `matching.locationId` | string | no | The warehouse location this rule is pinned to. See id on GET inventory/warehouses/:id. Absent means the rule matches every value of this dimension. |
| `matching.inventoryLocationType` | string | no | An advisory classification of the location. It is stored on the rule and never read when matching, so it does not affect which rule the posting selects. Absent when none was set. |
| `matching.transactionTypeContext` | string, one of `"RECEIPT"`, `"SHIPMENT"`, `"SALES_RETURN"`, `"SALES_INVOICE"`, `"SALES_CREDIT_MEMO"`, `"PURCHASE_RETURN"`, `"PURCHASE_INVOICE"`, `"PURCHASE_CREDIT_MEMO"`, `"INVENTORY_INCREASE"`, `"INVENTORY_DECREASE"`, `"INVENTORY_REVALUATION"`, `"WAREHOUSE_TRANSFER"`, `"INTERCOMPANY_TRANSFER"`, `"DEFAULT"` | no | The document kind this rule is pinned to. The wildcard that matches every transaction type reads back in two forms: the field is absent, or it is DEFAULT. Do not treat absence alone as the wildcard, because the transaction type can be DEFAULT explicitly. WAREHOUSE_TRANSFER and INTERCOMPANY_TRANSFER are the kinds used for transfer postings. |
| `accounts` | object | yes | The GL accounts this rule assigns. An account the rule does not assign is absent, and a less specific rule decides that posting. |
| `accounts.inventoryAssetAccountId` | string | no | The account for inventory value on the balance sheet. See id on GET accounting/accounts/:id. Absent when the rule assigns none. |
| `accounts.cogsAccountId` | string | no | The cost of goods sold account. See id on GET accounting/accounts/:id. Absent when the rule assigns none. |
| `accounts.cogsClearingAccountId` | string | no | The cost of goods sold clearing account. See id on GET accounting/accounts/:id. Absent when the rule assigns none. |
| `accounts.deferredCogsAccountId` | string | no | The deferred cost of goods sold account. See id on GET accounting/accounts/:id. Absent when the rule assigns none. |
| `accounts.salesRevenueAccountId` | string | no | The sales revenue account. See id on GET accounting/accounts/:id. Absent when the rule assigns none. |
| `accounts.salesReturnAccountId` | string | no | The sales return account. See id on GET accounting/accounts/:id. It can be overridden per reason code. Absent when the rule assigns none. |
| `accounts.salesStockInTransitAccountId` | string | no | The sales stock-in-transit account. See id on GET accounting/accounts/:id. Absent when the rule assigns none. |
| `accounts.grniClearingAccountId` | string | no | The goods-received-not-invoiced clearing account, for inventory items. See id on GET accounting/accounts/:id. Absent when the rule assigns none. |
| `accounts.grncClearingAccountId` | string | no | The goods-returned-not-credited clearing account. It is the offset leg booked on purchase returns and credit memos. See id on GET accounting/accounts/:id. It can be overridden per reason code. Absent when the rule assigns none. |
| `accounts.servicesReceivedNotInvoicedAccountId` | string | no | The clearing account for services received but not yet invoiced, for non-inventory items. See id on GET accounting/accounts/:id. Absent when the rule assigns none. |
| `accounts.expenseAccountId` | string | no | The expense account for non-inventory items and description lines. See id on GET accounting/accounts/:id. Absent when the rule assigns none. |
| `accounts.purchasePriceVarianceAccountId` | string | no | The purchase price variance account, under standard costing. See id on GET accounting/accounts/:id. Absent when the rule assigns none. |
| `accounts.inventoryAdjustmentGainAccountId` | string | no | The account for positive inventory count and adjustment differences. See id on GET accounting/accounts/:id. It can be overridden per reason code. Absent when the rule assigns none. |
| `accounts.inventoryAdjustmentLossAccountId` | string | no | The account for negative inventory count and adjustment differences. See id on GET accounting/accounts/:id. It can be overridden per reason code. Absent when the rule assigns none. |
| `accounts.revaluationGainAccountId` | string | no | The account for gains from inventory revaluation. See id on GET accounting/accounts/:id. Absent when the rule assigns none. |
| `accounts.revaluationLossAccountId` | string | no | The account for losses from inventory revaluation. See id on GET accounting/accounts/:id. Absent when the rule assigns none. |
| `accounts.soldQuantitiesRevaluationAccountId` | string | no | The account for the revaluation of quantities already sold. See id on GET accounting/accounts/:id. Absent when the rule assigns none. |
| `accounts.purchaseReturnVarianceGainAccountId` | string | no | The account for gains on purchase returns. See id on GET accounting/accounts/:id. It can be overridden per reason code. Absent when the rule assigns none. |
| `accounts.purchaseReturnVarianceLossAccountId` | string | no | The account for losses on purchase returns. See id on GET accounting/accounts/:id. It can be overridden per reason code. Absent when the rule assigns none. |
| `accounts.fxRateDiffAccountId` | string | no | The account that absorbs FX rate differences between receipt and invoice posting. See id on GET accounting/accounts/:id. Absent when the rule assigns none. |
| `reasonCodeOverrides` | array of object | yes | The per-reason-code account overrides, ordered by id. An empty array when the rule has none. When a document line uses one of these reason codes, its account replaces the rule account named by parentAccountType. It is not returned by the collection GET inventory/account-determination-rules. |
| `reasonCodeOverrides[].id` | string | yes | The unique identifier for the override. updateReasonCodeOverrides and deleteReasonCodeOverrides address it on PATCH. |
| `reasonCodeOverrides[].reasonCodeId` | string | yes | The reason code that triggers this override. See id on GET inventory/reason-codes/:id. |
| `reasonCodeOverrides[].accountId` | string | yes | The account posted instead of the rule account. See id on GET accounting/accounts/:id. |
| `reasonCodeOverrides[].parentAccountType` | string, one of `"inventoryAdjustmentGainAccount"`, `"inventoryAdjustmentLossAccount"`, `"salesReturnAccount"`, `"purchaseReturnVarianceGainAccount"`, `"purchaseReturnVarianceLossAccount"`, `"grncClearingAccount"` | yes | Which rule account this override replaces. Only six of the twenty accounts can be overridden. |
| `lastModifiedDate` | string (date-time) | no | The date and time the rule header last changed, in UTC. Format YYYY-MM-DDTHH:mm:ss.sssZ. Adding or changing a reason-code override does not change it. |

## 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
