Account Message

Account messages are used to modify account definitions in the ledger that are not balance affecting.

Accounts have a hierarchical structure. A fixed root account is the container for all top-level accounts and sub-accounts can be created in a tree structure to any depth.

Business Rules

  • The account code must be unique across all ledger accounts.
  • On creation, the Ledger can define a format for account codes. If this has been defined, then the code must conform to the format.
  • Accounts can be defined as debit or credit Accounts. This defines the column in which Account balances appear on financial statements. Unless it is a category Account, either debit or credit must be set.
  • A category Account is used to roll up balances in sub-accounts. Normally, a category Account is neither a debit nor credit Account, which makes it impossible to have transactions posted against it. However, some applications might have a requirement for posting to a category Account, so it is possible to set the category flag and either the credit or debit flag.
  • The parent of a category Account must be a category Account or the Ledger root.
  • The Account must have at least one name.
  • If an Account has transactions posted against it, then it cannot be deleted.
  • An Account can be locked from future transactions by setting the closed state.
  • In order for an Account to be closed, all balances in the Account must be zero.
  • If an Account code and UUID are both specified, they must refer to the same Account.
  • Multiple Accounts can use the same taxCode.

Account Message Properties

Property Type Description
category bool If set true, this will be a category account.
closed bool If set true, the account will be closed.
code string A unique identifier for the account.
credit bool If set true then this account will be reported in the credit column.
debit bool If set true then this account will be reported in the debit column.
extra string An arbitrary string for use by the application.
names Name A list of names.
parent EntityRef An account reference that contains the code or UUID of the parent account.
revision string The revision hash code for the account. Required on delete or update.
taxCode string An account code for tax purposes.
toCode string A new account code to be assigned in an update operation.
uuid string The UUID for this account. Only valid on update/delete.

Requirements for each Command

Property Add Delete Get Update
category O _ _ O
closed O _ _ O
code M 1 1 1
credit 2 _ _ O
debit 2 _ _ O
extra O _ _ O
names M _ _ O
parent O _ _ O
revision _ _ _ M
taxCode O _ _ O
toCode _ _ _ O
uuid X 1 1 1
  • O - Optional
  • M - Must be supplied
  • X - Invalid
  • _ - Ignored
  • 1 - At least one of code or uuid must be supplied.
  • 2 - If category is false, then either debit or credit must be set.