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

# Reschedule loan account

> Appends an immutable rescheduled schedule version and recalculation trigger. Idempotency is enforced by the lib-commons idempotency middleware via the X-Idempotency header; a reused key with different facts yields 422 (IDEMPOTENCY_KEY_REUSE); once the middleware has forgotten the key, an X-Idempotency key or transactionId reused with a different body yields 409 (LENDER-0342). A malformed UUID yields 422. When the request is a renegotiation that art. 22 judges SUBSTANTIAL, the same call ends this contract and mints its replacement: the 201 carries this contract's last ladder, at zero, and a substantialRenegotiation block naming the replacement. Resending the request answers the same block. A reschedule while a full-settlement quote on the contract is still payable is refused with 409 (LENDER-0375) and writes nothing; liveQuoteId and liveQuoteExpiresAt name that quote.



## OpenAPI

````yaml /pt/openapi/v3-current/lender.yaml post /api/v1/loan-accounts/{id}/reschedules
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-accounts/{id}/reschedules:
    post:
      tags:
        - Loan Accounts
      summary: Reschedule loan account
      description: >-
        Appends an immutable rescheduled schedule version and recalculation
        trigger. Idempotency is enforced by the lib-commons idempotency
        middleware via the X-Idempotency header; a reused key with different
        facts yields 422 (IDEMPOTENCY_KEY_REUSE); once the middleware has
        forgotten the key, an X-Idempotency key or transactionId reused with a
        different body yields 409 (LENDER-0342). A malformed UUID yields 422.
        When the request is a renegotiation that art. 22 judges SUBSTANTIAL, the
        same call ends this contract and mints its replacement: the 201 carries
        this contract's last ladder, at zero, and a substantialRenegotiation
        block naming the replacement. Resending the request answers the same
        block. A reschedule while a full-settlement quote on the contract is
        still payable is refused with 409 (LENDER-0375) and writes nothing;
        liveQuoteId and liveQuoteExpiresAt name that quote.
      operationId: rescheduleLoanAccount
      parameters:
        - description: Loan account identifier (UUID).
          in: path
          name: id
          required: true
          schema:
            description: Loan account identifier (UUID).
            examples:
              - 550e8400-e29b-41d4-a716-446655440000
            format: uuid
            type: string
        - description: >-
            Canonical idempotency request ID. Enforced by the lib-commons
            idempotency middleware.
          in: header
          name: X-Idempotency
          required: true
          schema:
            description: >-
              Canonical idempotency request ID. Enforced by the lib-commons
              idempotency middleware.
            examples:
              - 550e8400-e29b-41d4-a716-446655440011
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RescheduleLoanAccountHumaRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduleVersionCommandHumaBody'
          description: Created
          headers:
            X-Idempotency-Replayed:
              description: >-
                "true" when this response replays a request already executed
                under the same X-Idempotency, so nothing ran a second time and
                no money moved again. Absent on a first execution.
              schema:
                type: string
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: >-
            The at-most-once contract refused the request before any handler
            ran: no X-Idempotency header (IDEMPOTENCY_KEY_REQUIRED), a key under
            a spelling this service does not read
            (IDEMPOTENCY_KEY_HEADER_UNKNOWN), or a request that could not be
            scoped to a tenant (IDEMPOTENCY_TENANT_REQUIRED). The code is in the
            problem document's `code` member.
        '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:
    RescheduleLoanAccountHumaRequest:
      additionalProperties: false
      properties:
        businessDate:
          description: YYYY-MM-DD business date applied to the reschedule.
          examples:
            - '2026-06-14'
          type: string
        effectiveDate:
          description: YYYY-MM-DD effective date of the reschedule.
          examples:
            - '2026-06-14'
          type: string
        firstRescheduledDueDate:
          description: YYYY-MM-DD first due date of the rescheduled plan.
          examples:
            - '2026-06-14'
          type: string
        indexChanged:
          description: >-
            RENEGOTIATION. Declare that the modification changed the contract's
            index. A SUBSTANTIAL trigger under art. 22. It is DECLARED and never
            inferred: an index is not a concept this core models, so no reading
            of the stored schedule could tell one change from another.
            Declaration beats calculation, and a declared change is substantial
            however small its effect on present value.
          type: boolean
        isRestructuring:
          description: >-
            RESTRUCTURING CLASS. Whether this renegotiation is a restructuring
            (reestruturação, Res. CMN 4.966; forbearance). Omit to record the
            default the Lender computes: in Brazil, a restructuring when the
            debt is more than 30 days overdue on the effective date and the
            renegotiation grants any concession: the new plan ends after the
            original term, is priced below the original rate, folds overdue
            instalments into the new principal, or waives late charges
            (waiveLateCharges). A value different from the default requires
            restructuringJustification.
          type: boolean
        newCurrency:
          description: >-
            RENEGOTIATION. ISO-4217 currency when the modification changes the
            contract's currency. A currency change is a SUBSTANTIAL modification
            under art. 22, and it is the one qualitative trigger the system
            computes for itself rather than taking on the operator's word.
          examples:
            - USD
          maxLength: 3
          type: string
        newMonthlyInterestRate:
          description: >-
            RENEGOTIATION. Monthly interest rate as a decimal FRACTION (0.025 is
            2.5% a month) to price the new schedule at, in place of the rate the
            contract was written at. Omit to re-time at the contract's own rate.
            Supplying it makes this a renegotiation under Res. CMN 4.966/2021
            art. 22, which is judged before anything is written: a substantial
            one ends this contract and mints a replacement (see
            substantialRenegotiation in the response), any other keeps the
            contract and settles the difference against the result account.
          examples:
            - '0.025'
          type: string
        newTermMonths:
          description: >-
            Number of monthly instalments of the rescheduled plan, at most 600.
            The term they span is bounded by the loan product version's maximum
            term when it declares one (LENDER-0396): months from the effective
            date to the last instalment's grid date, a started month counting
            whole.
          examples:
            - 24
          format: int64
          minimum: 1
          type: integer
        rateTypeChanged:
          description: >-
            RENEGOTIATION. Declare that the modification changed the contract's
            rate type, for instance fixed to floating. A SUBSTANTIAL trigger
            under art. 22, declared for the same reason as indexChanged.
          type: boolean
        reason:
          description: Operator-supplied reschedule reason.
          maxLength: 128
          type: string
        restructuringJustification:
          description: >-
            RESTRUCTURING CLASS. Written justification, required when
            isRestructuring differs from the computed default and ignored when
            it agrees.
          maxLength: 2048
          type: string
        transactionId:
          description: Operator-supplied reschedule transaction identifier.
          maxLength: 128
          type: string
        waiveLateCharges:
          description: >-
            Waive the late fine and default interest the contract owes on the
            effective date. Omit, or false, to carry them into the new principal
            and recognise them. Waived, what month closes already recognised
            goes to the renegotiation loss and the rest is never recognised.
          type: boolean
      required:
        - transactionId
        - newTermMonths
        - firstRescheduledDueDate
        - effectiveDate
        - businessDate
        - reason
      type: object
    ScheduleVersionCommandHumaBody:
      additionalProperties: false
      properties:
        previousScheduleVersionId:
          description: Predecessor schedule version UUID.
          examples:
            - 550e8400-e29b-41d4-a716-446655440031
          type: string
        scheduleVersion:
          $ref: '#/components/schemas/ScheduleVersionHumaBody'
          description: The newly appended immutable schedule version.
        substantialRenegotiation:
          $ref: '#/components/schemas/SubstantialRenegotiationHumaBody'
          description: >-
            Present only when a reschedule was a SUBSTANTIAL renegotiation under
            Res. CMN 4.966/2021 art. 22: this contract was ended
            (scheduleVersion is its last ladder, at zero) and a replacement
            contract now carries the debt. Omitted on every other outcome.
      required:
        - previousScheduleVersionId
        - scheduleVersion
      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
    ScheduleVersionHumaBody:
      additionalProperties: false
      properties:
        createdAt:
          description: ISO-8601 creation timestamp (UTC).
          examples:
            - '2026-06-14T12:00:00Z'
          type: string
        financedTaxAmount:
          description: >-
            Tax the reschedule levied and financed into the new principal (in
            Brazil, the IOF complementar of Decreto 6.306/2007 art. 7 par. 7), 2
            d.p. string. Omitted when nothing was levied.
          examples:
            - '25.72'
          type: string
        id:
          description: Schedule version UUID.
          examples:
            - 550e8400-e29b-41d4-a716-446655440030
          type: string
        installments:
          description: Recalculated installment schedule.
          items:
            $ref: '#/components/schemas/ScheduleVersionInstallmentHumaBody'
          type:
            - array
            - 'null'
        loanAccountId:
          description: Loan account UUID.
          examples:
            - 550e8400-e29b-41d4-a716-446655440000
          type: string
        predecessorVersionId:
          description: Predecessor schedule version UUID, if any.
          examples:
            - 550e8400-e29b-41d4-a716-446655440031
          type: string
        pricedAtMonthlyRate:
          description: >-
            Monthly interest rate as a decimal fraction that the product's
            schedule generator actually priced this version at. Omitted when
            unrecorded.
          examples:
            - '0.025'
          type: string
        reason:
          description: Reason the version was appended.
          type: string
        restructuring:
          $ref: '#/components/schemas/RestructuringClassHumaBody'
          description: >-
            The restructuring class recorded with this renegotiation. Present on
            a reschedule; omitted on any other schedule change.
        triggerTransactionId:
          description: Transaction that triggered the recalculation.
          type: string
        versionNumber:
          description: Monotonic schedule version number.
          examples:
            - 2
          format: int64
          type: integer
        waivedLateCharges:
          description: >-
            Late fine and default interest the reschedule waived instead of
            carrying into the new principal (waiveLateCharges), 2 d.p. string.
            Omitted when nothing was waived.
          examples:
            - '7.30'
          type: string
      required:
        - id
        - loanAccountId
        - versionNumber
        - reason
        - triggerTransactionId
        - createdAt
        - installments
      type: object
    SubstantialRenegotiationHumaBody:
      additionalProperties: false
      properties:
        replacedLifecycleState:
          description: >-
            Lifecycle state of the contract named in the path, which left the
            book.
          enum:
            - renegotiated
          type: string
        replacementLoanAccountId:
          description: >-
            Loan account UUID of the replacement contract, which now carries the
            debt.
          examples:
            - 550e8400-e29b-41d4-a716-446655440040
          type: string
        replacementLoanApplicationId:
          description: Loan application UUID of the replacement contract.
          examples:
            - 550e8400-e29b-41d4-a716-446655440041
          type: string
        trigger:
          description: >-
            What made the modification substantial: the present-value test, or a
            declared change of currency, index or rate type.
          enum:
            - present_value
            - currency
            - index
            - rate_type
          type: string
      required:
        - replacementLoanAccountId
        - replacementLoanApplicationId
        - replacedLifecycleState
        - trigger
      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
    ScheduleVersionInstallmentHumaBody:
      additionalProperties: false
      properties:
        dueDate:
          description: ISO-8601 due date.
          examples:
            - '2026-06-14T12:00:00Z'
          type: string
        feesAmount:
          description: Fees due (2 d.p. string).
          examples:
            - '3.50'
          type: string
        interestAmount:
          description: Interest due (2 d.p. string).
          examples:
            - '20.00'
          type: string
        number:
          description: Installment ordinal (1-based).
          examples:
            - 3
          format: int64
          type: integer
        penaltiesAmount:
          description: Penalties due (2 d.p. string).
          examples:
            - '1.50'
          type: string
        principalAmount:
          description: Principal due (2 d.p. string).
          examples:
            - '100.00'
          type: string
        principalRemaining:
          description: >-
            Unpaid principal for THIS installment (per-installment, 2 d.p.
            string) — not the whole-loan declining balance.
          examples:
            - '100.00'
          type: string
        totalAmount:
          description: Total due (2 d.p. string).
          examples:
            - '125.00'
          type: string
      required:
        - number
        - dueDate
        - principalAmount
        - principalRemaining
        - interestAmount
        - feesAmount
        - penaltiesAmount
        - totalAmount
      type: object
    RestructuringClassHumaBody:
      additionalProperties: false
      properties:
        defaultIsRestructuring:
          description: The default the Lender computed for this renegotiation.
          type: boolean
        isRestructuring:
          description: >-
            Whether the renegotiation is a restructuring (reestruturação, Res.
            CMN 4.966; forbearance), as recorded.
          type: boolean
        justification:
          description: >-
            The operator's written justification. Present exactly when
            isRestructuring differs from defaultIsRestructuring.
          type: string
        recordedAt:
          description: RFC 3339 UTC instant the class was recorded.
          examples:
            - '2026-06-14T12:00:00Z'
          type: string
        recordedBy:
          description: >-
            Authenticated subject that recorded the renegotiation; empty when
            the deployment runs without authentication.
          examples:
            - officer-xyz
          type: string
      required:
        - isRestructuring
        - defaultIsRestructuring
        - recordedBy
        - recordedAt
      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.