> ## 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 /pt/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). See
    docs/contracts/money-route-idempotency.md.
  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.
    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.
    name: Consignado
  - 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
        '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
components:
  schemas:
    SupersedeAccountingProfileHumaInputBody:
      additionalProperties: false
      properties:
        accountingMode:
          description: >-
            Accounting recognition mode. It must match what the product already
            books under: the accrual basis is contract economics, frozen on the
            product version at origination, and only the chart of accounts is
            datable.
          enum:
            - accrual
            - cash
          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 yet: 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; both-or-neither with midazOrganizationId.
          examples:
            - ledger-def
          maxLength: 128
          type: string
        midazOrganizationId:
          description: >-
            Optional per-product Midaz organization the new chart's postings
            route into; both-or-neither with midazLedgerId.
          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.
          items:
            $ref: '#/components/schemas/PostingRuleHumaInputBody'
          maxItems: 20
          minItems: 7
          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: false
      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
            - collection_unapplied
            - collection_reapply
            - collection_refund
            - assignment_derecognition
            - assignment_retained_settlement
            - assignment_repurchase
            - refinance_payoff
            - refinance_payoff_reversal
            - provision_constitution
            - provision_reversal
            - renegotiation_gain
            - renegotiation_loss
            - renegotiation_derecognition
            - renegotiation_recognition
          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. 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. Renegotiation_gain requires exactly two legs in this order: a
            required principal debit and a required renegotiation_gain credit;
            renegotiation_loss requires the mirror, a required
            renegotiation_loss debit and a required principal credit.
            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|cash).
          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 is booked against the chart in force for
            the competência it belongs to, never the day the run happened. 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
        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:
            - 1.1.1.01
          type: string
        toAccount:
          description: The account it is booked at under the incoming chart.
          examples:
            - 1.1.2.01
          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.
          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
        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 (borrower
            position) instead of one aggregated per product. 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
      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
        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
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````