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

# Get Order Calldata

> Generate batched calldata for executing an order directly on-chain. This endpoint is designed for applications that need to submit transactions directly from the client side, rather than having the backend execute the order. The returned calldata can be used to submit a transaction from the user's smart wallet.



## OpenAPI

````yaml openapi.json post /v1/order/calldata
openapi: 3.0.0
info:
  title: Swaps API
  description: The Swaps API documentation
  version: '1.0'
  contact: {}
servers:
  - url: https://swap-api.flux.fun
    description: Production
  - url: http://localhost:3000
    description: Development
security: []
tags: []
paths:
  /v1/order/calldata:
    post:
      tags:
        - Orders
      summary: Get Order Calldata
      description: >-
        Generate batched calldata for executing an order directly on-chain. This
        endpoint is designed for applications that need to submit transactions
        directly from the client side, rather than having the backend execute
        the order. The returned calldata can be used to submit a transaction
        from the user's smart wallet.
      operationId: OrdersController_getOrderCalldata
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOrderDto'
      responses:
        '200':
          description: Calldata generated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetOrderCalldataResponseDto'
        '400':
          description: Invalid order data or missing required fields
      security:
        - api-key: []
components:
  schemas:
    CreateOrderDto:
      type: object
      properties:
        orderType:
          type: string
          description: Order type
          enum:
            - MarketOrder
          example: MarketOrder
        order:
          description: Market order details
          allOf:
            - $ref: '#/components/schemas/MarketOrderDataDto'
        chainId:
          type: number
          example: 8453
          description: Chain ID
        includeTokenTransfer:
          type: boolean
          description: Include token transfer in the order
          example: false
        clientId:
          type: string
          description: Client-side order ID
          example: order-123
        userAddress:
          type: string
          description: User wallet address
          example: 0x...
        receiverAddress:
          type: string
          description: Receiver address for tokens
          example: 0x...
      required:
        - orderType
        - order
        - chainId
        - clientId
    GetOrderCalldataResponseDto:
      type: object
      properties:
        success:
          type: boolean
          example: true
        transactions:
          description: Array of transactions to execute in batch
          type: array
          items:
            $ref: '#/components/schemas/BatchedTransactionDto'
        description:
          type: string
          example: Submit order for BTC-100K market
          description: Human-readable description of the batched transactions
      required:
        - success
        - transactions
        - description
    MarketOrderDataDto:
      type: object
      properties:
        quoteToken:
          type: object
          properties:
            type:
              type: string
              enum:
                - kalshi
                - chain
              description: Token type
              example: kalshi
            data:
              description: Token data based on type
              oneOf:
                - $ref: '#/components/schemas/TokenKalshiDto'
                - $ref: '#/components/schemas/TokenChainDto'
          required:
            - type
            - data
        baseToken:
          type: object
          properties:
            type:
              type: string
              enum:
                - kalshi
                - chain
              description: Token type
              example: kalshi
            data:
              description: Token data based on type
              oneOf:
                - $ref: '#/components/schemas/TokenKalshiDto'
                - $ref: '#/components/schemas/TokenChainDto'
          required:
            - type
            - data
        orderType:
          type: string
          description: Order type
          enum:
            - BUY
            - SELL
          example: BUY
        baseQuantity:
          type: string
          description: Quantity of base token (as integer string)
          example: '100'
        minQuoteQuantityOut:
          type: string
          description: Minimum quote quantity out (for SELL orders)
          example: '95'
        maxQuoteQuantityIn:
          type: string
          description: Maximum quote quantity in (for BUY orders)
          example: '105'
      required:
        - quoteToken
        - baseToken
        - orderType
        - baseQuantity
    BatchedTransactionDto:
      type: object
      properties:
        to:
          type: string
          example: '0x1234567890abcdef1234567890abcdef12345678'
          description: Target contract address
        value:
          type: string
          example: '0'
          description: Transaction value in wei
        data:
          type: string
          example: 0x1234567890abcdef...
          description: Hex-encoded calldata
      required:
        - to
        - value
        - data
    TokenKalshiDto:
      type: object
      properties:
        marketId:
          type: string
          description: Kalshi market ID
          example: KXBTC-24NOV30-T65000
        side:
          type: string
          description: Market side
          enum:
            - 'yes'
            - 'no'
          example: 'yes'
      required:
        - marketId
        - side
    TokenChainDto:
      type: object
      properties:
        tokenId:
          type: string
          description: Token ID on chain. For ERC-20 tokens, the token ID must be 0
          example: '0'
        chainId:
          type: number
          example: 8453
          description: Chain ID
        contractAddress:
          type: string
          example: 0x...
          description: Token contract address
      required:
        - tokenId
        - chainId
        - contractAddress
  securitySchemes:
    api-key:
      type: apiKey
      in: header
      name: x-api-key

````