# deactivateAccount

## Overview

Marks an ACTIVE GL account INACTIVE so it can no longer be posted to. The account stays on the chart of accounts so historical journal entries that reference it remain intact. The native coa-management command rejects an account that is not currently ACTIVE (invalid state transition) and one that still carries open balances, so a live control/clearing account cannot be deactivated out from under posted activity. Reverse it with [reactivateAccount](./reactivateAccount.md).

## Modules Commands Used

- [coa-management] deactivateAccount

## Exception Handling

| Error Code | Description |
| --- | --- |
| COA_MANAGEMENT_ACCOUNT_NOT_FOUND | No account exists for the given ID. |
| COA_MANAGEMENT_INVALID_STATE_TRANSITION | The account is not ACTIVE, so it cannot be deactivated. |
| COA_MANAGEMENT_OPEN_BALANCES_EXIST | The account still has open balances and cannot be deactivated. |
