Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Check out the Interactive builder to see how it looks and feels.
from
- One of the supported platforms
Source network or exchange you want the users to transfer from, for example IMMUTABLEX_MAINNET
.
to
- One of the supported platforms
Destination network or exchange you want the users to transfer from, for example ETHEREUM_MAINNET
.
asset
The asset that you want to be preselected. NOTE: available assets depend on the selected network, for example, the asset IMX
is only available in the IMMUTABLEX_MAINNET
network.
destAddress
The destination address the funds should reach at the end of the swap.
lockAddress
- true
/false
If set to true, the destination address will be locked for editing.
hideFrom
- true
/false
If set to true, the source will be hidden in the UI.
lockFrom
- true
/false
If set to true, the source will be locked for editing.
hideTo
- true
/false
If set to true, the destination will be hidden in the UI.
lockTo
- true
/false
If set to true, the destination will be locked for editing.
lockAsset
- true
/false
If set to true, the asset will be locked for editing.
hideRefuel
- true
/false
If set to true, refuel feature will be disabled and not shown in the UI.
clientId
Clinet Id from partner setup.
If the destAddress
parameter is provided, the Partner's logo will be shown next to the address.
amount
Use to pre-fill the amount field.
Users will still be able to change it in the UI. The parameter will be skipped if the asset
parameter was not passed.
externalId
A unique ID representing the user's transfer session in the partner's system. This can later be used to query the status of the transfer and will be included in the webhook notifications sent to the partner. Refer to the API Reference section to learn more.
account
User account name or address that will be shown as a source.
hideFrom
should be set to true
actionButtonText
Use to replace Swap now
button text. For example, it can be changed to Deposit
or Withdraw
.
You can redirect users from your Web or Mobile app to Layerswap and customize their journey by providing query parameters.
Refer to the UI customization section to explore all the available options.
A simple example with a predefined destination would look like this:
Layerswap API is set to enable fast and reliable crypto transfers for end-users directly in your app environment
Layerswap handles millions of dollars in transactions every day across multiple networks. We ensure quick and reliable crypto transfers, giving the freedom to move crypto anywhere.
You can utilize Layerswap's transacting infrastructure in four ways:
Layerswap is a prebuilt, optimized gateway that lets anyone easily and securely process transactions across multiple networks - overcoming liquidity fragmentation and complex bridging steps. Layerswap’s built-in features allow you to reduce your development time. It supports 30+ networks. You can directly into your website or direct customers to a .
A simple integration workflow:
Get , and
using the Layerswap API
Layerswap will monitor the source network for a transaction and will try to match it with the corresponding swap
Once the transaction is matched and added to the swap, Layerswap will initiate a counterparty transaction to the destination_address
(Optionally) Poll via endpoint to see if the matching transaction Input was added to the swap
If the , Layerswap will deliver a swap status update notification to the partner-specified URL
Postman Collection:
End-to-End Backend + Frontend Integration:
Swagger docs:
For integrating Layerswap, partners should register in the and set up an organization.
Each partner account can create an organization and app(s) within that organization. The organization serves as a logical grouping for multiple associated apps. The app stores all the partner-related information like API keys for programmatic access, webhooks, and other configurations that are needed for the integration and customizations.
Enter your email address
Check your email address for a Code sent from Layerswap
Enter provided Code to login into the dashboard.
Create an organization
Create an app under the organization
Go to the newly created app and copy the API key
Process transactions through an embeddable form or Layerswap-hosted page using Layerswap’s low-code integration. You can and access additional functionalities with the .
To get started with the integration, .
API Key is used for accessing and should be stored privately.
Client Id is used for or .
Before creating a swap, it's possible to programmatically retrieve available sources, destinations and assets for swaps. The endpoint is public and does not require any authorization.
GET
https://api.layerswap.io/api/available_networks
version
String
Possible values “sandbox” | any. If a sandbox value is provided, only the Testnet networks will be returned. For any other values - only the Mainnet networks will be returned.
Before creating a swap, it's possible to programmatically retrieve data about the valid minimum/maximum swap amount and the Layerswap fee. The endpoint is public and does not require any authorization.
POST
https://api.layerswap.io/api/swap_rate
Content-Type*
String
application/json
source*
String
destination*
String
source_asset*
String
The currency name. Example: USDC
refuel*
String
If set to true, the user will receive an additional refuel transaction in the native currency for the swap.
destination_asset
String
The currency name. Example: USDC
A detailed explanation of the Swap Rate Object is available here.
You can programmatically generate a swap from your backend and then display the Layerswap UI to your users for transaction completion. This allows them to finalize the swap while benefiting from the Layerswap UX. To achive this:
using the Layerswap API.
Retrieve the swap_id
from the response.
Construct a link to the transaction using the following format: https://www.layerswap.io/app/swap/{SWAP_ID_FROM_PREVIOUS_STEP}
Either redirect the user to the or set the URL in your .
This endpoint return all the neccessary information to execute source transaction.
GET
https://api.layerswap.io/api/swaps/{id}/prepare_src_transaction
Prepare swap deposit for execution
Note that you should execute this transaction manually. You should compose it based on the response and send to your wallet for execution. (Ex. User's Metamask, wallet managed by Fireblocks)
From the creation up to the completion step the swap lifecycle goes as follows:
user_transfer_pending)
Whenever the swap is created, either programmatically or from the Layerswap UI, the swap has user_transfer_pending
status. At this stage, Layerswap is awaiting the incoming transaction to the deposit address in the source network to match it with the corresponding swap. Users have the option to cancel the swap.
cancelled)
If the user decides to cancel the swap, the swap status will be changed to cancelled. The swap can still be retrieved for historical purposes, however, no incoming transaction will be matched against the swap.
expired
)If the user does not cancel the swap and also does not initiate the transaction in the source network within 4 days
, the Swap status will be changed to expired.
ls_transfer_pending)
After the user has initiated the transfer to the deposit address in the source network, Layerswap will monitor the blockchain network to verify that a transaction has been received. After receiving the transaction and matching it with the corresponding swap, Layerswap will create an Input transaction object, which will describe the transaction sent by the user and connect it with the corresponding swap. The swap status will be changed to ls_transfer_pending
.
completed)
After receiving the transaction and setting the swap status to ls_transfer_pending
, Layerswap will initiate the outgoing transaction to the user-specified destination address in the destination network and the swap status will be changed to completed
.
failed)
If there is an issue with Layerswap and the outgoing transaction to the user-specified destination address could not be initiated, the swap status will be changed to failed.
The supported blockchain network name.
The supported blockchain network/CEX/fiat provider name.
GET
No
https://api.layerswap.io/api/available_networks
GET
No
https://api.layerswap.io/api/available_routes
GET
No
https://api.layerswap.io/api/swap_rate
POST
Yes
https://api.layerswap.io/api/swaps
POST
No
https://api.layerswap.io/api/swaps/fast
POST
Yes
https://api.layerswap.io/api/swaps/{id}/prepare
GET
Yes
https://api.layerswap.io/api/swaps/{id}
Cancel Swap
DELETE
Yes
https://api.layerswap.io/api/swaps/{id}
version
String
Possible values “sandbox” | any. If a sandbox value is provided, only the Testnet networks will be returned. For any other values - only the Mainnet networks will be returned.
sourceAsset
String
The currency name to be filtered. Example: USDT.
destination
String
The supported blockchain network name to be filtered. See available values.
source
String
The supported blockchain network name to be filtered. See available values.
destinationAsset
String
The currency name to be filtered. Example: USDT.
id*
String
The Swap response data.id received in the create swap endpoint
from_address
String
Address from which the transaction is going to be executed
X-LS-APIKEY*
API Key retrieved from Partner Setup
Kucoin
KUCOIN
Coinspot
COINSPOT
Kraken
KRAKEN
OKX
OKEX
Binance
BINANCE
Bittrex Global
BITTREX
Huobi Global
HUOBI
Coinbase
COINBASE
Bitfinex
BITFINEX
Crypto.com Exchange
CRYPTOCOM
Blocktane
BLOCKTANE
Gate.io
GATEIO
MEXC Global
MEXC
BitGet
BITGET
Swyftx
SWYFTX
Gemini
GEMINI
Crypto.com APP
CRYPTOCOMAPP
Newton
NEWTON
Binance US
BINANCEUS
Bybit
BYBIT
Stripe
STRIPE
MoonPay
COMING SOON
Ramp.Network
COMING SOON
id
The id of the swap
source_network
Network name like STARKNET_MAINNET
destination_network
Network name like OPTIMISM_MAINNET
amount
The amount to be sent. Note that this is NOT the final amount sent by the user since the user can specify another amount while transferring
fee
The Layerswap fee. Note that fee is recalculated based on the transaction initiated by the user
source_asset
Asset Name transfered, like USDC
destination_address
The address where the user funds will be received
reference_id (optional)
Partner specified id that could be used for future reference to retrieve the swap
status
The status of the swap. Available values: [user_transfer_pending, ls_transfer_pending, completed, failed, expired, canceled]
transactions
name
The unique formatted name indicates the network and whether it is on Testnet or Mainnet
display_name
The user-friendly name for the network
logo
The URL for the network logo
name
The unique formatted name for the currency (e.g: ETH)
display_name
The user-friendly name for the currency
logo
The URL for the currency logo
name
The recent price in USD for the currency
contract (optional)
The contract address for the currency
decimals
The floating decimal places for the currency
precision
The number of decimal places for the currency amount to be used in rounding
timestamp
The timestamp of an actual blockchain transaction
type
Layerswap transaction types. Possible values: "input", "output", "refuel"
from
The sending party of the transaction
to
The receiving party of the transaction
transaction_hash
The blockchain transaction id
confirmations
The number of confirmations for the transaction
max_confirmations
The maximum number for the transaction to be confirmed at the blockchain
amount
The amount sent in the transaction
min_amount
The minimal amount for the swap to be created for a given asset
max_amount
The maximal amount for the swap to be created for a given asset
fee_amount
The Layerswap fee amount
This endpoint provides the ability to create a swap with as few parameters as possible - destination network, asset and amount. Then, the endpoint will return all the possible source networks which can be used for transferring the funds to the destination network. The returned source networks are tracked for a possible deposit.
POST
https://api.layerswap.io/api/swaps/fast
Create fast swap
client_id
String
Content-Type*
String
application/json
destination_address*
String
The destination network address, where the user will receive the funds.
destination_asset*
String
destination_network*
String
To check transaction status, you can retrieve created swap.
GET
https://api.layerswap.io/api/swaps/
Get swap by Id or ReferenceId
id*
String
ID can be either the Swap response data.id received in the create swap endpoint or a partner provided reference_id from the create swap request
X-LS-APIKEY*
A detailed explanation of Swap Object is available here.
In these sections, you can see the complete list of supported networks, CEXes, fiat providers:
Layerswap provides a webhook configuration functionality so that Partners can receive notifications on any swap status change. Webhooks can be set up per partner application. In order to configure a webhook the following steps must be performed:
Login to
Select the organization/app
From left pane select Webhooks, then provide the URL where the webhook should be received and click Create Webhook
The newly created webhook should appear under the app
Copy the webhook secret for future verification
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
Array of
Optionally can be passed to the application .
The swap currency name. .
The supported blockchain network name, where the funds should be sent by the user.
API Key Retrived from
Layerswaps uses Svix for Webhook Management. In order to verify an incoming webhook from Svix please refer to . Use the webhook secret from the dashboard as a Svix secret.
For the structure of the swap notification, please refer to the . Please note that the complete information webhook will be sent only when the swap status is completed. For other statuses, notification will include a subset of this information (whatever is available at that time).
Immutable X
IMMUTABLEX_MAINNET
StarkNet
STARKNET_MAINNET
Loopring
LOOPRING_MAINNET
Arbitrum One
ARBITRUM_MAINNET
Arbitrum Nova
ARBITRUMNOVA_MAINNET
Optimism
OPTIMISM_MAINNET
Ethereum
ETHEREUM_MAINNET
zksync Lite (v1)
ZKSYNC_MAINNET
zksync Era (v2)
ZKSYNCERA_MAINNET
Polygon
POLYGON_MAINNET
Polygon zkEVM
POLYGONZK_MAINNET
BNB Chain (BSC)
BSC_MAINNET
Osmosis
OSMOSIS_MAINNET
rhino.fi
RHINOFI_MAINNET
Solana
SOLANA_MAINNET
zkSpace
ZKSPACE_MAINNET
KuCoin Community Chain (KCC)
KCC_MAINNET
Fuse
FUSE_MAINNET
Immutable X Ropsten
IMMUTABLEX_ROPSTEN
Immutable X Goerli
IMMUTABLEX_GOERLI
StarkNet Goerli
STARKNET_SEPOLIA
X-LS-APIKEY*
String
API Key retrieved from Partner Setup
Content-Type*
application/json
destination*
String
The supported blockchain network name, where the funds should be sent by the user. See available values.
source*
String
The supported blockchain network name, where the funds should be sent by the user. See available values.
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
The swap currency name. See available assets.
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
The swap currency name. See available assets.