Crypto swap API
Swap via API
Swap any coin across 40+ chains from your code. No KYC, no account, non-custodial.
Routes through THORChain, Chainflip, NEAR Intents and 9 moreAPI key
fa57ad8f-880d-4111-86ec-bc32d7e2b4c7fa57ad8f-880d-4111-86ec-bc32d7e2b4c7No signup. Send it as the Api-Key header to https://api.leokit.dev
Three calls. Any wallet.
No wallet to connect and nothing to sign. You send the funds yourself.
- 1
GET /quote-depositGet a quote
Pick two assets and an amount. You see the price and fees before anything moves.
- 2
POST /deposit-addressSend to the deposit address
Ask for an address, then send the exact amount to it from any wallet before it expires (at least 20 minutes).
- 3
POST /statusTrack it
Check every 10 seconds until it says success. If it fails, the provider refunds your refund address.
Step 1: get a quote. Safe to run as is.
curl -s "https://api.leokit.dev/quote-deposit?from_asset=BTC.BTC&to_asset=ETH.ETH&amount=0.01&slippage_bps=300" -H "Api-Key: fa57ad8f-880d-4111-86ec-bc32d7e2b4c7" \
| jq 'if .quotes then (.quote_id as $id | ([.quotes[] | select(.smart_recommended)] + .quotes)[0] | {quote_id: $id, protocol, amount_out: ((.data.expected_amount_out | tonumber) / pow(10; .data.out_asset_decimal)), fees_usd: .totalFeesUsd}) else . end'Needs jq to print the pick. Without jq, run only the curl line and drop the trailing \.
Steps 2 and 3: deposit and track. Replace the capitalised placeholders first.
curl -s "https://api.leokit.dev/deposit-address" \
-H "Api-Key: fa57ad8f-880d-4111-86ec-bc32d7e2b4c7" -H "Content-Type: application/json" \
-d '{"quote_id":"QUOTE_ID_FROM_STEP_1","from_address":"YOUR_BTC_REFUND_ADDRESS","to_address":"YOUR_ETH_ADDRESS"}'
curl -s "https://api.leokit.dev/status" \
-H "Api-Key: fa57ad8f-880d-4111-86ec-bc32d7e2b4c7" -H "Content-Type: application/json" \
-d '{"quote_id":"QUOTE_ID_FROM_STEP_1"}'Step 1: get a quote. Safe to run as is.
const API = "https://api.leokit.dev";
const KEY = "fa57ad8f-880d-4111-86ec-bc32d7e2b4c7";
// 1 Get a quote
const res = await fetch(API + "/quote-deposit?from_asset=BTC.BTC&to_asset=ETH.ETH&amount=0.01&slippage_bps=300", {
headers: { "Api-Key": KEY },
});
const text = await res.text();
if (!res.ok) throw new Error(res.status + " " + text);
const q = JSON.parse(text);
const best = q.quotes.find((o) => o.smart_recommended) ?? q.quotes[0];
console.log({
quote_id: q.quote_id,
protocol: best.protocol,
amount_out: Number(best.data.expected_amount_out) / 10 ** best.data.out_asset_decimal, // in ETH
fees_usd: best.totalFeesUsd,
});Node 18+: save as quote.mjs and run node quote.mjs.
Steps 2 and 3: deposit and track. Replace the capitalised placeholders first.
// Replace these three first. The refund address is on the source chain (BTC here).
const QUOTE_ID = "QUOTE_ID_FROM_STEP_1";
const REFUND_ADDRESS = "YOUR_BTC_REFUND_ADDRESS";
const RECEIVE_ADDRESS = "YOUR_ETH_ADDRESS";
const API = "https://api.leokit.dev";
const headers = { "Api-Key": "fa57ad8f-880d-4111-86ec-bc32d7e2b4c7", "Content-Type": "application/json" };
const post = async (path, body) => {
const res = await fetch(API + path, { method: "POST", headers, body: JSON.stringify(body) });
const text = await res.text();
if (!res.ok) throw new Error(res.status + " " + text);
return JSON.parse(text);
};
// 2 Get a deposit address, then send exactly dep.amount to it before it expires
const dep = await post("/deposit-address", { quote_id: QUOTE_ID, from_address: REFUND_ADDRESS, to_address: RECEIVE_ADDRESS });
console.log("Send", dep.amount, dep.from_asset, "to", dep.deposit_address, "before", new Date(dep.expires_at).toISOString());
// 3 Track it every 10 seconds until success, failed or refunded
let s;
do {
await new Promise((r) => setTimeout(r, 10_000));
s = await post("/status", { quote_id: QUOTE_ID });
console.log(s.status);
} while (!["success", "completed", "failed", "refunded"].includes(s.status));Step 1: get a quote. Safe to run as is.
import json, urllib.parse, urllib.request
API = "https://api.leokit.dev"
H = {"Api-Key": "fa57ad8f-880d-4111-86ec-bc32d7e2b4c7", "User-Agent": "my-swap-app/1.0"} # Python's default User-Agent is refused
# 1 Get a quote
params = urllib.parse.urlencode({"from_asset": "BTC.BTC", "to_asset": "ETH.ETH", "amount": "0.01", "slippage_bps": 300})
req = urllib.request.Request(f"{API}/quote-deposit?{params}", headers=H)
q = json.load(urllib.request.urlopen(req))
best = next((o for o in q["quotes"] if o.get("smart_recommended")), q["quotes"][0])
print({
"quote_id": q["quote_id"],
"protocol": best["protocol"],
"amount_out": float(best["data"]["expected_amount_out"]) / 10 ** best["data"]["out_asset_decimal"], # in ETH
"fees_usd": best.get("totalFeesUsd"),
})Python 3, no packages needed.
Steps 2 and 3: deposit and track. Replace the capitalised placeholders first.
import json, time, urllib.request
# Replace these three first. The refund address is on the source chain (BTC here).
QUOTE_ID = "QUOTE_ID_FROM_STEP_1"
REFUND_ADDRESS = "YOUR_BTC_REFUND_ADDRESS"
RECEIVE_ADDRESS = "YOUR_ETH_ADDRESS"
API = "https://api.leokit.dev"
H = {"Api-Key": "fa57ad8f-880d-4111-86ec-bc32d7e2b4c7", "Content-Type": "application/json", "User-Agent": "my-swap-app/1.0"}
def post(path, body):
req = urllib.request.Request(API + path, data=json.dumps(body).encode(), headers=H)
return json.load(urllib.request.urlopen(req))
# 2 Get a deposit address, then send exactly dep["amount"] to it before it expires
dep = post("/deposit-address", {"quote_id": QUOTE_ID, "from_address": REFUND_ADDRESS, "to_address": RECEIVE_ADDRESS})
print("Send", dep["amount"], dep["from_asset"], "to", dep["deposit_address"])
# 3 Track it every 10 seconds until success, failed or refunded
while True:
s = post("/status", {"quote_id": QUOTE_ID})
print(s["status"])
if s["status"] in ("success", "completed", "failed", "refunded"):
break
time.sleep(10)Read https://leodex.io/swap-api.md and use the LeoDex Swap API to help me swap crypto.
API key: fa57ad8f-880d-4111-86ec-bc32d7e2b4c7 (send it as the Api-Key header).
Get a live quote first and show it to me. Don't create a deposit address until I confirm the amounts, both assets, my receive address and my refund address.
Never ask for a private key or seed phrase. I send the funds myself.Every route, errors and limits: swap-api.md
40+ chains. One key.
Native Bitcoin, Ethereum, Solana, Zcash, XRP, TRON, Dogecoin, Litecoin and more. GET /assets lists every asset id.
Bitcoin
Ethereum
Solana
Zcash
Base
Arbitrum
BNB Chain
Avalanche
TRON
XRP Ledger
Litecoin
DogecoinNEAR
- And more
0.45%
Per swap, any size. The same as leodex.io.
12 protocols
GET /quote compares the providers leodex.io uses (Chainflip, NEAR Intents, Relay, THORChain, MAYAChain and more) and returns the best offer first.
No account
One public key. No signup, no wallet to connect.
Refunds go to you
If a swap fails, the provider returns your funds to your refund address. LeoDex never holds them.
For AI agents and bots
Paste one prompt into any AI agent. It gets a live quote, asks you to confirm, then gives you the address to send to. It never asks for your keys.
No MCP server needed. The prompt points your agent at swap-api.md.
- Gets a live quote first.
- Shows you the quote and waits for your yes before it creates a deposit address.
- Never guesses an address. It asks you.
- Never asks for your keys. You send the funds yourself.
Swap 0.01 BTC to ETH. Send it to 0x8f3…c21, refunds to bc1q…7x4.
0.01 BTC →
about 0.3412 ETHChainflip has the best rate, after the 0.45% fee. Create the deposit address?Yes
Send 0.01 BTC from any wallet
About 0.3410 ETH arrived.
12 protocols. One quote.
THORChainNative BTC, ETH, ZEC and more, no wrapped tokens
ChainflipFast native BTC, ETH and SOL swapsNEAR Intents200+ assets across 30+ chains
MAYAChainNative BTC, ETH, DASH and more
RelayFast swaps between EVM chains
RangoRoutes across EVM, Solana and Cosmos
AcrossFast stablecoin and ETH transfers between EVM chains
deBridgeCrosschain swaps between EVM chains
MayanSolana ↔ EVM swaps
BOB GatewayNative BTC to EVM chains
HarborNative BTC and ETH swaps
KyberSwapSame-chain token swaps (more chains soon)
GET /quote compares all 12; the three-call deposit flow uses Chainflip, NEAR Intents, Relay and BOB.
Questions
Is there a free crypto swap API?
Yes. The key on this page is free for everyone, with no signup. You only pay the swap fee shown in each quote: 0.45% on most swaps, 0.02% on stablecoin-to-stablecoin and same-asset swaps.
How do I get an API key?
Copy the public key at the top of this page and send it as the Api-Key header. There's no signup and no account. Go to the key.
Does the LeoDex Swap API require KYC or an account?
No. No KYC, no sign-up and no account. The free public key is on this page. Prefer to swap in the app? See no-KYC swaps on leodex.io.
Is the LeoDex Swap API self-custodial?
Yes. You keep your own keys, and every swap goes from your wallet, through the swap protocol, to your own address. LeoDex never holds your funds.
How do I swap Bitcoin to Ethereum with an API?
Call GET /quote-deposit with from_asset=BTC.BTC, to_asset=ETH.ETH and an amount. Then POST /deposit-address with the quote_id and your addresses, and send the BTC to the address it returns. POST /status tells you when the ETH has arrived.
What happens if a swap fails?
The provider refunds to the from_address you gave, and /status shows refunded.
Which coins and chains can I swap?
40+ chains, the same as leodex.io: Bitcoin, Ethereum, Solana, Zcash, Base, Arbitrum, BNB Chain, Avalanche, TRON, XRP, Litecoin, Dogecoin, NEAR and more. The deposit flow uses Chainflip, NEAR Intents, Relay and BOB. THORChain and Maya routes use wallet mode. GET /assets lists every asset id.
Can my AI agent use it?
Yes. Paste the prompt from this page, or point your agent at leodex.io/swap-api.md. It gets a live quote and asks you to confirm before creating a deposit address, and it never asks for your keys.
Is there an MCP server?
No. Any agent that can make HTTP requests can use the API. Paste the prompt from this page, or point your agent at leodex.io/swap-api.md.
Can I call it from a browser?
Yes. The API allows cross-origin requests, so a web page can call it with the public key.
Can I use it in a Telegram bot?
Yes. Your bot gets a quote, asks for a deposit address, shows it to the user, then checks /status until the swap is done.
Do I need my own THORChain, Chainflip or NEAR Intents keys?
No. The one public key covers every route.
Do I pay per request?
No. There's no charge per call. You pay only the swap fee shown in each quote.
Are there rate limits?
Yes, fair-use limits per visitor. A 429 tells you how many seconds to wait (retry_after_seconds, also sent as Retry-After). Wait, then retry.
Go further
OpenAPI 3.1: Import it into Postman, Insomnia or Bruno.
Run by LeoDex, routing swaps since April 2024. Swap API live since 5 November 2026. Updated 6 November 2026.
- 1Non-custodial: you send funds straight to the swap provider. LeoDex never holds them.
- 2Don't use this key if you are a sanctioned person or in a sanctioned jurisdiction, or to move proceeds of crime.
- 3Providers may screen addresses and refuse or refund swaps.
- 4No load testing or limit evasion. We may rotate the key at any time; this page always shows the current one.
- 5We don't log IP addresses.