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

# Borrow principal

> Borrows additional principal against an existing loan and can optionally refinance the targeted ledger in the same transaction.



## OpenAPI

````yaml post /markets/creditbook/borrow
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/borrow:
    post:
      tags:
        - Markets
      summary: Borrow principal
      description: >-
        Borrows additional principal against an existing loan and can optionally
        refinance the targeted ledger in the same transaction.
      operationId: borrowPrincipal
      parameters:
        - name: payer
          in: header
          required: true
          schema:
            type: string
          description: Wallet that pays transaction fees for the borrow transaction.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BorrowPrincipalActionRequest'
      responses:
        '200':
          description: Serialized transaction for borrowing additional principal.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VersionedTransactionResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/GeneralError'
components:
  schemas:
    BorrowPrincipalActionRequest:
      type: object
      required:
        - loan
        - borrowParams
        - strategy
      properties:
        loan:
          type: string
          description: Loan address to borrow against.
        refinanceParams:
          $ref: '#/components/schemas/RefinanceLedgerParams'
        borrowParams:
          $ref: '#/components/schemas/BorrowPrincipalActionParams'
        strategy:
          type: string
          description: Strategy address to borrow from.
        isLoop:
          type: boolean
          description: Optional loop marker used internally by Loopscale.
    VersionedTransactionResponse:
      type: object
      required:
        - message
        - signatures
      properties:
        message:
          type: string
          description: Base64-encoded versioned transaction message
        signatures:
          type: array
          items:
            $ref: '#/components/schemas/VersionedTransactionSignature'
    RefinanceLedgerParams:
      type: object
      required:
        - ledgerIndex
        - durationIndex
      properties:
        ledgerIndex:
          type: integer
        durationIndex:
          type: integer
        assetIndexGuidance:
          $ref: '#/components/schemas/AssetIndexGuidance'
    BorrowPrincipalActionParams:
      type: object
      required:
        - amount
        - expectedLoanValues
      properties:
        amount:
          type: number
          description: Amount of principal to borrow in lamports.
        assetIndexGuidance:
          $ref: '#/components/schemas/AssetIndexGuidance'
        duration:
          type: integer
          description: Duration preset to borrow into.
        expectedLoanValues:
          $ref: '#/components/schemas/ExpectedLoanValues'
        skipSolUnwrap:
          type: boolean
          description: If true, keep wrapped SOL output instead of unwrapping.
    VersionedTransactionSignature:
      type: object
      required:
        - publicKey
        - signature
      properties:
        publicKey:
          type: string
        signature:
          type: string
    AssetIndexGuidance:
      type: array
      items:
        type: integer
      description: >-
        Optional oracle asset ordering hints used by Loopscale when validating a
        transaction.
    ExpectedLoanValues:
      type: object
      required:
        - expectedApy
        - expectedLqt
      properties:
        expectedApy:
          type: number
          description: Expected APY in cBPS
        expectedLqt:
          type: array
          items:
            type: number
          description: Expected liquidation thresholds per ledger (cBPS)
  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.

````