> ## 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 and accrual runs

> How Lender books to the ledger — accounting profiles and posting rules, durable posting intents, accrual runs, and journal references.

export const GDoubleEntry = ({children}) => <Tooltip headline="Double-entry accounting" tip="Every financial movement is recorded as at least two operations: a debit from one account and a credit to another, ensuring the system always balances." cta="See glossary" href="/en/glossary">
    {children}
  </Tooltip>;

export const GLedger = ({children}) => <Tooltip headline="Ledger" tip="The core financial book that records all transactions, balances, and operations for an organization — the single source of truth for a business unit's finances." cta="See glossary" href="/en/glossary">
    {children}
  </Tooltip>;

Disbursement and interest accrual reach the <GLedger>ledger</GLedger>, and so does a prepayment that settles a Brazilian loan account against a prepayment quote. Lender's accounting layer is how they get there: a product declares its posting rules once, and from then on each of those events books automatically and traceably.

## Accounting profiles and posting rules

***

An **accounting profile** binds a product version to the ledger. It defines the **posting rules** — the <GDoubleEntry>double-entry</GDoubleEntry> legs that fire for each kind of financial event — and the ledger organization and ledger the resulting transactions book into. You create a profile per product:

`POST /api/v1/loan-products/{id}/accounting-profiles`

Posting rules are validated when the profile is created, so a product cannot go live with legs that would not balance.

## Posting intents and the relay

***

Lender does not call the ledger inline. When a financial event happens, it persists a durable **posting intent** in the same database transaction that changes domain state, then a relay posts the balanced transaction to Midaz asynchronously. This is what makes bookings reliable:

* **The intent commits with the state change** — both land in one database transaction, through a transactional outbox.
* **Idempotent** — each posting carries a deterministic key, so retries collapse to one ledger transaction.
* **Fails closed** — if routing cannot resolve a non-empty ledger target, the post is refused rather than written to the wrong place.

The full path is described in [Lender in the platform](/en/lender/lender-in-the-platform).

## Accrual runs

***

An **accrual run** recognizes interest and the other time-based amounts. One run takes each loan whose anniversary falls on the run's business date, and produces the postings for it.

`POST /api/v1/accrual-runs` starts a run. Lender selects the candidate loan accounts itself, recognizes interest per account, and writes one posting intent per recognition.

<Tip>
  Recognition is idempotent per loan account, per accounting month, and per amount kind. A run started twice for the same month recognizes interest once.
</Tip>

## Journal references

***

Each accrual run records a **journal reference** — the run's own accounting identifier. The reference record also stores the correlation id that Lender derived for the run. The journal reference id identifies one run exactly; a read by correlation id returns the most recent run that shares that mode, business date, and product scope.

| Operation                             | Purpose                                        |
| ------------------------------------- | ---------------------------------------------- |
| `GET /api/v1/journal-references`      | Look up a journal reference by correlation id. |
| `GET /api/v1/journal-references/{id}` | Read a single journal reference.               |

## Next steps

***

<Card title="Jurisdictions" icon="earth-americas" href="/en/lender/jurisdictions" horizontal>
  See how the active jurisdiction shapes disclosures and endpoints.
</Card>

<Card title="Brazil regulatory pack" icon="brazilian-real-sign" href="/en/lender/brazil-regulatory-pack" horizontal>
  Layer CET, IOF, and PDD staging on top of the accounting model.
</Card>
