# Search account determination rules

Operation ID: `searchAccountDeterminationRules`

Group: Inventory › Account Determination Rules

[Open in the interactive reference](https://docs.api.lensing.ai/lensing/v1/endpoints/searchAccountDeterminationRules)

`POST /inventory/account-determination-rules/search`

Read-only: A read that takes its filters in the body. Changes nothing, and ignores Idempotency-Key.

Searches account determination rules, and returns each matching rule with its dimensions, accounts, and reason-code overrides.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Api-Version` | header | string · 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`. |

## Request body

Required, `application/json`: searchAccountDeterminationRulesInput.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `filters` | object | yes | The filters to apply. A rule must match every filter you send. Send an empty object to return all rules. Example: `{"entityId":"81e8beb1-1415-4012-9012-8138580f43dc","isActive":true}`. |
| `filters.entityId` | string | no | Limits results to rules of the legal entity with this unique identifier. Format: UUID. See `id` on GET base/entities (entities). |
| `filters.bookId` | string | no | Limits results to rules for the accounting book with this unique identifier. Format: UUID. Rules without a book are not returned. See `id` on GET accounting/books/:id (getBook). |
| `filters.itemTypeId` | string | no | Limits results to rules for the item type with this unique identifier. Format: UUID. Wildcard rules are not returned. See `id` on GET inventory/item-types/:id (getItemType). |
| `filters.itemCategoryId` | string | no | Limits results to rules for the item category with this unique identifier. Format: UUID. Wildcard rules and rules for a parent category are not returned. See `id` on GET inventory/item-categories/:id (getItemCategory). |
| `filters.locationId` | string | no | Limits results to rules for the warehouse location with this unique identifier. Format: UUID. Wildcard rules are not returned. See `id` on GET inventory/warehouses/:id (getWarehouse). |
| `filters.transactionTypeContext` | any | no | Limits results to rules for this transaction type. Filtering on 'DEFAULT' returns the rules that apply to every transaction type, including rules stored with no transaction type. 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"`. |
| `filters.isActive` | boolean | no | Limits results to active rules when true, and to inactive rules when false. |
| `filters.modifiedSince` | date-time | no | Limits results to rules whose `lastModifiedDate` is on or after this time. Format: YYYY-MM-DDTHH:mm:ss.sssZ. |
| `page` | object | no | The page to return and its size. Omit to get the first page at the default size. Example: `{"size":50}`. |
| `page.cursor` | string | no | The cursor from the previous response's `pagination.nextCursor`. Send it exactly as you received it. Omit on the first request. |
| `page.size` | number | no | The number of rules per page, from 1 to 200. Defaults to 50. A value above 200 is treated as 200, not rejected. |

```json
{
  "filters": {
    "entityId": "81e8beb1-1415-4012-9012-8138580f43dc",
    "isActive": true
  },
  "page": {
    "size": 50
  }
}
```

## Response

`200` Success

Under `data` (searchAccountDeterminationRulesOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | array<object> | yes | The matching rules in this response. When more rules match than fit in one response, use `pagination` to get the rest. Empty when nothing matches. Example: `[{"id":"8d3f1a60-4c27-4e95-b013-6f2a89d47c5e","ruleName":"Finished goods — receipts","priority":10,"isActive":true,"matching":{"entityId":"81e8beb1-1415-4012-9012-8138580f43dc","bookId":"b7c19e04-3f52-4a86-9d13-5e8f2a6c0b47","itemCategoryId":"a2f47b91-0c6d-4e38-95b1-7d3e6a428c50","transactionTypeContext":"RECEIPT"},"accounts":{"inventoryAssetAccountId":"1c9e4b07-52da-4f38-9016-3b7e05c2a94f","grniClearingAccountId":"4f0b7d29-6e13-4a85-b2c7-90d1f83e6a52"},"reasonCodeOverrides":[],"lastModifiedDate":"2026-05-12T09:30:00.000Z"}]`. |
| `items[].id` | string | yes | The unique identifier for the rule. Format: UUID. |
| `items[].ruleName` | string | yes | The name of the rule. It does not have to be unique. |
| `items[].priority` | number | no | The priority of the rule. When two matching rules are equally specific, the one with the lower number is used. A rule with no `priority` counts as 0. |
| `items[].isActive` | boolean | no | Whether the rule is active. |
| `items[].matching` | object | yes | The dimensions this rule applies to. When the item type, item category, location, or transaction type is absent, the rule applies to every value of it. |
| `items[].matching.entityId` | string | yes | The unique identifier of the legal entity this rule belongs to. Format: UUID. The rule applies only to inventory documents of this legal entity. See `id` on GET base/entities (entities). |
| `items[].matching.bookId` | string | no | The unique identifier of the accounting book this rule applies to. Format: UUID. Absent only on some rules created before a book was required. Set a book on such a rule with PATCH inventory/account-determination-rules/:id (updateAccountDeterminationRule). See `id` on GET accounting/books/:id (getBook). |
| `items[].matching.itemTypeId` | string | no | The unique identifier of the item type this rule applies to. Format: UUID. See `id` on GET inventory/item-types/:id (getItemType). |
| `items[].matching.itemCategoryId` | string | no | The unique identifier of the item category this rule applies to. Format: UUID. The rule also matches items in child categories of this category. See `id` on GET inventory/item-categories/:id (getItemCategory). |
| `items[].matching.locationId` | string | no | The unique identifier of the warehouse location this rule applies to. Format: UUID. See `id` on GET inventory/warehouses/:id (getWarehouse). |
| `items[].matching.inventoryLocationType` | string | no | The type of location this rule is meant for, such as a warehouse or a store. It is for reference only and does not affect which rule is used. |
| `items[].matching.transactionTypeContext` | any | no | The type of transaction this rule applies to, such as 'RECEIPT' or 'SHIPMENT'. 'DEFAULT' means every transaction type. A rule stored with no transaction type is returned as 'DEFAULT'. Some journal entries use a different type from their document. For example, a purchase return looks up its goods-returned-not-credited account as 'RECEIPT'. Transfers use 'WAREHOUSE_TRANSFER' or 'INTERCOMPANY_TRANSFER'. 'SALES_INVOICE', 'SALES_CREDIT_MEMO', and 'PURCHASE_INVOICE' are accepted, but no journal entry uses them. 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"`. |
| `items[].accounts` | object | yes | The general ledger accounts that journal entries use when this rule matches. Only the accounts set on the rule are included in the response. |
| `items[].accounts.inventoryAssetAccountId` | string | no | The unique identifier of the balance sheet account for inventory value. Format: UUID. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.cogsAccountId` | string | no | The unique identifier of the cost of goods sold account. Format: UUID. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.cogsClearingAccountId` | string | no | The unique identifier of the cost of goods sold clearing account. Format: UUID. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.deferredCogsAccountId` | string | no | The unique identifier of the deferred cost of goods sold account. Format: UUID. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.salesRevenueAccountId` | string | no | The unique identifier of the sales revenue account. Format: UUID. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.salesReturnAccountId` | string | no | The unique identifier of the sales return account. Format: UUID. A reason-code override in `reasonCodeOverrides` can replace it. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.salesStockInTransitAccountId` | string | no | The unique identifier of the sales stock-in-transit account. Format: UUID. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.grniClearingAccountId` | string | no | The unique identifier of the goods-received-not-invoiced clearing account, for inventory items. Format: UUID. A receipt uses it to hold the value of goods received until the vendor bill arrives. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.grncClearingAccountId` | string | no | The unique identifier of the goods-returned-not-credited clearing account. Format: UUID. A purchase return uses it to hold the value of goods returned to a vendor until the vendor's credit arrives. Set it on a rule for 'RECEIPT', not 'PURCHASE_RETURN', because purchase returns look it up with 'RECEIPT'. A reason-code override in `reasonCodeOverrides` can replace it. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.servicesReceivedNotInvoicedAccountId` | string | no | The unique identifier of the clearing account for services received but not yet invoiced, and for non-inventory items. Format: UUID. A receipt uses it to hold the value of services and non-inventory items received until the vendor bill arrives. For a receipt line with no item, it comes from the general rule for the legal entity and accounting book. If there are several general rules, the one with the lowest priority number is used, whatever its transaction type. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.expenseAccountId` | string | no | The unique identifier of the expense account for non-inventory items. Format: UUID. An account on a receipt line for a service or expense replaces it for that line. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.purchasePriceVarianceAccountId` | string | no | The unique identifier of the purchase price variance account, under standard costing. Format: UUID. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.inventoryAdjustmentGainAccountId` | string | no | The unique identifier of the account for the value of stock added by an inventory increase, including one created from an inventory count. Format: UUID. Two things can replace it: a reason-code override in `reasonCodeOverrides`, or an offset account on an inventory increase created by manufacturing. When both apply, the offset account is used. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.inventoryAdjustmentLossAccountId` | string | no | The unique identifier of the account for the value of stock removed by an inventory decrease, including one created from an inventory count. Format: UUID. Two things can replace it: a reason-code override in `reasonCodeOverrides`, or an offset account on an inventory decrease created by manufacturing. When both apply, the offset account is used. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.revaluationGainAccountId` | string | no | The unique identifier of the account for gains from inventory revaluation. Format: UUID. When an inventory revaluation's `costingValuationType` is 'directCostCapitalisation', its `capitalisationExpenseAccountId` replaces it. See `costingValuationType` on GET inventory/inventory-revaluations/:id (getInventoryRevaluation). See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.revaluationLossAccountId` | string | no | The unique identifier of the account for losses from inventory revaluation. Format: UUID. When an inventory revaluation's `costingValuationType` is 'directCostCapitalisation', its `capitalisationExpenseAccountId` replaces it. See `costingValuationType` on GET inventory/inventory-revaluations/:id (getInventoryRevaluation). See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.soldQuantitiesRevaluationAccountId` | string | no | The unique identifier of the account for the revaluation of quantities already sold. Format: UUID. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.purchaseReturnVarianceGainAccountId` | string | no | The unique identifier of the account for gains on purchase returns. Format: UUID. A purchase return uses it when the goods returned are worth more than their original cost. A reason-code override in `reasonCodeOverrides` can replace it. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.purchaseReturnVarianceLossAccountId` | string | no | The unique identifier of the account for losses on purchase returns. Format: UUID. A purchase return uses it when the goods returned are worth less than their original cost. A reason-code override in `reasonCodeOverrides` can replace it. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].accounts.fxRateDiffAccountId` | string | no | The unique identifier of the account for exchange rate differences between the receipt and the vendor bill. Format: UUID. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].reasonCodeOverrides` | array<object> | yes | The rule's reason-code overrides. When a document line has one of these reason codes, the override's account replaces the rule account named by `parentAccountType`. An inventory increase or decrease created by manufacturing that has its own offset account uses that account instead of an override. An empty array when the rule has none. |
| `items[].reasonCodeOverrides[].id` | string | yes | The unique identifier for the override. Format: UUID. |
| `items[].reasonCodeOverrides[].reasonCodeId` | string | yes | The unique identifier of the reason code that triggers this override. Format: UUID. See `id` on GET inventory/reason-codes/:id (getReasonCode). |
| `items[].reasonCodeOverrides[].accountId` | string | yes | The unique identifier of the account the journal entry uses instead of the rule's account. Format: UUID. See `id` on GET accounting/accounts/:id (getAccount). |
| `items[].reasonCodeOverrides[].parentAccountType` | any | yes | Which rule account this override replaces. Only six of the twenty accounts can be overridden. One of: `"inventoryAdjustmentGainAccount"`, `"inventoryAdjustmentLossAccount"`, `"salesReturnAccount"`, `"purchaseReturnVarianceGainAccount"`, `"purchaseReturnVarianceLossAccount"`, `"grncClearingAccount"`. |
| `items[].lastModifiedDate` | date-time | no | The date and time the rule last changed, in UTC. Format: YYYY-MM-DDTHH:mm:ss.sssZ. Requests that change only the reason-code overrides do not update this field. |
| `pagination` | object | yes | Whether there are more results than are in this response, and the cursor you use to get the next ones. Example: `{"hasMore":false}`. |
| `pagination.nextCursor` | string | no | The cursor that marks where this response stopped. To get the next results, send it as `page.cursor` in your next request. Absent when there are no more results. |
| `pagination.hasMore` | boolean | yes | Whether there are more results than are in this response. |

```json
{
  "data": {
    "items": [
      {
        "id": "8d3f1a60-4c27-4e95-b013-6f2a89d47c5e",
        "ruleName": "Finished goods — receipts",
        "priority": 10,
        "isActive": true,
        "matching": {
          "entityId": "81e8beb1-1415-4012-9012-8138580f43dc",
          "bookId": "b7c19e04-3f52-4a86-9d13-5e8f2a6c0b47",
          "itemCategoryId": "a2f47b91-0c6d-4e38-95b1-7d3e6a428c50",
          "transactionTypeContext": "RECEIPT"
        },
        "accounts": {
          "inventoryAssetAccountId": "1c9e4b07-52da-4f38-9016-3b7e05c2a94f",
          "grniClearingAccountId": "4f0b7d29-6e13-4a85-b2c7-90d1f83e6a52"
        },
        "reasonCodeOverrides": [],
        "lastModifiedDate": "2026-05-12T09:30:00.000Z"
      }
    ],
    "pagination": {
      "hasMore": false
    }
  },
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}
```

## Statuses

- `400` — Invalid request or business failure
- `401` — The request carries no valid access token.
- `403` — Not authorized
- `404` — Not found
- `429` — Too many requests from this client address. The response has no body and no `Retry-After` header.
- `500` — Internal server error
