---
title: "How do I add a cleardown module with cleardown rules to a chart of accounts?"
slug: "how-do-i-add-a-cleardown-module-with-cleardown-rules-to-a-chart-of-accounts"
updated: 2026-01-27T11:06:33Z
published: 2026-01-27T11:06:33Z
canonical: "support.lusid.com/how-do-i-add-a-cleardown-module-with-cleardown-rules-to-a-chart-of-accounts"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://support.lusid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How do I add a cleardown module with cleardown rules to a chart of accounts?

You can add one or more cleardown modules, each containing any number of cleardown rules, to an existing [chart of accounts](/v1/docs/how-do-i-create-a-chart-of-accounts) (CoA).

Note the **order in which cleardown rules are specified** in a module is significant. For each journal entry line, LUSID uses the first matching cleardown rule found to [transfer balances in P&L accounts to other accounts](/v1/docs/year-end-cleardown) at year end.

## Methods

LUSID web appLUSID APILuminesce

Call the [CreateCleardownModule](https://www.lusid.com/docs/api/lusid/endpoints/chart-of-accounts/CreateCleardownModule) API, for example:

```json
curl -X POST 'https://<your-domain>.lusid.com/api/api/chartofaccounts/CoAs/DailyCoA/cleardownmodules'
  -H 'Content-Type: application/json-patch+json' 
  -H 'Authorization: Bearer <your-API-access-token>'
  -d '{
  "code": "EoY",
  "displayName": "End of year cleardown module",
  "description": "This is a cleardown module for end of year",
  "rules": [
    {
      "ruleId": "rule_0001",
      "generalLedgerAccountCode": "1-Investments",
      "ruleFilter": "Account.Code startswith '200'"
    },
    {
      "ruleId": "rule_0002",
      "generalLedgerAccountCode": "2-Cash",
      "ruleFilter": "Account.Type in 'Income','Expense','Revenue'"
    },
    {
      "ruleId": "rule_0003",
      "generalLedgerAccountCode": "3-Subscriptions",
      "ruleFilter": "Properties[Account/MyScope/Cleardown] exists and Properties[Fund/MyScope/Region] eq 'EMEA'"
    }
  ]
}'
```

Navigate to **Fund Accounting > Chart of Accounts**, open the **Cleardown Modules** tab, select the parent CoA and click the **Create cleardown module** button.

You can either add cleardown rules to the module using the **Add** button in this dialog, or alternatively navigate to the **Cleardown Rules** tab.

![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image(510).png)

Write a Luminesce SQL query using the [Lusid.CleardownModule.Writer](/v1/docs/lusidcleardownmodulewriter) provider to create a cleardown module and the [Lusid.CleardownModule.Rule.Writer](/v1/docs/lusidcleardownmodulerulewriter) provider to set cleardown rules, and execute it using a tool such as the LUSID web app, for example:

![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image(969).png)

## Data fields

This section supplements the [API documentation](https://www.lusid.com/docs/api/lusid/endpoints/chart-of-accounts/CreateCleardownModule) and on-screen help text in the LUSID web app.

A cleardown module is identified by a `code` that must be unique within the parent CoA.

You can specify any number of cleardown rules. Note the order is significant. Each cleardown rule consists of:

- A `ruleId` that uniquely identifies the cleardown rule in the cleardown module.
- A `generalLedgerAccountCode` to transfer the credit or debit amount to.
- A `ruleFilter` defining the rule. [Syntax and allowed values](/v1/docs/how-do-i-add-a-cleardown-module-with-cleardown-rules-to-a-chart-of-accounts#syntax-of-a-cleardown-rule).

## Subsequent updates

Once created, you can edit an existing cleardown module as follows:

- To change the `displayName` or `description` of the module, call the [SetCleardownModuleDetails](https://www.lusid.com/docs/api/lusid/endpoints/chart-of-accounts/SetCleardownModuleDetails) API. You cannot change the `code`.
- To change the order of existing rules in the module, call the [SetCleardownModuleRules](https://www.lusid.com/docs/api/lusid/endpoints/chart-of-accounts/SetCleardownModuleRules) API. Note you must specify *all* the rules again, this time in the required order; any omitted from the request are removed.
- To insert one or more new cleardown rules at a specific order, call the [PatchCleardownModule](https://www.lusid.com/docs/api/lusid/endpoints/chart-of-accounts/PatchCleardownModule) API. For example, the following request adds a new rule as the second in the list (the index starts at 0):

```json
curl -X PATCH 'https://<your-domain>.lusid.com/api/api/chartofaccounts/CoAs/DailyCoA/cleardownmodules/EoY'
  -H 'Content-Type: application/json-patch+json' 
  -H 'Authorization: Bearer <your-API-access-token>'
  -d '[
  {
    "value": {
      "ruleId": "rule_0001a",
      "generalLedgerAccountCode": "Error",
      "ruleFilter": "EconomicBucket eq 'PL_Other'"
    },
    "path": "/rules/1",
    "op": "add"
  }
]'
```

To add a new rule as the first in the list, specify a `path` of `/rules/0`. To add a new rule last, specify `/rules/-`. LUSID automatically moves the index position of other rules.
- To delete a cleardown module, call the [DeleteCleardownModule](https://www.lusid.com/docs/api/lusid/endpoints/chart-of-accounts/DeleteCleardownModule) API.

Note it may be easier to change the order of cleardown rules in the LUSID web app using the ‘grab handles’ (in yellow) or up/down arrows (in red):

![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image(824).png)

## Syntax of a cleardown rule

The syntax of a `ruleFilter` expression in a cleardown rule is:

`&lt;attribute&gt; &lt;operator&gt; &lt;value&gt;`

...where:

- `&lt;attribute&gt;` and `&lt;value&gt;` are explained in the table below.
- `&lt;operator&gt;` is one of the [LUSID filter operators](/v1/docs/filtering-information-retrieved-from-lusid#appendix-a-supported-operators).

Note the following:

- A `ruleFilter` expression is case-insensitive.
- A string `&lt;value&gt;` must be enclosed in single straight quote marks (the `%27` UTF-8 encoding).
- You can concatenate expressions using the `and` and `or` operators. If you use both, [standard boolean operator precedence](/v1/docs/filtering-information-retrieved-from-lusid#logical-operators) applies.

| `&lt;attribute&gt;` | **Data type** | **Example expression** | **Explanation/origin of** `&lt;value&gt;` |
| --- | --- | --- | --- |
| An account field | System-defined | `Account.type in 'Asset', 'Liabilities'` | This can be any of the [stored fields for an account](https://www.lusid.com/docs/api/lusid/schemas/Account), prefixed by `Account.` Nested fields can be accessed using dot notation. ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/b91ef994-b388-4c54-8c6d-57c459887ecf.png) |
| An account property | User-defined | `properties[Account/Type/AssetClass] eq 'Equity'` | This can be any property with a 3-stage key in the `Account` domain. |
| A fund property | User-defined | `properties[Fund/Managers/Name] eq 'Fred Bloggs'` | This can be any property with a 3-stage key in the `Fund` domain. |
| An ABOR property (V1 funds only) | User-defined | `properties[Abor/Client/Accountant] not in 'Fred Bloggs', 'Sarah Smart'` | This can be any property with a 3-stage key in the `Abor` domain. |
