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

# Get Price Quote

> Request a quote for swapping between two assets

## Usage

Provide either `from_amount` or `to_amount`, but not both. The API will calculate the other side based on current market rates.

<Note>Quotes are valid for a limited time. Check the `expires_at` field.</Note>


## OpenAPI

````yaml /openapi.json post /api/v1/market/quote
openapi: 3.1.0
info:
  title: Kaleidoswap RGB-LSP API
  description: API for managing swaps and channels
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/market/quote:
    post:
      tags:
        - market
      summary: Get Quote
      operationId: get_quote_api_v1_market_quote_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PairQuoteRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PairQuoteResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: javascript
          label: TypeScript SDK - BTC to USDT
          source: |-
            import { KaleidoClient } from 'kaleido-sdk';

            const client = new KaleidoClient({
              baseUrl: 'https://api.staging.kaleidoswap.com/api/v1'
            });

            const quote = await client.quoteRequest(
              'BTC',
              'rgb:im7mWgoS-4QX_1b1-DT23iPq-niObDFM-qGN7R2x-lFLJYak',
              1000000 // 0.01 BTC minimum
            );
            console.log(`Exchange rate: ${quote.price}`);
        - lang: python
          label: Python SDK
          source: |-
            import asyncio
            from kaleido_sdk import KaleidoClient

            async def main():
                async with KaleidoClient(
                    api_url="https://api.staging.kaleidoswap.com/api/v1"
                ) as client:
                    quote = await client.get_quote(
                        from_asset="BTC",
                        to_asset="rgb:im7mWgoS-4QX_1b1-DT23iPq-niObDFM-qGN7R2x-lFLJYak",
                        amount=1000000  # 0.01 BTC minimum
                    )
                    print(f"Exchange rate: {quote.price}")

            asyncio.run(main())
components:
  schemas:
    PairQuoteRequest:
      properties:
        from_asset:
          type: string
          title: From Asset
          example: BTC
        from_amount:
          anyOf:
            - type: integer
            - type: 'null'
          title: From Amount
          description: >-
            Amount of from_asset to convert. Either from_amount or to_amount
            must be provided, but not both.
          example: 1000000
        to_asset:
          type: string
          title: To Asset
          example: rgb:2dkSTbr-jFhznbPmo-TQafzswCN-av4gTsJjX-ttx6CNou5-M98k8Zd
        to_amount:
          anyOf:
            - type: integer
            - type: 'null'
          title: To Amount
          description: >-
            Desired amount of to_asset to receive. Either from_amount or
            to_amount must be provided, but not both.
          example: 1000000
      type: object
      required:
        - from_asset
        - to_asset
      title: PairQuoteRequest
    PairQuoteResponse:
      properties:
        rfq_id:
          type: string
          title: Rfq Id
          example: '1234567890'
        from_asset:
          type: string
          title: From Asset
          example: BTC
        from_amount:
          type: integer
          title: From Amount
          description: >-
            Amount of from_asset in its smallest unit (e.g., millisatoshis for
            BTC if precision is 11)
          example: 100000000000
        to_asset:
          type: string
          title: To Asset
          example: rgb:2dkSTbr-jFhznbPmo-TQafzswCN-av4gTsJjX-ttx6CNou5-M98k8Zd
        to_amount:
          type: integer
          title: To Amount
          description: >-
            Amount of to_asset in its smallest unit, after applying price and
            fees.
          example: 49900123
        price:
          type: integer
          title: Price
          description: >-
            Price of 1 whole unit of from_asset (e.g., 1 BTC) in terms of the
            smallest unit of to_asset (e.g., USDT with precision 6). Matches
            PriceData.price for the given rfq_id.
          example: 50000123456
        fee:
          $ref: '#/components/schemas/Fee'
        timestamp:
          type: integer
          title: Timestamp
        expires_at:
          type: integer
          title: Expires At
      type: object
      required:
        - rfq_id
        - from_asset
        - from_amount
        - to_asset
        - to_amount
        - price
        - fee
        - timestamp
        - expires_at
      title: PairQuoteResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Fee:
      properties:
        base_fee:
          type: integer
          title: Base Fee
          example: 1000000
        variable_fee:
          type: integer
          title: Variable Fee
          example: 1000000
        fee_rate:
          type: number
          title: Fee Rate
          example: 0.0001
        final_fee:
          type: integer
          title: Final Fee
          example: 2000000
        fee_asset:
          type: string
          title: Fee Asset
          example: rgb:2dkSTbr-jFhznbPmo-TQafzswCN-av4gTsJjX-ttx6CNou5-M98k8Zd
        fee_asset_precision:
          type: integer
          title: Fee Asset Precision
          example: 6
      type: object
      required:
        - base_fee
        - variable_fee
        - fee_rate
        - final_fee
        - fee_asset
        - fee_asset_precision
      title: Fee
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````