> ## Documentation Index
> Fetch the complete documentation index at: https://docs.loopscale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Simple repay loan

> A simplified repay endpoint that handles a single strategy at a time. Unlike the full repay endpoint, it does not support CPI instructions, collateral withdrawals, or setup instructions. If a ledger is fully repaid on a multi-ledger loan, weight matrix updates are automatically generated to redistribute collateral away from the emptied ledger.



## OpenAPI

````yaml post /markets/creditbook/repay_simple
openapi: 3.1.3
info:
  title: Loopscale API
  version: 1.0.0
servers:
  - url: https://tars.loopscale.com/v1
    description: Loopscale Production Server
security: []
paths:
  /markets/creditbook/repay_simple:
    post:
      tags:
        - Markets
      summary: Simple repay loan
      description: >-
        A simplified repay endpoint that handles a single strategy at a time.
        Unlike the full repay endpoint, it does not support CPI instructions,
        collateral withdrawals, or setup instructions. If a ledger is fully
        repaid on a multi-ledger loan, weight matrix updates are automatically
        generated to redistribute collateral away from the emptied ledger.
      operationId: simpleRepayLoan
      parameters:
        - name: payer
          in: header
          required: true
          schema:
            type: string
          description: Wallet that pays transaction fees for the repay transaction.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SimpleRepayRequest'
      responses:
        '200':
          description: Serialized transactions and expected post-repayment loan state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoanLockTransactionResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/GeneralError'
components:
  schemas:
    SimpleRepayRequest:
      type: object
      required:
        - loan
        - repayParams
        - strategy
      properties:
        loan:
          type: string
          description: Address of the loan to repay.
        repayParams:
          $ref: '#/components/schemas/RepayLedgerParam'
          description: Repayment parameters for the targeted ledger.
        strategy:
          type: string
          description: Address of the strategy (vault) to repay against.
        weightMatrixUpdates:
          type: array
          items:
            $ref: '#/components/schemas/WeightMatrixUpdate'
          description: >-
            Optional weight matrix updates. If omitted and a ledger is fully
            repaid on a multi-ledger loan, these are auto-generated.
        isLoop:
          type: boolean
          description: >-
            Optional flag indicating whether this repayment is part of a loop
            transaction.
    LoanLockTransactionResponse:
      type: object
      properties:
        transactions:
          type: array
          items:
            type: object
            required:
              - message
              - signatures
            properties:
              message:
                type: string
                description: Base64-encoded versioned transaction message
              signatures:
                type: array
                items:
                  type: object
                  required:
                    - publicKey
                    - signature
                  properties:
                    publicKey:
                      type: string
                    signature:
                      type: string
        expectedLoanInfo:
          type: object
          description: Loan post transaction state used for verification
          properties:
            loan:
              type: object
              properties:
                address:
                  type: string
                  description: Onchain loan account
    RepayLedgerParam:
      type: object
      required:
        - amount
        - ledgerIndex
        - repayAll
      properties:
        amount:
          type: number
          description: Amount to repay in lamports
        ledgerIndex:
          type: integer
          description: Ledger index to apply repayment to (0–4)
        repayAll:
          type: boolean
          description: Set to true if intending to fully repay this ledger
    WeightMatrixUpdate:
      type: object
      required:
        - weightMatrixUpdate
        - collateralIndex
      properties:
        weightMatrixUpdate:
          type: array
          items:
            type: number
          description: New allocation percentages per ledger (e.g. [1000000, 0, 0, 0, 0])
        collateralIndex:
          type: integer
          description: Collateral asset index to apply the weights to
  responses:
    BadRequest:
      description: Bad Request
      content:
        text/plain:
          schema:
            type: string
            example: 'Something went wrong: You have an error in your SQL syntax.'
    GeneralError:
      description: General Server Error
      content:
        text/plain:
          schema:
            type: string
            example: >-
              Failed to deserialize the JSON body into the target type: missing
              field `mints` at line 1 column 1.

````