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

# Create Order

Create a new swap order to exchange assets across blockchain networks. This starts the atomic swap process and returns a pre-built transaction to initiate a swap on-chain.


## OpenAPI

````yaml POST /orders
openapi: 3.1.0
info:
  title: Garden API
  version: 2.0.0
  description: API specification for various endpoints.
servers:
  - url: https://{environment}.garden.finance/v2
    variables:
      environment:
        default: api
        enum:
          - api
          - testnet.api
security:
  - garden-app-id: []
paths:
  /orders:
    post:
      summary: Create order.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderRequest'
      responses:
        '200':
          description: Object with required information to initiate order on source chain.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateOrderResponse'
components:
  schemas:
    OrderRequest:
      type: object
      required:
        - source
        - destination
      properties:
        source:
          $ref: '#/components/schemas/SourceAccount'
        destination:
          $ref: '#/components/schemas/DestinationAccount'
        slippage:
          type: integer
          description: >-
            **(Optional)** In BIPS (base index points), 100 bips = 1%. When not
            specified, the slippage configured in app settings is used, or zero
            if no default is configured.
          example: 50
        nonce:
          type: string
          description: >-
            **(Optional)** Custom nonce for the order. If not provided, one will
            be generated.
          example: '1736152215456'
        solver_id:
          type: string
          description: '**(Optional)** Specific solver ID to use for this order.'
          example: '0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635'
        affiliate_fees:
          type: array
          description: >-
            **(Optional)** Add an [affiliate fee](/developers/affiliate-fees) to
            each swap, defined in bips (100 bips = 1%).
          items:
            $ref: '#/components/schemas/AffiliateFee'
    CreateOrderResponse:
      allOf:
        - $ref: '#/components/schemas/Response'
        - type: object
          properties:
            result:
              $ref: '#/components/schemas/InitiateRequest'
    SourceAccount:
      type: object
      required:
        - owner
        - amount
        - asset
      properties:
        asset:
          $ref: '#/components/schemas/Asset'
        owner:
          type: string
          description: Source address of the user.
        delegate:
          type: string
          nullable: true
          description: >-
            **(Optional)** Executes the swap on behalf of the user. Use this
            when calling Garden from your own smart contract; provide your
            contract’s address here.
        amount:
          type: string
    DestinationAccount:
      type: object
      required:
        - owner
        - amount
        - asset
      properties:
        asset:
          $ref: '#/components/schemas/Asset'
        owner:
          type: string
          description: Destination address of the user.
        amount:
          type: string
    AffiliateFee:
      type: object
      required: []
      properties:
        address:
          description: Address of the affiliate.
          type: string
        asset:
          $ref: '#/components/schemas/AffiliateFeeAsset'
        fee:
          type: integer
          description: In BIPS (base index points), 100 bips = 1%.
          example: 10
    Response:
      type: object
      properties:
        status:
          type: string
          enum:
            - Ok
            - Error
        error:
          type: string
          nullable: true
    InitiateRequest:
      anyOf:
        - $ref: '#/components/schemas/BitcoinInitiateRequest'
          title: bitcoin
        - $ref: '#/components/schemas/BitcoinInitiateRequest'
          title: litecoin
        - $ref: '#/components/schemas/EVMInitiateRequest'
          title: evm
        - $ref: '#/components/schemas/EVMInitiateRequest'
          title: tron
        - $ref: '#/components/schemas/StarknetInitiateRequest'
          title: starknet
        - $ref: '#/components/schemas/SolanaInitiateRequest'
          title: solana
        - $ref: '#/components/schemas/SuiInitiateRequest'
          title: sui
    Asset:
      oneOf:
        - type: string
          title: mainnet
          description: Mainnet
          enum:
            - arbitrum:wbtc
            - ethereum:wbtc
            - arbitrum:ibtc
            - base:cbbtc
            - bitcoin:btc
            - bnbchain:btcb
            - botanix:btc
            - citrea:cbtc
            - ethereum:cbbtc
            - ethereum:usdt
            - hyperevm:ubtc
            - litecoin:ltc
            - monad:mon
            - monad:usdc
            - solana:cbbtc
            - solana:sol
            - solana:usdc
            - starknet:wbtc
            - tron:usdt
        - type: string
          title: testnet
          description: Testnet
          enum:
            - arbitrum_sepolia:wbtc
            - ethereum_sepolia:wbtc
            - alpen_signet:btc
            - alpen_testnet:sbtc
            - alpen_testnet:usdc
            - arbitrum_sepolia:ibtc
            - arbitrum_sepolia:seed
            - arbitrum_sepolia:usdc
            - base_sepolia:cbltc
            - base_sepolia:cbxrp
            - base_sepolia:ibtc
            - base_sepolia:usdc
            - base_sepolia:usdt
            - base_sepolia:wbtc
            - bitcoin_testnet:btc
            - bnbchain_testnet:wbtc
            - citrea_testnet:cbbtc
            - citrea_testnet:cbtc
            - citrea_testnet:usdc
            - citrea_testnet:usdt
            - citrea_testnet:wbtc
            - citrea_testnet:wcbtc
            - ethereum_sepolia:usdc
            - litecoin_testnet:ltc
            - monad_testnet:cbbtc
            - monad_testnet:usdc
            - solana_testnet:cbbtc
            - solana_testnet:sol
            - solana_testnet:usdc
            - starknet_sepolia:wbtc
            - tron_shasta:usdt
            - tron_shasta:wbtc
            - xrpl_testnet:xrp
    AffiliateFeeAsset:
      oneOf:
        - type: string
          title: mainnet
          description: Mainnet
          enum:
            - arbitrum:usdc
            - arbitrum:cbbtc
            - base:usdc
            - base:cbbtc
            - ethereum:usdc
            - ethereum:cbbtc
        - type: string
          title: testnet
          description: Testnet
          enum:
            - arbitrum_sepolia:usdc
            - base_sepolia:usdc
            - citrea_testnet:usdc
            - citrea_testnet:cbbtc
            - ethereum_sepolia:usdc
            - monad_testnet:usdc
            - monad_testnet:cbbtc
    BitcoinInitiateRequest:
      type: object
      required:
        - order_id
        - to
        - amount
      properties:
        order_id:
          description: A unique identifier for the order.
          type: string
        to:
          type: string
          description: The address of the recipient.
        amount:
          type: integer
          description: The amount to be sent.
    EVMInitiateRequest:
      type: object
      required:
        - order_id
        - approval_transaction
        - initiate_transaction
        - typed_data
      properties:
        order_id:
          description: A unique identifier for the order.
          type: string
        approval_transaction:
          $ref: '#/components/schemas/EVMTransaction'
          nullable: true
          description: Can be `null`, if user has already given approval.
        initiate_transaction:
          $ref: '#/components/schemas/EVMTransaction'
        typed_data:
          $ref: '#/components/schemas/EVMTypedData'
    StarknetInitiateRequest:
      type: object
      required:
        - order_id
        - approval_transaction
        - initiate_transaction
        - typed_data
      properties:
        order_id:
          description: A unique identifier for the order.
          type: string
        approval_transaction:
          $ref: '#/components/schemas/StarknetTransaction'
          nullable: true
          description: Can be `null`, if user has already given approval.
        initiate_transaction:
          $ref: '#/components/schemas/StarknetTransaction'
          nullable: true
        typed_data:
          $ref: '#/components/schemas/StarknetTypedData'
    SolanaInitiateRequest:
      type: object
      required:
        - order_id
        - versioned_tx
      properties:
        order_id:
          description: A unique identifier for the order.
          type: string
        versioned_tx:
          type: string
        versioned_tx_gasless:
          type: string
    SuiInitiateRequest:
      type: object
      required:
        - order_id
        - ptb_bytes
      properties:
        order_id:
          description: A unique identifier for the order.
          type: string
        ptb_bytes:
          type: array
          items:
            type: integer
            format: int32
    EVMTransaction:
      type: object
      properties:
        to:
          type: string
        value:
          type: string
        chain_id:
          type: integer
        data:
          type: string
        gas_limit:
          type: integer
    EVMTypedData:
      type: object
      properties:
        types:
          properties:
            EIP712Domain:
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                  type:
                    type: string
        message:
          type: object
          properties:
            redeemer:
              type: string
            timelock:
              type: integer
            amount:
              type: integer
            secretHash:
              type: string
        domain:
          properties:
            name:
              type: string
            version:
              type: string
            chainId:
              type: string
            verifyingContract:
              type: string
    StarknetTransaction:
      type: object
      properties:
        calldata:
          type: array
          items:
            type: string
        selector:
          type: string
          example: '0x2aed25fcd0101fcece997d93f9d0643dfa3fbd4118cae16bf7d6cd533577c28'
        to:
          type: string
          example: '0x2448040b22b27f5a814756e67da005701e525658b162d4f0343d2e011bc6dad'
    StarknetTypedData:
      type: object
      properties:
        domain:
          type: object
          properties:
            chainId:
              type: string
              example: SN_SEPOLIA
            name:
              type: string
              example: HTLC
            revision:
              type: string
              example: '1'
            version:
              type: string
              example: '1'
        message:
          type: object
          properties:
            amount:
              type: object
              properties:
                high:
                  type: string
                  example: '0x0'
                low:
                  type: string
                  example: '0x2710'
            redeemer:
              type: string
              example: >-
                2359173398359146340421805800175969296622423265566697169584810299233559668096
            secretHash:
              type: array
              items:
                type: integer
              example:
                - 1208377717
                - 3328794282
                - 2017733490
                - 901540904
                - 1502396360
                - 718117041
                - 1704147999
                - 3475506811
            timelock:
              type: string
              example: '2880'
        primaryType:
          type: string
          example: Initiate
        types:
          type: object
          properties:
            Initiate:
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                  type:
                    type: string
            StarknetDomain:
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                  type:
                    type: string
  securitySchemes:
    garden-app-id:
      type: apiKey
      name: garden-app-id
      in: header
      description: >-
        If you do not yet have an app ID, please follow these
        [steps](/api-reference/setup).

````