Skip to main content

Overview

The Layerswap API moves tokens across chains programmatically. The flow is the same for every route: discover a route, request a quote, create a swap, submit one on-chain deposit on the source chain, and Layerswap delivers the funds on the destination chain — then you track the swap to completion.
  • Base URL: https://api.layerswap.io
  • API key (optional): include your key in the X-LS-APIKEY header to attribute swaps to your account (for analytics and reporting). Create one on the API Keys page.
  • Endpoints: every endpoint, with request/response schemas, is in the Endpoints section of this tab — and is linked inline throughout this guide.

Core concepts

1. Discover routes & tokens

Find which networks and tokens you can bridge between, and the amount limits for a route. Each token in the /sources and /destinations response includes symbol, contract, decimals, price_in_usd, status, and group — the token family (e.g. ETH, USDC, USDT) that ties a token’s variants together across networks.
Identify tokens by contract address, not by a hard-coded symbol. A token’s symbol is a display label and can change — Arbitrum’s USDT was renamed to USDT0, so a hard-coded "source_token": "USDT" silently stops matching. The contract address is stable. Either pass the contract address as source_token / destination_token, or fetch the live token list from /sources and resolve by the group field. Don’t hard-code symbols, contract addresses, or decimals — discover them.
The full catalog is also browsable at Networks & Tokens.

2. Get a quote

GET /api/v2/quote returns the expected output, fees, and duration for a given amount, without creating a swap — provide the route plus an amount. Example response:
See Fees for how fees are composed.

3. Create the swap

POST /api/v2/swaps creates the swap and returns it together with the deposit_actions you’ll execute next. Choose one funding method: use_depository and use_deposit_address are mutually exclusive.
The response contains the created swap (with its id and status), the quote, and the deposit_actions array.

4. Execute the deposit action

A deposit action is the exact on-chain transaction to submit on the source chain. Read it from the swap response (or re-fetch via GET /api/v2/swaps/{swapId}/deposit_actions):
How you submit it depends on the source chain — the call_data format differs per network (EVM calldata, a Bitcoin OP_RETURN memo, a Solana transaction, etc.). Follow the chain-specific guide:
  • Deposit Actions — per-chain execution (EVM, Bitcoin, Solana, Starknet, TON, Tron, Fuel).
  • Depository — when you created the swap with use_depository: true.
Submit the returned call_data verbatim. It encodes the swap id and the assigned receiver; altering it means Layerswap can’t match your on-chain deposit to the swap.
After broadcasting, you can optionally speed up matching by reporting the transaction hash to POST /api/v2/swaps/{swapId}/deposit_speedup.

5. Track the transfer

Poll the swap to follow it to completion: A typical swap moves user_transfer_pendingls_transfer_pendingcompleted. Other terminal states are failed, expired, pending_refund, and refunded. See the Swap Lifecycle for every state and transition, and Refunds for failure handling.

Next steps

Deposit Actions

Execute the deposit on each supported chain.

Depository

Fund a swap by calling our on-chain contract.

Swap Lifecycle

Every swap state and how to react to it.

Fees

How quotes and fees are calculated.