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

# Get best quote

> Returns the top quote for each specified collateral asset based on available liquidity. This endpoint is designed for minimizing rate slippage for a borrow with known inputs.



## OpenAPI

````yaml post /markets/quote/max
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/quote/max:
    post:
      tags:
        - Markets
      summary: Get max quote
      description: >-
        Returns the top quote for each specified collateral asset based on
        available liquidity. This endpoint is designed for minimizing rate
        slippage for a borrow with known inputs.
      operationId: GetMaxQuote
      parameters:
        - name: user-wallet
          in: header
          required: true
          schema:
            type: string
          description: Wallet address of the requesting user
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetMaxQuoteRequest'
      responses:
        '200':
          description: Best matching quote per collateral asset
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetMaxQuoteResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/GeneralError'
components:
  schemas:
    GetMaxQuoteRequest:
      type: object
      required:
        - durationType
        - duration
        - principalMint
        - collateralFilter
      properties:
        durationType:
          type: number
          description: >-
            Duration type enum (0 = days, 1 = weeks, 2 = months, 3 = minutes, 4
            = years)
        duration:
          type: number
          description: Number of units of the specified durationType
        principalMint:
          type: string
          description: Token mint address of the principal
        collateralFilter:
          type: array
          description: Mapping from collateral mint to detailed collateral metadata
          items:
            $ref: '#/components/schemas/CollateralFilter'
    GetMaxQuoteResponse:
      type: array
      description: Array of quotes with collateral and strategies
      items:
        $ref: '#/components/schemas/MaxQuote'
      example:
        - apy: 100000
          strategy: 9rQ8Q4tMUDhT
          collateralIdentifier: So11111111111111111111111111111111111111112
          ltv: 600000
          lqt: 800000
          amount: 12000000000
    CollateralFilter:
      type: object
      required:
        - amount
        - assetData
      properties:
        amount:
          type: number
          description: Collateral amount in lamports
        assetData:
          $ref: '#/components/schemas/AssetDataInfo'
    MaxQuote:
      type: object
      properties:
        apy:
          type: number
          description: Annualized interest rate in 1/100th of a basis point
        strategy:
          type: string
          description: Lender who is offering the quote
        collateralIdentifier:
          type: string
          description: Collateral mint pubkey
        ltv:
          type: number
          description: Maximum initial loan to value in 1/100th of a basis point
        lqt:
          type: number
          description: Liquidation loan to value in 1/100th of a basis point
        amount:
          type: number
          description: Maximum amount that can be borrowed, in lamports
    AssetDataInfo:
      type: object
      description: >-
        Tagged asset descriptor used for collateral filters. LP position
        variants can optionally specify `tokenProgram` to override the token
        program used when deriving token accounts.
      properties:
        Spl:
          $ref: '#/components/schemas/SplAssetData'
        StakedSol:
          $ref: '#/components/schemas/StakedSolAssetData'
        Orca:
          $ref: '#/components/schemas/OrcaPositionAssetData'
        Meteora:
          $ref: '#/components/schemas/MeteoraDlmmPositionAssetData'
        Raydium:
          $ref: '#/components/schemas/RaydiumPositionAssetData'
    SplAssetData:
      type: object
      required:
        - mint
      properties:
        mint:
          type: string
          description: Collateral mint pubkey
    StakedSolAssetData:
      type: object
      required:
        - stakeAccount
        - stakePool
      properties:
        stakeAccount:
          type: string
          description: Stake account pubkey
        stakePool:
          type: string
          description: Stake pool pubkey
    OrcaPositionAssetData:
      type: object
      required:
        - positionMint
        - whirlpool
      properties:
        positionMint:
          type: string
          description: Position mint pubkey
        whirlpool:
          type: string
          description: Whirlpool pubkey
        tokenProgram:
          type: string
          description: Optional token program override for the position mint.
    MeteoraDlmmPositionAssetData:
      type: object
      required:
        - positionAddress
        - lbPair
      properties:
        positionAddress:
          type: string
          description: DLMM position address
        lbPair:
          type: string
          description: Meteora DLMM pair pubkey
        tokenProgram:
          type: string
          description: Optional token program override for the position mint.
    RaydiumPositionAssetData:
      type: object
      required:
        - mint
        - pool
      properties:
        mint:
          type: string
          description: Raydium position mint pubkey
        pool:
          type: string
          description: Raydium pool pubkey
        tokenProgram:
          type: string
          description: Optional token program override for the position mint.
  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.

````