# updateAccount

## Overview

Edits an existing GL account's `code`, `name`, or `accountType`. It is a partial patch — only the fields supplied are changed. The native coa-management command re-validates a changed `code` (it must be well-formed and must not collide with another account in the same company) and rejects an empty `name`. `accountType` must be one of ASSET / LIABILITY / EQUITY / REVENUE / EXPENSE (validated in the resolver before the command runs). Account **status is not edited here** — activation is managed by [deactivateAccount](./deactivateAccount.md) and [reactivateAccount](./reactivateAccount.md).

## Modules Commands Used

- [coa-management] updateAccount

## Exception Handling

| Error Code | Description |
| --- | --- |
| N/A (validation) | Thrown for an `accountType` outside ASSET / LIABILITY / EQUITY / REVENUE / EXPENSE |
| COA_MANAGEMENT_ACCOUNT_NOT_FOUND | No account exists for the given ID. |
| COA_MANAGEMENT_NAME_REQUIRED | The account name is empty. |
| COA_MANAGEMENT_INVALID_ACCOUNT_CODE | The new account code is not well-formed. |
| COA_MANAGEMENT_DUPLICATE_ACCOUNT_CODE | Another account with the same code already exists in the company. |
