Accounting profiles and posting rules
An accounting profile binds a product version to the ledger. It defines the posting rules: the legs that fire for each kind of financial event. It also defines the ledger organization and ledger the resulting transactions book into. You create a profile per product:
POST /api/v1/loan-products/{id}/accounting-profiles
Lender validates the posting rules when you create the profile. A product therefore 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, Lender persists a durable posting intent. That write happens in the same database transaction that changes domain state. A relay then 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, Lender refuses the post and does not write it to the wrong place.
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.
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.
Next steps
Jurisdictions
See how the active jurisdiction shapes disclosures and endpoints.
Brazil regulatory pack
Layer CET, IOF, and PDD staging on top of the accounting model.

