Create Swap

In order to initiate the process of bridging assets across blockchains, CEXes, and fiat, a Swap should be created. Swap has all the necessary information required to be able to process transfers from the source to the destination.

POST https://api.layerswap.io/api/swaps

Create swap

Headers

Name
Type
Description

X-LS-APIKEY*

String

Content-Type*

application/json

Request Body

Name
Type
Description

destination*

String

source*

String

amount*

Number

The predefined amount. Note that this is NOT the final amount sent by the user since the user can specify another amount while transferring.

source_asset*

String

destination_address*

String

The destination network address, where the user will receive the funds.

refuel*

Bool

If set to true, the user will receive an additional refuel transaction in the native currency to the specified destination_address.

reference_id

String

Partner specified ID that could be used for the future reference to retrieve the swap.

destination_asset

String

{
  "data": {
    "swap_id": "28996c7d-ee95-4727-8efe-ba0006aa16d4"
    }
  "error": null
}

Raw request

curl -X 'POST' \
'https://api.layerswap.io/api/swaps' \
  -H 'X-LS-APIKEY: {YOUR_APP_APIKEY}' \
  -H 'Content-Type: application/json' \
  -d '{
      "source": "ETHEREUM_MAINNET",
      "destination": "ARBITRUM_MAINNET",
      "amount": 0.007,
      "source_asset": "ETH",
      "destination_asset": "ETH",
      "destination_address": "0xe688b84b23f322a994A53dbF8E15FA82CDB71127",
      "refuel": false,
      "reference_id": "1"
  }'

Raw response

{
  "data": {
    "swap_id": "28996c7d-ee95-4727-8efe-ba0006aa16d4"
    }  
  "error": null
}

Last updated

© 2023 Bransfer, Inc. All rights reserved.