Quickstart

This flow gets a quote, builds the swap payload, then either sends an on-chain transaction or signs and submits a gasless order.

1. Get credentials

Create a free merchant account, create a project, then copy the Client ID and API Key.

export TENFI_CLIENT_ID="ci_your_client_id"
export TENFI_API_KEY="sk_your_api_key"

2. Quote BSC USDT to BNB

curl "https://api.10fi.org/v1/quote?chain=bsc&from=USDT&to=BNB&amount=100&gasless=true" \
  -H "X-Client-Id: $TENFI_CLIENT_ID" \
  -H "X-API-Key: $TENFI_API_KEY"

3. Build the swap

curl -X POST "https://api.10fi.org/v1/swap" \
  -H "Content-Type: application/json" \
  -H "X-Client-Id: $TENFI_CLIENT_ID" \
  -H "X-API-Key: $TENFI_API_KEY" \
  -d '{
    "chain":"bsc",
    "from":"USDT",
    "to":"BNB",
    "amount":"100",
    "userAddress":"0xYourWallet",
    "preferGasless":true,
    "slippageBps":50
  }'

4. Handle the response

await fetch("https://api.10fi.org/v1/submit", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-Client-Id": process.env.TENFI_CLIENT_ID!,
    "X-API-Key": process.env.TENFI_API_KEY!,
  },
  body: JSON.stringify({ toSign, signature, chainId, userAddress }),
});