> ## Documentation Index
> Fetch the complete documentation index at: https://layerswaplabsv0-main-depositactionsguide.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Swap

> Creates a new swap based on the provided request. Token parameters accept either asset names (e.g. USDC, ETH) or token contract addresses (e.g. 0xa0b8...). For native tokens via contract address, use the network's zero address (e.g. 0x0000000000000000000000000000000000000000 for EVM, 11111111111111111111111111111111 for Solana).



## OpenAPI

````yaml https://api.layerswap.io/swagger/v2/swagger.json post /api/v2/swaps
openapi: 3.0.1
info:
  title: Layerswap API V2
  version: v2
servers:
  - url: https://api.layerswap.io
    description: Mainnet
security:
  - X-LS-APIKEY: []
paths:
  /api/v2/swaps:
    post:
      tags:
        - Swaps
      summary: Create Swap
      description: >-
        Creates a new swap based on the provided request. Token parameters
        accept either asset names (e.g. USDC, ETH) or token contract addresses
        (e.g. 0xa0b8...). For native tokens via contract address, use the
        network's zero address (e.g. 0x0000000000000000000000000000000000000000
        for EVM, 11111111111111111111111111111111 for Solana).
      parameters:
        - name: X-LS-APIKEY
          in: header
          schema:
            type: string
            default: >-
              NDBxG+aon6WlbgIA2LfwmcbLU52qUL9qTnztTuTRPNSohf/VnxXpRaJlA5uLSQVqP8YGIiy/0mz+mMeZhLY4/Q
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSwapRequest'
            examples:
              Example 1:
                value:
                  destination_address: 0x
                  reference_id: null
                  source_network: ETHEREUM_MAINNET
                  source_token: ETH
                  destination_network: ARBITRUM_MAINNET
                  destination_token: ETH
                  refuel: false
                  use_deposit_address: false
                  use_depository: false
                  use_new_deposit_address: null
                  amount: 0.0042
                  source_address: null
                  slippage: null
                  refund_address: null
              Example 2:
                value:
                  destination_address: 0x
                  reference_id: null
                  source_network: ETHEREUM_MAINNET
                  source_token: ETH
                  destination_network: ARBITRUM_MAINNET
                  destination_token: ETH
                  refuel: false
                  use_deposit_address: true
                  use_depository: false
                  use_new_deposit_address: null
                  amount: 0.0069
                  source_address: null
                  slippage: null
                  refund_address: null
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponsePreparedSwapResponse'
components:
  schemas:
    CreateSwapRequest:
      type: object
      properties:
        destination_address:
          type: string
        reference_id:
          type: string
          nullable: true
        source_exchange:
          type: string
          nullable: true
        destination_exchange:
          type: string
          nullable: true
        source_network:
          type: string
        source_token:
          type: string
        destination_network:
          type: string
        destination_token:
          type: string
        refuel:
          type: boolean
        use_deposit_address:
          type: boolean
        use_depository:
          type: boolean
        use_new_deposit_address:
          type: boolean
          nullable: true
        amount:
          type: number
          format: double
          nullable: true
        source_address:
          type: string
          nullable: true
        slippage:
          type: string
          nullable: true
        refund_address:
          type: string
          nullable: true
      additionalProperties: false
    ApiResponsePreparedSwapResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ApiError'
        data:
          $ref: '#/components/schemas/PreparedSwapResponse'
      additionalProperties: false
    ApiError:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        metadata:
          type: object
          additionalProperties: {}
      additionalProperties: false
    PreparedSwapResponse:
      type: object
      properties:
        quote:
          $ref: '#/components/schemas/SwapQuoteModel'
        refuel:
          $ref: '#/components/schemas/TokenWithAmountModel'
        reward:
          $ref: '#/components/schemas/RewardModel'
        swap:
          $ref: '#/components/schemas/SwapModel'
        deposit_actions:
          type: array
          items:
            $ref: '#/components/schemas/TransferDepositActionModel'
      additionalProperties: false
    SwapQuoteModel:
      type: object
      properties:
        total_fee:
          type: number
          format: double
        total_fee_in_usd:
          type: number
          format: double
        source_network:
          $ref: '#/components/schemas/NetworkModel'
        source_token:
          $ref: '#/components/schemas/TokenModel'
        destination_network:
          $ref: '#/components/schemas/NetworkModel'
        destination_token:
          $ref: '#/components/schemas/TokenModel'
        requested_amount:
          type: number
          format: double
        receive_amount:
          type: number
          format: double
        fee_discount:
          type: number
          format: double
        min_receive_amount:
          type: number
          format: double
        blockchain_fee:
          type: number
          format: double
        service_fee:
          type: number
          format: double
        avg_completion_time:
          type: string
        refuel_in_source:
          type: number
          format: double
          nullable: true
        slippage:
          type: number
          format: double
        rate:
          type: number
          format: double
        path:
          type: array
          items:
            $ref: '#/components/schemas/QuotePathModel'
      additionalProperties: false
    TokenWithAmountModel:
      type: object
      properties:
        token:
          $ref: '#/components/schemas/TokenModel'
        network:
          $ref: '#/components/schemas/NetworkModel'
        amount:
          type: number
          format: double
        amount_in_usd:
          type: number
          format: double
      additionalProperties: false
    RewardModel:
      type: object
      properties:
        token:
          $ref: '#/components/schemas/TokenModel'
        network:
          $ref: '#/components/schemas/NetworkModel'
        amount:
          type: number
          format: double
        amount_in_usd:
          type: number
          format: double
        campaign_type:
          type: string
        nft_contract_address:
          type: string
          nullable: true
      additionalProperties: false
    SwapModel:
      type: object
      properties:
        id:
          type: string
        created_date:
          type: string
          format: date-time
        source_network:
          $ref: '#/components/schemas/NetworkModel'
        source_token:
          $ref: '#/components/schemas/TokenModel'
        source_exchange:
          $ref: '#/components/schemas/ExchangeModel'
        destination_network:
          $ref: '#/components/schemas/NetworkModel'
        destination_token:
          $ref: '#/components/schemas/TokenModel'
        destination_exchange:
          $ref: '#/components/schemas/ExchangeModel'
        requested_amount:
          type: number
          format: double
        destination_address:
          type: string
        status:
          type: string
        fail_reason:
          type: string
          nullable: true
        use_deposit_address:
          type: boolean
        metadata:
          $ref: '#/components/schemas/SwapMetadataModel'
        transactions:
          type: array
          items:
            $ref: '#/components/schemas/TransactionModel'
      additionalProperties: false
    TransferDepositActionModel:
      type: object
      properties:
        type:
          type: string
        to_address:
          type: string
        amount:
          type: number
          format: double
        order:
          type: integer
          format: int32
        amount_in_base_units:
          type: string
        network:
          $ref: '#/components/schemas/NetworkModel'
        token:
          $ref: '#/components/schemas/TokenModel'
        fee_token:
          $ref: '#/components/schemas/TokenModel'
        call_data:
          type: string
          nullable: true
        gas_limit:
          type: string
          nullable: true
        encoded_args:
          type: array
          items:
            type: string
          nullable: true
      additionalProperties: false
    NetworkModel:
      type: object
      properties:
        name:
          type: string
        display_name:
          type: string
        logo:
          type: string
        chain_id:
          type: string
          nullable: true
        node_url:
          type: string
          nullable: true
        nodes:
          type: array
          items:
            type: string
          nullable: true
        type:
          $ref: '#/components/schemas/NetworkType'
        transaction_explorer_template:
          type: string
        account_explorer_template:
          type: string
        source_rank:
          type: integer
          format: int32
        destination_rank:
          type: integer
          format: int32
        token:
          $ref: '#/components/schemas/TokenModel'
        metadata:
          $ref: '#/components/schemas/NetworkMetadata'
        deposit_methods:
          type: array
          items:
            type: string
          nullable: true
      additionalProperties: false
    TokenModel:
      type: object
      properties:
        symbol:
          type: string
        display_asset:
          type: string
        logo:
          type: string
        contract:
          type: string
          nullable: true
        decimals:
          type: integer
          format: int32
        price_in_usd:
          type: number
          format: double
        precision:
          type: number
          format: double
        listing_date:
          type: string
          format: date-time
        source_rank:
          type: integer
          format: int32
        destination_rank:
          type: integer
          format: int32
        group:
          type: string
          nullable: true
      additionalProperties: false
    QuotePathModel:
      type: object
      properties:
        provider:
          type: string
        order:
          type: integer
          format: int32
      additionalProperties: false
    ExchangeModel:
      type: object
      properties:
        name:
          type: string
        display_name:
          type: string
        logo:
          type: string
        metadata:
          $ref: '#/components/schemas/ExchangeMetadata'
      additionalProperties: false
    SwapMetadataModel:
      type: object
      properties:
        sequence_number:
          type: integer
          format: int64
        reference_id:
          type: string
          nullable: true
        exchange_account:
          type: string
          nullable: true
      additionalProperties: false
    TransactionModel:
      type: object
      properties:
        from:
          type: string
          nullable: true
        to:
          type: string
          nullable: true
        timestamp:
          type: string
          format: date-time
        transaction_hash:
          type: string
          nullable: true
        confirmations:
          type: integer
          format: int32
        max_confirmations:
          type: integer
          format: int32
        amount:
          type: number
          format: double
        type:
          type: string
        status:
          type: string
        token:
          $ref: '#/components/schemas/TokenModel'
        network:
          $ref: '#/components/schemas/NetworkModel'
        fee_amount:
          type: number
          format: double
          nullable: true
        fee_token:
          $ref: '#/components/schemas/TokenModel'
      additionalProperties: false
    NetworkType:
      enum:
        - evm
        - starknet
        - solana
        - cosmos
        - starkex
        - zksynclite
        - ton
        - paradex
        - tron
        - fuel
        - bitcoin
        - hyperliquid
      type: string
    NetworkMetadata:
      type: object
      properties:
        listing_date:
          type: string
          format: date-time
        evm_oracle_contract:
          type: string
          nullable: true
        evm_multicall_contract:
          type: string
          nullable: true
        zks_paymaster_contract:
          type: string
          nullable: true
        watchdog_contract:
          type: string
          nullable: true
      additionalProperties: false
    ExchangeMetadata:
      type: object
      properties:
        oauth:
          $ref: '#/components/schemas/ExchangeOAuthModel'
        listing_date:
          type: string
          format: date-time
      additionalProperties: false
    ExchangeOAuthModel:
      type: object
      properties:
        authorize_url:
          type: string
        connect_url:
          type: string
      additionalProperties: false
  securitySchemes:
    X-LS-APIKEY:
      type: apiKey
      name: X-LS-APIKEY
      in: header

````