Layerswap API
API Explorer
  • Overview
  • Partner Setup
  • UI Integration
    • Layerswap-hosted page
    • Embedded form
    • Customization
      • Interactive Builder
  • API Integration
    • Quickstart
    • API Reference
    • Swap lifecycle
    • Webhooks
    • DEPRECATED - V1 API Reference
      • Get Available Networks
      • Get Available Routes
      • Get Swap Rate
      • Create Fast Swap
      • Create Swap
      • Prepare Source Transaction
      • Get Swap
  • Mixed Integration
    • Swap Link
  • Data
    • Object types
    • Supported Platforms
      • Supported Networks
      • Supported Fiat Providers
      • Supported CEXes
Powered by GitBook

Layerswap

  • App
  • Explorer
  • Twitter
  • Discord

© 2023 Bransfer, Inc. All rights reserved.

On this page

Was this helpful?

Export as PDF
  1. API Integration
  2. DEPRECATED - V1 API Reference

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 1 year ago

Was this helpful?

API Key retrieved from

The supported blockchain network name, where the funds should be sent by the user.

The supported blockchain network name, where the funds should be sent by the user.

The swap currency name. .

The swap currency name. .

See available assets
See available assets
Partner Setup
See available values.
See available values.