> ## 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.

# Supersede loan product chart of accounts

> Replaces the chart of accounts every configured version of this loan product books against, from a stated month forward. One action, one effective date, every affected version written together or none. A version with no chart is not touched: giving it a first one is the separate configure action, and this route requires its own permission because replacing a live chart moves balances on every live contract.



## OpenAPI

````yaml /es/openapi/v3-current/lender.yaml post /api/v1/loan-products/{id}/accounting-profiles/supersessions
openapi: 3.1.0
info:
  contact:
    email: contact@lerian.studio
    name: Lerian Studio
    url: https://lerian.studio
  description: >-
    Code-first OpenAPI 3.1 surface for the Lender service. Routes that move
    money are at-most-once per X-Idempotency: when one answers 5xx, the
    X-Idempotency-Fenced response header says whether that key is now refusing
    resends (true) or free to retry (false or absent).
  license:
    name: Lerian Studio General License
  title: Lender API
  version: 1.0.0
servers:
  - url: https://lender.sandbox.lerian.net
security:
  - BearerAuth: []
tags:
  - description: >-
      Caller session projection: validated subject and effective permissions for
      the presented token.
    name: Session
  - description: >-
      Ledger accounting operations: journal entries and accrual postings for
      loan accounts. Operations under /api/v1/internal are back-office
      operations for the client's operators: they require a person's login, and
      a service credential gets 403.
    name: Accounting
  - description: >-
      Loan application intake and lifecycle: submission, decisioning, and
      status.
    name: LoanApplications
  - description: >-
      Loan product catalog: definition, versioning, and activation of lending
      products.
    name: LoanProducts
  - description: >-
      Loan account servicing operations: balances, schedules, and account-level
      actions.
    name: Loan Accounts
  - description: >-
      Portfolio dashboard read operations: aggregated portfolio and performance
      views.
    name: Dashboard
  - description: >-
      Jurisdiction registry: supported jurisdiction profiles and their
      capabilities.
    name: Jurisdictions
  - description: >-
      Jurisdiction-specific loan application operations (Brazil origination
      surface).
    name: Loan Applications
  - description: >-
      Tax computation operations for jurisdiction-specific lending (e.g. Brazil
      IOF).
    name: Tax
  - description: >-
      Brazil consignado privado operations: contract lifecycle, exclusion
      repair, and compensating adjustments. Operations under /api/v1/internal
      are back-office operations for the client's operators: they require a
      person's login, and a service credential gets 403.
    name: Consignado
  - description: >-
      Inbound record quarantine. Operations under /api/v1/internal are
      back-office operations for the client's operators: they require a person's
      login, and a service credential gets 403.
    name: Streaming
  - description: >-
      Credit-instrument document template registry: versioned drafting and
      publication of CCB clausulado.
    name: DocumentTemplates
paths:
  /api/v1/loan-products/{id}/accounting-profiles/supersessions:
    post:
      tags:
        - LoanProducts
      summary: Supersede loan product chart of accounts
      description: >-
        Replaces the chart of accounts every configured version of this loan
        product books against, from a stated month forward. One action, one
        effective date, every affected version written together or none. A
        version with no chart is not touched: giving it a first one is the
        separate configure action, and this route requires its own permission
        because replacing a live chart moves balances on every live contract.
      operationId: supersedeLoanProductAccountingProfile
      parameters:
        - description: Loan product identifier.
          in: path
          name: id
          required: true
          schema:
            description: Loan product identifier.
            examples:
              - 550e8400-e29b-41d4-a716-446655440000
            format: uuid
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SupersedeAccountingProfileHumaInputBody'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SupersedeAccountingProfileHumaBody'
          description: Created
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unauthorized
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Forbidden
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Not Found
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Conflict
        '413':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Request Entity Too Large
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unprocessable Entity
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Internal Server Error
        '503':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Service Unavailable
        '504':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Gateway Timeout
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            Any other status this operation may carry, rendered as a problem
            document — including a refusal produced ahead of the service, such
            as a gateway or ingress answering on its behalf.
components:
  schemas:
    SupersedeAccountingProfileHumaInputBody:
      additionalProperties: false
      properties:
        accountingMode:
          description: Accounting recognition mode.
          enum:
            - accrual
          examples:
            - accrual
          type: string
        effectiveFrom:
          description: >-
            First civil day (YYYY-MM-DD) the new chart governs. Always a month
            start, and always a month that has not opened by tomorrow, so on the
            last day of a month the earliest is the 1st of the month after next:
            a chart landing inside the open competência would change the
            accounts of a month already partly accrued, and one landing on a
            posted month could never be corrected — the ledger dedupes a
            replayed month on a key that does not carry which chart produced the
            posting, so the correction is built, sent, and dropped in silence.
          examples:
            - '2026-08-01'
          format: date
          type: string
        midazLedgerId:
          description: >-
            Optional per-product Midaz ledger the new chart's postings route
            into; may be omitted beside midazOrganizationId, and the new chart
            books into the ledger the product books into in that organization
            today. A chart change never creates or moves the product's ledger: a
            chart resolving to another organization or ledger than the one it
            replaces is refused (LENDER-0443).
          examples:
            - ledger-def
          maxLength: 128
          type: string
        midazOrganizationId:
          description: >-
            Optional per-product Midaz organization the new chart's postings
            route into.
          examples:
            - org-abc
          maxLength: 128
          type: string
        postingRules:
          description: >-
            The complete new chart, in the same shape the configure route
            admits. It must keep every borrower position booked per operation,
            and must keep every per-operation position the outgoing chart had: a
            position the new chart stops booking leaves the balance already
            sitting there with nowhere to go, and the double entry would never
            complain. Every shared balance account the outgoing chart books (an
            allowance, a payable, cash) keeps its account and its sharing mode,
            because no balance transfer moves a shared account; revenue and
            expense accounts may move.
          items:
            $ref: '#/components/schemas/PostingRuleHumaInputBody'
          maxItems: 33
          minItems: 10
          type: array
      required:
        - effectiveFrom
        - accountingMode
        - postingRules
      type: object
    SupersedeAccountingProfileHumaBody:
      additionalProperties: false
      properties:
        charts:
          description: The new chart written for every affected version, one per version.
          items:
            $ref: '#/components/schemas/AccountingProfileHumaBody'
          type: array
        effectiveFrom:
          description: First civil day (YYYY-MM-DD) the new chart governs.
          examples:
            - '2026-08-01'
          type: string
        loanProductId:
          description: The product whose chart changed (uuid).
          examples:
            - 550e8400-e29b-41d4-a716-446655440000
          type: string
        movedPositions:
          description: >-
            Every per-operation position that changes account. Each one produces
            a balance-transfer posting on the effective date, on every live
            contract of every affected version, so no contract ends with its
            balance split across two accounts. Empty means the change files
            nothing anywhere new.
          items:
            $ref: '#/components/schemas/ChartPositionMoveHumaBody'
          type: array
      required:
        - loanProductId
        - effectiveFrom
        - charts
        - movedPositions
      type: object
    Detail:
      additionalProperties: true
      properties:
        code:
          description: >-
            Stable, machine-readable domain error code scoped to the emitting
            service (format: <SERVICE>-NNNN).
          type: string
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
        upstream:
          $ref: '#/components/schemas/Upstream'
          description: >-
            RFC 9457 extension member: the error a proxied third-party provider
            reported. Absent unless the emitting service explicitly surfaced
            one.
      type: object
    PostingRuleHumaInputBody:
      additionalProperties: false
      properties:
        eventType:
          description: Accounting event type.
          enum:
            - disbursement
            - repayment
            - prepayment
            - accrual
            - accrual_tax
            - accrual_fee_amortization
            - accrual_withholding
            - collection_unapplied
            - collection_reapply
            - collection_refund
            - assignment_derecognition
            - assignment_retained_settlement
            - assignment_secured_borrowing
            - assignment_funding_amortization
            - assignment_funding_payoff
            - assignment_repurchase
            - refinance_payoff
            - refinance_payoff_reversal
            - provision_constitution
            - provision_reversal
            - renegotiation_gain
            - renegotiation_loss
            - renegotiation_derecognition
            - renegotiation_recognition
            - returned_payment_recognition
            - returned_payment_provision_constitution
            - returned_payment_provision_reversal
            - returned_payment_write_off
            - payroll_payer_provision_constitution
            - payroll_payer_provision_reversal
            - compensation_control
            - charge_appropriation
            - credit_loss_recovery
          examples:
            - disbursement
          type: string
        legs:
          description: >-
            Non-null ordered posting legs. Prepayment requires exactly five legs
            in this component order: cash, charge_rebate, iof_refund, principal,
            iof_due; cash is a required debit, principal is a required credit,
            and the three component legs are optional with the corresponding
            sides. Assignment_derecognition requires exactly five legs in this
            component order: cash, assignment_loss, principal,
            assignment_interest, assignment_gain; cash is a required debit,
            principal is a required credit, and the assignment_interest credit
            and the two result legs are optional with the corresponding sides.
            The assignment_interest leg names the account the accrual rule
            debits: a sold receivable leaves at its amortized cost, which is
            principal plus the interest already recognized as income and not yet
            received, so both positions are relieved by the write-off.
            Assignment_retained_settlement requires exactly two legs in this
            order: a required cash debit and a required assignment_retained
            credit. Assignment_repurchase mirrors assignment_derecognition and
            requires exactly four legs in this order: a required principal
            debit, an optional assignment_loss debit, a required counterparty
            credit and an optional assignment_gain credit. Refinance_payoff
            requires exactly two legs in this order: a required counterparty
            debit and a required principal credit; refinance_payoff_reversal
            requires the mirror, a required principal debit and a required
            counterparty credit. The refinance_payoff posting also credits the
            interest the old contract owed through the swap to the accrual
            rule's interest receivable. Accrual_fee_amortization requires
            exactly two legs in this order: a required origination_fee component
            debit and a required interest role credit, neither optional. The
            debit account MUST be the same account the disbursement rule credits
            under its optional origination_fee component leg, because that is
            where the retained fee was parked at t0 and the only account
            releasing it can close; a sold contract's assignment_derecognition
            debits it for the fee still deferred. Accrual_withholding requires
            exactly two interest role legs in this order: a required debit on
            the account, and per-operation flag, the accrual rule debits, and a
            required credit on rendas a apropriar, one shared account, never
            per-operation, other than the accrual rule's revenue, because the
            contract a substantial renegotiation mints recognises the withheld
            interest of the one it replaces from that same account; a sold
            contract's assignment_derecognition debits that credit account for
            the rendas a apropriar it still carries.
            Assignment_funding_amortization requires exactly three legs in this
            component order: assignment_funding, assignment_funding_expense,
            assignment_funding_repasse; the assignment_funding debit and the
            assignment_funding_repasse credit are required and the
            assignment_funding_expense debit is optional, because a cession
            priced AT face has a zero effective rate and honestly posts two. The
            repasse leg is a PAYABLE to the fund and never cash: the borrower's
            deduction lands on the assignor's own rail account and a human
            repasses it days later, so crediting cash here would show money
            leaving before it leaves. Assignment_funding_payoff is that shape
            plus a fourth leg, an optional assignment_funding_gain credit, in
            this component order: assignment_funding,
            assignment_funding_expense, assignment_funding_repasse,
            assignment_funding_gain. What ends a cession early is the amount the
            fund AGREED to take, so unlike a monthly repasse it can land BELOW
            the obligation, and the deságio that stops being appropriable over a
            term that has just ended is credited there. Exactly one of the
            expense and gain legs ever carries an amount, and at an agreed
            amount equal to the obligation neither does. A monthly repasse
            cannot produce a gain and is refused for declaring one. The
            assignment_funding debit account MUST be the same account
            assignment_secured_borrowing credits under its own
            assignment_funding leg, for the reason the deferred origination fee
            names one account at both ends: an obligation raised in one account
            and discharged from another posts balanced entries for the life of
            the cession while the first never closes and the second goes
            negative by the whole price. Renegotiation_gain requires exactly two
            legs in this order: a required per-operation
            renegotiation_adjustment component debit and a required
            renegotiation_gain credit; renegotiation_loss requires the mirror, a
            required renegotiation_loss debit and a required per-operation
            renegotiation_adjustment credit. Both name the same adjustment
            account, apart from principal, interest receivable, rendas a
            apropriar and the deferred fee. Renegotiation_derecognition requires
            exactly three legs in this component order: counterparty,
            renegotiation_loss, renegotiation_gain; the counterparty debit is
            required and the two result legs are optional with the corresponding
            sides. It names NO asset leg, deliberately: which accounts a
            contract stops holding when it leaves the book is read from the
            ledger on the day, one leg per account that holds anything, so it
            cannot be declared here. The counterparty leg carries what moves to
            the replacement contract; on a contract a non-substantial
            renegotiation has already re-carried, the ledger holds more than the
            borrower owes and the result legs carry the difference, which is why
            a product cannot map this event without naming both result accounts.
            Every position a borrower can carry must be mapped to a
            per-operation account, or this event is refused at posting time
            because the ledger cannot say what one contract holds;
            renegotiation_recognition requires exactly two legs in this order: a
            required principal debit and a required counterparty credit. Other
            events require at least one debit and one credit.
          items:
            $ref: '#/components/schemas/PostingLegHumaInputBody'
          maxItems: 16
          minItems: 2
          type: array
        metadata:
          additionalProperties:
            type: string
          description: Optional metadata.
          type: object
      required:
        - eventType
        - legs
      type: object
    AccountingProfileHumaBody:
      additionalProperties: false
      properties:
        accountingMode:
          description: Accounting recognition mode (accrual).
          examples:
            - accrual
          type: string
        createdAt:
          description: Creation timestamp (RFC3339, UTC).
          examples:
            - '2026-06-14T12:00:00Z'
          type: string
        effectiveFrom:
          description: >-
            First civil day (YYYY-MM-DD) this chart of accounts governs, always
            a month start. A posting books on the chart that holds the
            contract's balance: the one in force on the day the contract opened,
            until a chart change's transfer moves the contract onto the new
            chart. A version configured before dated configuration reads
            1900-01-01, because it was the only chart that version ever had.
          examples:
            - '1900-01-01'
          type: string
        id:
          description: Server-assigned accounting profile identifier (uuid).
          examples:
            - 550e8400-e29b-41d4-a716-446655440003
          type: string
        loanProductVersionId:
          description: Loan product version this profile is configured for (uuid).
          examples:
            - 550e8400-e29b-41d4-a716-446655440001
          type: string
        midazLedgerId:
          description: >-
            Midaz ledger this chart's postings book into: the one the request
            named, or the one Lender chose when the request named only the
            organization. Absent when midazOrganizationId is absent.
          examples:
            - ledger-def
          type: string
        midazOrganizationId:
          description: >-
            Midaz organization this chart's postings book into. Absent on a
            single-tenant chart that falls back to the env default.
          examples:
            - org-abc
          type: string
        postingRules:
          description: Persisted GL account mappings, one per accounting event.
          items:
            $ref: '#/components/schemas/AccountingPostingRuleHumaBody'
          type:
            - array
            - 'null'
      required:
        - id
        - loanProductVersionId
        - accountingMode
        - postingRules
        - effectiveFrom
        - createdAt
      type: object
    ChartPositionMoveHumaBody:
      additionalProperties: false
      properties:
        amountCode:
          description: The position that moved, in the vocabulary the posting legs use.
          examples:
            - principal
          type: string
        fromAccount:
          description: The account it is booked at under the outgoing chart.
          examples:
            - 1100-10-001
          type: string
        toAccount:
          description: The account it is booked at under the incoming chart.
          examples:
            - 1100-20-001
          type: string
      required:
        - amountCode
        - fromAccount
        - toAccount
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    Upstream:
      additionalProperties: false
      properties:
        code:
          description: The upstream provider's own error code, verbatim.
          examples:
            - E4001
          type: string
        message:
          description: >-
            The upstream provider's own error message, verbatim (bounded, never
            its raw response body).
          examples:
            - account not found at provider
          type: string
      type: object
    PostingLegHumaInputBody:
      additionalProperties: false
      properties:
        account:
          description: >-
            GL account for this leg, as its Midaz alias: at most 50 letters,
            digits, ':', '_' and '-', with an optional leading '@', or
            @external/<ASSET> (LENDER-0429 otherwise).
          examples:
            - 1100-10-001
          maxLength: 128
          type: string
        component:
          description: Open withholding component code (e.g. "iof"); set this XOR role.
          examples:
            - iof
          maxLength: 64
          type: string
        nature:
          description: >-
            The account's own nature, not this leg's side: debit for an asset or
            expense, credit for a liability, equity or revenue. A contra account
            takes its own nature (rendas a apropriar is credit), and the art. 22
            renegotiation adjustment is a contra-asset of credit nature. The
            ledger fixes the account's balance direction from it when the
            account is first created, and it never changes; every leg naming one
            account must declare the same nature.
          enum:
            - debit
            - credit
          examples:
            - debit
          type: string
        optional:
          description: >-
            Whether a component amount may be omitted or zero at posting time.
            Permitted only on component legs; omitted defaults to false.
          type: boolean
        perOperation:
          description: >-
            Whether this leg books into a per-operation account instead of one
            aggregated per product. A borrower position (principal, interest,
            fees, penalties, unapplied_cash, assignment_retained,
            returned_payment) must be per operation, except a revenue or expense
            leg and the accrual_withholding credit to rendas a apropriar; a
            sale's assignment_interest leg books the accrual's interest
            receivable, same account and same flag (LENDER-0408 otherwise). When
            true, "account" is a prefix limited to 17 characters of letters,
            digits, '_' and '-'; omitted defaults to false (aggregated).
          type: boolean
        role:
          description: Reserved economic role of this leg; set this XOR component.
          enum:
            - principal
            - interest
            - iof
            - tax
            - cash
            - unapplied_cash
            - counterparty
            - suspense
          examples:
            - principal
          type: string
        side:
          description: Whether this leg debits or credits the account.
          enum:
            - debit
            - credit
          examples:
            - debit
          type: string
      required:
        - account
        - side
        - nature
      type: object
    AccountingPostingRuleHumaBody:
      additionalProperties: false
      properties:
        eventType:
          description: Accounting event type, one of the values the request body admits.
          examples:
            - disbursement
          type: string
        legs:
          description: Persisted ordered posting legs.
          items:
            $ref: '#/components/schemas/AccountingPostingLegBody'
          type: array
        metadata:
          additionalProperties:
            type: string
          description: Optional metadata carried with the rule.
          type: object
      required:
        - eventType
        - legs
        - metadata
      type: object
    AccountingPostingLegBody:
      additionalProperties: false
      properties:
        account:
          description: GL account for this leg.
          examples:
            - 1100-10-001
          type: string
        component:
          description: Open withholding component code (set XOR role).
          examples:
            - iof
          type: string
        nature:
          description: >-
            The account's own nature (debit or credit), as the chart declares
            it.
          enum:
            - debit
            - credit
          type: string
        optional:
          description: >-
            Whether the component amount may be absent or zero for a generated
            posting.
          type: boolean
        perOperation:
          description: >-
            Whether this leg books into a per-operation account (borrower
            position) rather than one aggregated per product.
          type: boolean
        role:
          description: Reserved economic role of this leg (set XOR component).
          enum:
            - principal
            - interest
            - iof
            - tax
            - cash
            - unapplied_cash
            - counterparty
            - suspense
          examples:
            - principal
          type: string
        side:
          description: Whether this leg debits or credits the account.
          enum:
            - debit
            - credit
          examples:
            - debit
          type: string
      required:
        - account
        - side
        - optional
        - perOperation
        - nature
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.