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

# Create Channel Order

> Create a new Lightning channel with optional RGB asset allocation

## Prerequisites

* Valid client public key
* Sufficient balance for channel fees
* Optional: RFQ ID if purchasing assets

<Warning>Ensure you have a refund address if paying onchain to avoid lost funds in case of errors.</Warning>


## OpenAPI

````yaml /openapi.json post /api/v1/lsps1/create_order
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/lsps1/create_order:
    post:
      tags:
        - lsps1
      summary: Create Order
      operationId: create_order_api_v1_lsps1_create_order_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOrderRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateOrderRequest:
      properties:
        client_pubkey:
          type: string
          title: Client Pubkey
        lsp_balance_sat:
          type: integer
          minimum: 0
          title: Lsp Balance Sat
        client_balance_sat:
          type: integer
          minimum: 0
          title: Client Balance Sat
        required_channel_confirmations:
          type: integer
          minimum: 0
          title: Required Channel Confirmations
        funding_confirms_within_blocks:
          type: integer
          minimum: 1
          title: Funding Confirms Within Blocks
        channel_expiry_blocks:
          type: integer
          minimum: 1
          title: Channel Expiry Blocks
        token:
          anyOf:
            - type: string
            - type: 'null'
          title: Token
        refund_onchain_address:
          anyOf:
            - type: string
            - type: 'null'
          title: Refund Onchain Address
        announce_channel:
          type: boolean
          title: Announce Channel
          default: true
        asset_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Asset Id
        lsp_asset_amount:
          anyOf:
            - type: integer
            - type: 'null'
          title: Lsp Asset Amount
        client_asset_amount:
          anyOf:
            - type: integer
            - type: 'null'
          title: Client Asset Amount
        rfq_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Rfq Id
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
          description: Optional email for notifications
      type: object
      required:
        - client_pubkey
        - lsp_balance_sat
        - client_balance_sat
        - required_channel_confirmations
        - funding_confirms_within_blocks
        - channel_expiry_blocks
      title: CreateOrderRequest
    OrderResponse:
      properties:
        order_id:
          type: string
          title: Order Id
        client_pubkey:
          type: string
          title: Client Pubkey
        lsp_balance_sat:
          type: integer
          title: Lsp Balance Sat
        client_balance_sat:
          type: integer
          title: Client Balance Sat
        required_channel_confirmations:
          type: integer
          title: Required Channel Confirmations
        funding_confirms_within_blocks:
          type: integer
          title: Funding Confirms Within Blocks
        channel_expiry_blocks:
          type: integer
          title: Channel Expiry Blocks
        token:
          anyOf:
            - type: string
            - type: 'null'
          title: Token
          default: ''
        created_at:
          type: string
          format: date-time
          title: Created At
        announce_channel:
          type: boolean
          title: Announce Channel
        order_state:
          $ref: '#/components/schemas/OrderState'
        payment:
          $ref: '#/components/schemas/PaymentDetails'
        channel:
          anyOf:
            - $ref: '#/components/schemas/ChannelDetails'
            - type: 'null'
        asset_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Asset Id
        lsp_asset_amount:
          anyOf:
            - type: integer
            - type: 'null'
          title: Lsp Asset Amount
        client_asset_amount:
          anyOf:
            - type: integer
            - type: 'null'
          title: Client Asset Amount
        rfq_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Rfq Id
        asset_price_sat:
          anyOf:
            - type: integer
            - type: 'null'
          title: Asset Price Sat
        asset_delivery_status:
          anyOf:
            - $ref: '#/components/schemas/AssetDeliveryStatus'
            - type: 'null'
        asset_delivery_payment_hash:
          anyOf:
            - type: string
            - type: 'null'
          title: Asset Delivery Payment Hash
        asset_delivery_completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Asset Delivery Completed At
        asset_delivery_error:
          anyOf:
            - type: string
            - type: 'null'
          title: Asset Delivery Error
      type: object
      required:
        - order_id
        - client_pubkey
        - lsp_balance_sat
        - client_balance_sat
        - required_channel_confirmations
        - funding_confirms_within_blocks
        - channel_expiry_blocks
        - announce_channel
        - order_state
        - payment
      title: OrderResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    OrderState:
      type: string
      enum:
        - CREATED
        - CHANNEL_OPENING
        - COMPLETED
        - FAILED
        - PENDING_RATE_DECISION
      title: OrderState
    PaymentDetails:
      properties:
        bolt11:
          $ref: '#/components/schemas/PaymentBolt11'
        onchain:
          $ref: '#/components/schemas/PaymentOnchain'
      type: object
      required:
        - bolt11
        - onchain
      title: PaymentDetails
    ChannelDetails:
      properties:
        channel_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Channel Id
        temporary_channel_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Temporary Channel Id
        funded_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Funded At
        funding_outpoint:
          anyOf:
            - type: string
            - type: 'null'
          title: Funding Outpoint
        expires_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Expires At
      type: object
      title: ChannelDetails
    AssetDeliveryStatus:
      type: string
      enum:
        - NOT_REQUIRED
        - PENDING
        - IN_PROGRESS
        - COMPLETED
        - FAILED
        - RATE_CHANGED
      title: AssetDeliveryStatus
      description: Status of asset delivery via keysend after channel opening
    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
    PaymentBolt11:
      properties:
        state:
          $ref: '#/components/schemas/PaymentState'
        expires_at:
          type: string
          format: date-time
          title: Expires At
        fee_total_sat:
          type: integer
          title: Fee Total Sat
        order_total_sat:
          type: integer
          title: Order Total Sat
        invoice:
          type: string
          title: Invoice
      type: object
      required:
        - state
        - expires_at
        - fee_total_sat
        - order_total_sat
        - invoice
      title: PaymentBolt11
    PaymentOnchain:
      properties:
        state:
          $ref: '#/components/schemas/PaymentState'
        expires_at:
          type: string
          format: date-time
          title: Expires At
        fee_total_sat:
          type: integer
          title: Fee Total Sat
        order_total_sat:
          type: integer
          title: Order Total Sat
        address:
          type: string
          title: Address
        min_fee_for_0conf:
          type: integer
          title: Min Fee For 0Conf
        min_onchain_payment_confirmations:
          type: integer
          title: Min Onchain Payment Confirmations
        refund_onchain_address:
          anyOf:
            - type: string
            - type: 'null'
          title: Refund Onchain Address
        payment_status:
          anyOf:
            - type: string
            - type: 'null'
          title: Payment Status
        payment_difference:
          anyOf:
            - type: integer
            - type: 'null'
          title: Payment Difference
          description: >-
            Payment difference in satoshis. Positive for overpayment, negative
            for underpayment, zero for exact payment
        last_payment_check:
          anyOf:
            - type: integer
            - type: 'null'
          title: Last Payment Check
      type: object
      required:
        - state
        - expires_at
        - fee_total_sat
        - order_total_sat
        - address
        - min_fee_for_0conf
        - min_onchain_payment_confirmations
        - refund_onchain_address
      title: PaymentOnchain
    PaymentState:
      type: string
      enum:
        - EXPECT_PAYMENT
        - HOLD
        - PAID
        - REFUNDED
        - TO_REFUND
      title: PaymentState

````