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

# Accounting

> Get an overview of accounting in Midaz: Chart of Accounts, Account Types, Accounting Entries, and Operations that keep every posting balanced and traceable.

Midaz records accounting for real-time financial systems. It supports route-driven double-entry flows for direct transactions, as well as lifecycle actions such as cancellation. Cancellation operates on the source side only. Route validation is disabled by default. Enable it to validate the configured account and accounting-entry rules. Midaz supports digital products, embedded finance, and high-volume operations.

This page is the entry point for the Accounting section. It introduces the core primitives and shows how they fit together. It also points you to the reference pages and to a hands-on walkthrough of accounting end to end.

## How the primitives relate

***

Midaz turns business events into balanced ledger postings. A small set of primitives builds on each other:

#### Chart of Accounts

This is the structure of balances your product needs. Midaz has no dedicated Chart of Accounts API. Instead, you model it on a ledger from assets, accounts, segments, portfolios, and account types. The `code` field on an Accounting Entry (for example `1.1.1.001`) carries the traditional account number for each posting.

#### Account Types

These are reusable classifications that you assign to accounts. Each account type has a name, a key value, and a description. You use account types to group accounts in your financial structure.

#### Accounting Entries (Rubricas)

A route does not need an entry for every transaction action. When it emits an action, the entry must satisfy the route-specific debit and credit requirements. Each configured entry contains the debit and/or credit rubric required by its operation route. Every present rubric has a `code` and description. With route validation (`accounting.validateRoutes`) enabled, Midaz stamps the matching rubric onto each operation, based on the operation's action and direction.

#### Operations

A transaction produces ledger movements. An **Operation** is a single leg of a transaction, one debit or one credit on a specific account. Midaz validates that the original transaction’s source, destination, and send totals agree. Its returned operation set is not always a debit/credit pair: pending creation and cancellation process only source-side legs. Each operation carries a `transactionId`, an `amount`, and an `assetCode`. When route validation (`accounting.validateRoutes`) is enabled on the ledger and the operation route defines accounting entries, the operation also carries a `routeCode` and a `routeDescription` from the resolved rubric.

<Note>
  With `accounting.validateRoutes` enabled, when an operation route defines an accounting entry, Midaz resolves a rubric for the operation's action and direction. It writes the rubric `code` to the operation's `routeCode` and links the operation with a `transactionId`. Together, these fields give a complete audit trail: transaction → operation → rubric. Your teams trace which accounting rule applied to each movement, without extra lookups.
</Note>

At a glance, the flow is:

<Frame caption="Accounting primitives workflow">
  <img src="https://mintcdn.com/lerian-49cb71fc/SFzzdxyH5SN7w_fC/images/en/d2/accounting-primitives.svg?fit=max&auto=format&n=SFzzdxyH5SN7w_fC&q=85&s=ae5fe0b8b7b390d8c8be5c76f53fe479" style={{width: "auto", height: "400px"}} alt="Diagram showing the Accounting primitives workflow" width="397" height="782" data-path="images/en/d2/accounting-primitives.svg" />
</Frame>

Midaz validates that the original transaction’s source, destination, and send totals agree. Lifecycle responses do not always contain both directions: pending creation and cancellation process only source-side legs. Each movement stays traceable for audit and compliance.

<Tip>
  New to accounting in Midaz? Start with the **[Accounting Walkthrough](/en/products/midaz/accounting-walkthrough)**. It gives a step-by-step path from the chart of accounts to a working Pix payment example.
</Tip>
