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

# Create prepayment quote

> Creates a time-limited, auditable prepayment quote with settlement and rebate breakdown. A full-settlement quote issues its payer a pix or boleto charge, so it is refused with 409 (LENDER-0375) while another full-settlement quote on the contract is neither accepted nor expired and its charge is neither cancelled nor refused. An outdated calculation does not release that charge. That refusal's problem document carries `liveQuoteId` and `liveQuoteExpiresAt`, the quote whose payoff statement to show instead; quote again under a new X-Idempotency once it ends. A quote valued on a São Paulo civil day before the contract's disbursement is refused with 422 (LENDER-0985). A payoff priced before the contract moved is refused with 409 (LENDER-0353 or 0354). The single-live rule applies across all payoff channels, including portability. A partial quote issues no charge, so the single-live rule never refuses it. A full-settlement quote waits up to five seconds on another write to the same contract or on a running month close, and is refused past it with 409 (LENDER-0370): retry it under the same X-Idempotency.



## OpenAPI

````yaml /pt/openapi/v3-current/lender.yaml post /api/v1/br/loan-accounts/{id}/prepayment-quote
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/br/loan-accounts/{id}/prepayment-quote:
    post:
      tags:
        - Loan Accounts
      summary: Create prepayment quote
      description: >-
        Creates a time-limited, auditable prepayment quote with settlement and
        rebate breakdown. A full-settlement quote issues its payer a pix or
        boleto charge, so it is refused with 409 (LENDER-0375) while another
        full-settlement quote on the contract is neither accepted nor expired
        and its charge is neither cancelled nor refused. An outdated calculation
        does not release that charge. That refusal's problem document carries
        `liveQuoteId` and `liveQuoteExpiresAt`, the quote whose payoff statement
        to show instead; quote again under a new X-Idempotency once it ends. A
        quote valued on a São Paulo civil day before the contract's disbursement
        is refused with 422 (LENDER-0985). A payoff priced before the contract
        moved is refused with 409 (LENDER-0353 or 0354). The single-live rule
        applies across all payoff channels, including portability. A partial
        quote issues no charge, so the single-live rule never refuses it. A
        full-settlement quote waits up to five seconds on another write to the
        same contract or on a running month close, and is refused past it with
        409 (LENDER-0370): retry it under the same X-Idempotency.
      operationId: createPrepaymentQuote
      parameters:
        - description: Loan account identifier.
          in: path
          name: id
          required: true
          schema:
            description: Loan account identifier.
            format: uuid
            type: string
        - description: >-
            Canonical idempotency request ID. Required: a full-settlement quote
            issues a payment demand to the borrower, so without a key a retry
            cannot be told apart from a second demand.
          in: header
          name: X-Idempotency
          required: true
          schema:
            description: >-
              Canonical idempotency request ID. Required: a full-settlement
              quote issues a payment demand to the borrower, so without a key a
              retry cannot be told apart from a second demand.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              discriminator:
                mapping:
                  full_settlement: '#/components/schemas/FullSettlementPrepaymentQuoteRequest'
                  partial: '#/components/schemas/PartialPrepaymentQuoteRequest'
                propertyName: quoteType
              oneOf:
                - $ref: '#/components/schemas/PartialPrepaymentQuoteRequest'
                - $ref: '#/components/schemas/FullSettlementPrepaymentQuoteRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrepaymentQuoteResponse'
          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:
    FullSettlementPrepaymentQuoteRequest:
      additionalProperties: false
      properties:
        businessDate:
          description: >-
            Optional valuation date (RFC3339 or YYYY-MM-DD); defaults to now
            (UTC).
          examples:
            - '2026-06-14'
          type: string
        instrumentType:
          description: Borrower payment rail.
          enum:
            - pix
            - boleto
          type: string
        overridePdd:
          description: When true, overrides the PDD stage gate during quote generation.
          type: boolean
        payoffPurpose:
          description: >-
            Who pays this payoff: the borrower prepaying, or the institution
            taking the contract over by portability. Required when the loan is
            consignado (omitting it is refused with 422); optional for other
            loans.
          enum:
            - borrower_prepayment
            - portability
          examples:
            - borrower_prepayment
          type: string
        quoteType:
          description: 'Discriminator: full settlement of the outstanding balance.'
          enum:
            - full_settlement
          type: string
      required:
        - quoteType
        - instrumentType
      type: object
    PartialPrepaymentQuoteRequest:
      additionalProperties: false
      properties:
        amount:
          description: Prepayment amount in major currency units (e.g. "100.00").
          examples:
            - '42000.00'
          type: string
        businessDate:
          description: >-
            Optional valuation date (RFC3339 or YYYY-MM-DD); defaults to now
            (UTC).
          examples:
            - '2026-06-14'
          type: string
        overridePdd:
          description: When true, overrides the PDD stage gate during quote generation.
          type: boolean
        quoteType:
          description: 'Discriminator: partial principal prepayment.'
          enum:
            - partial
          type: string
      required:
        - quoteType
        - amount
      type: object
    PrepaymentQuoteResponse:
      additionalProperties: false
      properties:
        acceptedAt:
          description: >-
            RFC3339 UTC timestamp when the quote was accepted; empty while still
            pending.
          examples:
            - '2026-06-14T12:00:00Z'
          type: string
        acceptedTransactionId:
          description: >-
            Identifier of the settlement transaction that accepted the quote;
            empty while still pending.
          examples:
            - 550e8400-e29b-41d4-a716-446655440002
          type: string
        accruedInterest:
          description: >-
            Interest a full settlement charges on top of the principal up to the
            payoff day: accrued and unpaid, less what a standing
            automatic-prepayment promise earned by then, as the payment that
            promised an instalment counts at its present value that day; zero on
            a partial. Decimal string, scale 2.
          examples:
            - '111.74'
          type: string
        arrearsFees:
          description: >-
            Fees of the instalments due on or before the valuation day, paid
            first by a partial prepayment; zero on a full settlement. Decimal
            string, scale 2.
          examples:
            - '0.00'
          type: string
        arrearsInterest:
          description: >-
            Interest of the instalments due on or before the valuation day, paid
            first by a partial prepayment; zero on a full settlement. Decimal
            string, scale 2.
          examples:
            - '0.00'
          type: string
        arrearsLateCharges:
          description: >-
            Late fine and mora of the instalments due on or before the valuation
            day, paid first by a partial prepayment; zero on a full settlement.
            Decimal string, scale 2.
          examples:
            - '7.00'
          type: string
        arrearsPrincipal:
          description: >-
            Principal of the instalments due on or before the valuation day,
            which a partial prepayment pays before retiring principal; zero on a
            full settlement and when nothing is due. Decimal string, scale 2.
          examples:
            - '300.00'
          type: string
        chargeRebate:
          description: >-
            Rebate of unaccrued charges and fees credited on prepayment, as a
            decimal string, scale 2.
          examples:
            - '120.00'
          type: string
        consumerProtectionRegime:
          description: Consumer-protection regime label applied to the prepayment terms.
          type: string
        createdAt:
          description: RFC3339 UTC timestamp when the quote was created.
          examples:
            - '2026-06-14T12:00:00Z'
          type: string
        currency:
          description: ISO 4217 currency code of the loan and quote.
          examples:
            - BRL
          type: string
        expiresAt:
          description: RFC3339 UTC timestamp after which the quote is no longer valid.
          examples:
            - '2026-06-14T12:00:00Z'
          type: string
        fees:
          description: >-
            Applied charges the schedule holds open on the payoff day, charged
            on top of the principal on a full settlement; zero on a partial,
            whose charges stay on the instalments that bill them. Decimal
            string, scale 2.
          examples:
            - '25.00'
          type: string
        grossAmount:
          description: >-
            Retired settlement principal being paid off (equals the outstanding
            principal for a full settlement; on a partial, the principal retired
            once the arrears are paid), as a decimal string, scale 2.
          examples:
            - '42000.00'
          type: string
        heldCashApplied:
          description: >-
            Cash the contract already holds, paid ahead of its due dates, that
            the prepayment spends before asking the borrower for the rest: on a
            partial at most the amount asked, the rest staying held for the due
            dates, and on an automatic-prepayment version never the present
            value already promised to an instalment. Decimal string, scale 2.
          examples:
            - '507.27'
          type: string
        id:
          description: Unique identifier (UUID) of the prepayment quote.
          examples:
            - 550e8400-e29b-41d4-a716-446655440000
          type: string
        interestRebate:
          description: >-
            Mandatory interest rebate (juros nao incorridos) disclosed on
            prepayment, as a decimal string, scale 2. On a full settlement it is
            the interest not yet incurred on the payoff day.
          examples:
            - '1250.75'
          type: string
        iofReconciliation:
          description: >-
            IOF adjustment as a decimal string, scale 2. Defined-principal loans
            report zero because IOF is not refunded on early payoff.
          examples:
            - '0.00'
          type: string
        jurisdictionCode:
          description: ISO jurisdiction code governing the quote (e.g. "BR").
          examples:
            - BR
          type: string
        lateCharges:
          description: >-
            Late fine and mora open on the payoff day, charged on top of the
            principal on a full settlement; zero on a partial. Decimal string,
            scale 2.
          examples:
            - '7.00'
          type: string
        loanAccountId:
          description: UUID of the loan account the quote was generated for.
          examples:
            - 550e8400-e29b-41d4-a716-446655440001
          type: string
        netSettlementAmount:
          description: >-
            Net cash payable to settle: gross settlement principal plus accrued
            interest, late charges and applied charges, minus charge rebate,
            plus any IOF due, plus on a partial the arrears it pays first, minus
            the held cash it spends, never below zero, as a decimal string,
            scale 2. At zero the borrower pays nothing and a full settlement
            issues no charge; held cash above a payoff is owed back on the
            payoff refund desk. Interest rebate is disclosure-only;
            defined-principal loans report zero IOF reconciliation because IOF
            is not refunded.
          examples:
            - '41992.23'
          type: string
        payoffPurpose:
          description: >-
            Who pays this frozen payoff: borrower_prepayment or portability.
            Omitted when the quote does not state one.
          examples:
            - portability
          type: string
        principalOutstanding:
          description: >-
            Outstanding principal at quote time as a decimal string in major
            currency units, scale 2.
          examples:
            - '42000.00'
          type: string
        profileVersion:
          description: Jurisdiction profile version used to compute the quote.
          examples:
            - 1.0.0
          type: string
        quoteType:
          description: 'Quote variant: partial (principal prepayment) or full_settlement.'
          examples:
            - partial
          type: string
        rebateMandatory:
          description: >-
            True when regulation mandates applying the interest rebate to this
            quote.
          type: boolean
        slaDueAt:
          description: >-
            RFC3339 UTC full-settlement SLA deadline; omitted for partial
            quotes.
          examples:
            - '2026-06-19T12:00:00Z'
          type: string
      required:
        - id
        - loanAccountId
        - quoteType
        - principalOutstanding
        - accruedInterest
        - lateCharges
        - fees
        - interestRebate
        - chargeRebate
        - iofReconciliation
        - grossAmount
        - heldCashApplied
        - netSettlementAmount
        - arrearsPrincipal
        - arrearsInterest
        - arrearsFees
        - arrearsLateCharges
        - rebateMandatory
        - expiresAt
        - currency
        - profileVersion
        - jurisdictionCode
        - consumerProtectionRegime
        - createdAt
      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
    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
  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.