type field of every new non-external Account against these registered types.
How Account Type validation works
Enabling Account Type validation
You enable Account Type validation per ledger through the Ledger Settings API. Send aPATCH request to the Ledger Settings endpoint:
Behavior of the type field in Accounts API
When you create an Account, the type field behavior depends on the validation setting:
- Validation disabled (default): You must provide a
type. It accepts any string value up to 256 characters. The ledger does not compare it to registered Account Types. - Validation enabled: The
typefield must match thekeyValueof a registered Account Type. Midaz stores newkeyValuevalues in lowercase and compares the value case-insensitively. Use lowercase values in requests and configuration. If it does not match, the ledger rejects the account with a validation error. External accounts skip this check.
The keyValue field
The
keyValue field identifies an Account Type. It has these constraints:- Immutable: You set
keyValuewhen you create the Account Type. You cannot change it afterward. The Update Account Type endpoint does not accept this field. - Unique per ledger: Each
keyValuemust be unique within a ledger. - Used for validation: When you enable
validateAccountTypein Ledger Settings, the ledger compares thetypefield of each non-external Account case-insensitively with a registeredkeyValue. The ledger rejects any non-external Account with an unregisteredtype.
Managing Account Types
You manage Account Types through the API or the Lerian Console.
- Create an Account Type — Register a new Account Type for your Ledger.
- List Account Types — Retrieve all Account Types configured in your Ledger.
- Retrieve an Account Type — Get detailed information about a specific Account Type.
- Update an Account Type — Modify the definition of an existing Account Type.
- Delete an Account Type — Remove an Account Type that is no longer in use.
See also
- Transaction Routing — Operation Routes use
ruleType: account_typeto validate an account’stypeagainst the route’s configuredaccount.validIfvalues. - Accounting Entries — How Midaz resolves debit and credit rubrics for the accounts these types classify.

