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

# Create quote

> Create a short-lived exact-input quote with selected assets, amount, destination network, and optional external tracking fields.



## OpenAPI

````yaml api-reference/openapi.json POST /quote
openapi: 3.1.0
info:
  title: LightSwap API
  description: >-
    Backend REST API for approved LightSwap integrations to quote, create, and
    track swaps.
  version: 1.0.0
servers:
  - url: https://lightswap.me/api/partner/v1
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Assets
    description: Supported asset discovery.
  - name: Address
    description: Destination address validation.
  - name: Quotes
    description: Short-lived quotes.
  - name: Swaps
    description: Swap creation and status tracking.
paths:
  /quote:
    post:
      tags:
        - Quotes
      summary: Create quote
      description: >-
        Creates a short-lived floating quote. The MVP supports exact-input
        quotes only: provide `from.amount` and omit `to.amount`.
      operationId: createQuote
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateQuoteRequest'
            examples:
              btcToUsdt:
                summary: Quote BTC to USDT
                value:
                  from:
                    network: bitcoin
                    token: BTC
                    amount: '0.01'
                  to:
                    network: tron
                    token: USDT
                  customerId: u_123
                  externalId: order-123
      responses:
        '200':
          description: Short-lived quote.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuoteResponse'
              examples:
                btcToUsdt:
                  summary: Quote response
                  value:
                    id: pq_aaaaaaaaaaaaaaaaaaaaaaaa
                    expiresAt: '2026-04-19T10:03:00.000Z'
                    from:
                      decimals: 8
                      network: bitcoin
                      token: BTC
                      amount: '0.01'
                    to:
                      decimals: 6
                      network: tron
                      token: USDT
                      estimatedAmount: '100'
                    rate: '10000'
                    minAmountIn: '0.001'
                    maxAmountIn: '1'
                    estimatedTimeSeconds: 900
        '400':
          $ref: '#/components/responses/BadRequest'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    CreateQuoteRequest:
      type: object
      required:
        - from
        - to
      properties:
        from:
          $ref: '#/components/schemas/QuoteFromRequest'
        to:
          $ref: '#/components/schemas/QuoteToRequest'
        externalId:
          type:
            - string
            - 'null'
          maxLength: 128
          description: Your order or correlation ID.
          example: order-123
        customerId:
          type:
            - string
            - 'null'
          maxLength: 128
          description: Your internal user or customer reference.
          example: u_123
      additionalProperties: false
    QuoteResponse:
      type: object
      required:
        - id
        - expiresAt
        - from
        - to
        - rate
        - minAmountIn
        - maxAmountIn
        - estimatedTimeSeconds
      properties:
        id:
          type: string
          pattern: ^pq_[a-f0-9]{24}$
          example: pq_aaaaaaaaaaaaaaaaaaaaaaaa
        expiresAt:
          type: string
          format: date-time
        from:
          $ref: '#/components/schemas/QuoteFromResponse'
        to:
          $ref: '#/components/schemas/QuoteToResponse'
        rate:
          type:
            - string
            - 'null'
          description: Estimated output per one input unit.
          example: '10000'
        minAmountIn:
          type:
            - string
            - 'null'
          example: '0.001'
        maxAmountIn:
          type:
            - string
            - 'null'
          example: '1'
        estimatedTimeSeconds:
          type: integer
          minimum: 0
          example: 900
    QuoteFromRequest:
      type: object
      required:
        - network
        - token
        - amount
      properties:
        network:
          type: string
          example: bitcoin
        token:
          type: string
          example: BTC
        amount:
          type: string
          description: Exact send amount as a decimal string.
          example: '0.01'
      additionalProperties: false
    QuoteToRequest:
      type: object
      required:
        - network
        - token
      properties:
        network:
          type: string
          example: tron
        token:
          type: string
          example: USDT
      additionalProperties: false
    QuoteFromResponse:
      type: object
      required:
        - decimals
        - network
        - token
        - amount
      properties:
        decimals:
          type: integer
        network:
          type: string
        token:
          type: string
        amount:
          type: string
    QuoteToResponse:
      type: object
      required:
        - decimals
        - network
        - token
        - estimatedAmount
      properties:
        decimals:
          type: integer
        network:
          type: string
        token:
          type: string
        estimatedAmount:
          type: string
    ErrorResponse:
      type: object
      required:
        - error
        - requestId
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
        requestId:
          type: string
          example: req_123
    ErrorBody:
      type: object
      required:
        - code
        - message
        - details
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          example: Quote has expired.
        details:
          type: object
          additionalProperties: true
          example: {}
    ErrorCode:
      type: string
      enum:
        - inactive_partner
        - internal_error
        - invalid_api_key
        - provider_unavailable
        - quote_already_used
        - quote_expired
        - quote_not_found
        - rate_limited
        - swap_not_found
        - unsupported_asset
        - unsupported_pair
        - validation_error
  headers:
    RequestId:
      description: >-
        Request ID generated by LightSwap or echoed from the `x-request-id`
        request header.
      schema:
        type: string
        example: req_123
    RetryAfter:
      description: Seconds to wait before retrying a rate-limited request.
      schema:
        type: integer
        example: 30
  responses:
    BadRequest:
      description: The request is invalid.
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            validationError:
              value:
                error:
                  code: validation_error
                  message: quoteId is invalid.
                  details: {}
                requestId: req_123
    RateLimited:
      description: The request exceeded the configured API rate limit.
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            rateLimited:
              value:
                error:
                  code: rate_limited
                  message: Too many API requests. Please wait a moment and try again.
                  details: {}
                requestId: req_123
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key. Keep this key on your backend.

````