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

# Get apiv1borrow lendpreview



## OpenAPI

````yaml /api-reference/openapi.json get /api/v1/borrow_lend/preview
openapi: 3.1.0
info:
  title: Decibel Trading API
  description: >-
    RESTful API for Decibel. Provides read-only endpoints for market data,
    trading operations, positions, and analytics.
  contact:
    name: Decibel Team
    url: https://decibel.trade/
  license:
    name: ''
  version: 1.0.0
servers:
  - url: https://api.mainnet.aptoslabs.com/decibel
    description: Mainnet
  - url: https://api.testnet.aptoslabs.com/decibel
    description: Testnet
security:
  - bearerAuth: []
tags:
  - name: Market Data
    description: Market information and real-time data endpoints
  - name: User
    description: User information and account management
  - name: Account
    description: Account-specific endpoints and data
  - name: Trades
    description: Trading operations and history
  - name: Positions
    description: User position management
  - name: Orders
    description: Order management and history
  - name: TWAP
    description: Time-weighted average price orders
  - name: Bulk Orders
    description: Bulk order management
  - name: Vaults
    description: Vault operations and management
  - name: Analytics
    description: Analytics and performance metrics
  - name: Points
    description: Points-related account metrics
  - name: Trading Points
    description: Trading points endpoints
  - name: Trading Hz
    description: Trading Hz endpoints
  - name: Tier
    description: Tier information endpoints
  - name: Streaks
    description: User streak tracking endpoints
  - name: Predeposit Rewards
    description: Season 0 predeposit USDC rewards
  - name: Referrals
    description: Referral code management and tracking
  - name: Affiliates
    description: Affiliate code and earnings endpoints
  - name: Campaigns
    description: On-chain reward campaign endpoints
paths:
  /api/v1/borrow_lend/preview:
    get:
      tags:
        - Borrow/Lend
      operationId: handle_preview
      parameters:
        - name: account
          in: query
          required: true
          schema:
            type: string
        - name: repay_usdc
          in: query
          description: Raw USDC units; clamped to the debt.
          required: false
          schema:
            type: string
        - name: unpledge_asset
          in: query
          description: Requires `unpledge_units`.
          required: false
          schema:
            type: string
        - name: unpledge_units
          in: query
          required: false
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BorrowLendPreviewDto'
        '400':
          description: Invalid account, amount or asset
        '503':
          description: State unavailable
components:
  schemas:
    BorrowLendPreviewDto:
      type: object
      description: |-
        The account before and after an unpledge, then a repay. The perp
        free-margin check on a repay is not modeled.
      required:
        - account
        - indices_as_of_secs
        - repay_applied_usdc
        - allowed
        - current
      properties:
        account:
          type: string
        after:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/BorrowLendPreviewStateDto'
              description: Null only when the unpledge exceeds the pledge.
        allowed:
          type: boolean
        current:
          $ref: '#/components/schemas/BorrowLendPreviewStateDto'
        indices_as_of_secs:
          type: string
        reason:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/BorrowLendPreviewRejection'
        repay_applied_usdc:
          type: string
          description: The requested repay clamped to the debt.
    BorrowLendPreviewStateDto:
      type: object
      required:
        - debt_usdc
        - collateral_value_usdc
        - max_weighted_collateral_usdc
        - target_weighted_collateral_usdc
        - liquidatable
        - borrow_capacity_usdc
        - pledges
      properties:
        borrow_capacity_usdc:
          type: string
        collateral_value_usdc:
          type: string
        debt_usdc:
          type: string
        liquidatable:
          type: boolean
        ltv_bps:
          type:
            - string
            - 'null'
          description: Null when there is debt but no collateral value.
        max_weighted_collateral_usdc:
          type: string
        pledges:
          type: array
          items:
            $ref: '#/components/schemas/BorrowLendPreviewPledgeDto'
        target_weighted_collateral_usdc:
          type: string
    BorrowLendPreviewRejection:
      type: string
      enum:
        - unpledge_exceeds_pledge
        - unpledge_exceeds_withdrawable
        - pending_orders
    BorrowLendPreviewPledgeDto:
      type: object
      required:
        - asset
        - decimals
        - amount
        - value_usdc
        - price_usdc_per_unit
      properties:
        amount:
          type: string
        asset:
          type: string
        decimals:
          type: integer
          format: int32
          minimum: 0
        liquidation_price_usdc_per_unit:
          type:
            - string
            - 'null'
          description: |-
            Highest price, other pledges fixed, at which the account is
            liquidatable. Null when this asset's price cannot decide it.
        price_usdc_per_unit:
          type: string
        value_usdc:
          type: string
        withdrawable_units:
          type:
            - string
            - 'null'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer token from Geomi. See
        [Authentication](/api-reference/rest/authentication) for setup
        instructions.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.