Skip to main content
POST /swap/initiate endpoint creates an swap transaction where the customer sends from_asset to the generated deposit address, the output is delivered to beneficiary.wallet_address on the destination (to_asset).
Use GET /quote with the same payload (from_asset, to_asset, amount, exact_output) to preview the output without creating a swap.

Example request

curl https://api.onswitch.xyz/swap/initiate \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'x-service-key: '"$YOUR_SERVICE_KEY" \
  --data '{
  "amount": 100,
  "from_asset": "base:usdc",
  "to_asset": "bsc:usdt",
  "beneficiary": {
    "wallet_address": "0x1234567890123456789012345678901234567890"
  }
}'

Frequently Asked Questions

Add exact_output and amount if you want an exact amount to be received at the destination. e.g; if you want 100 USDT
{
  "exact_output": true,
  "amount": 100
}
Add callback_url to set the URL to receive webhook notifications when the payment status changes.
{
  "callback_url": "https://your-webhook-url.com"
}

Example response

{
  "success": true,
  "message": "Swap initiated successfully",
  "timestamp": "2026-03-31T06:23:38.535Z",
  "data": {
    "status": "AWAITING_DEPOSIT",
    "type": "SWAP",
    "reference": "7ec6514e-d894-474e-87de-a796b1b96771",
    "rate": 0.999684,
    "source": {
      "amount": 100,
      "currency": "USDC",
      "network": "BASE"
    },
    "destination": {
      "amount": 100.031644952349,
      "currency": "USDT",
      "network": "BSC"
    },
    "deposit": {
      "amount": 100,
      "address": "0x24eAD3fe58DE7DbD031ADddd9f8E6199B9cC691e",
      "asset": "base:usdc",
      "note": [
        "Kindly send the exact amount to the wallet address to complete the transaction.",
        "This dynamic wallet address has a 30 minutes expiry window and can only be used once."
      ]
    }
  }
}

Completing the Deposit

After initiating, you are expected to send exactly deposit.amount of deposit.asset to deposit.address. Check deposit.note for specific instructions.
The deposit address is for one-time use only and expires after 30 minutes. if not created with static set to true.
If less or more amount than specified in deposit.amount is sent, the deposit will be processed based on the amount sent, so long as it is within the limits and the asset (deposit.asset) sent is supported.

Need Help?

Email Support

Send us a message and we’ll get back to you shortly.

Book a Demo

Hop on a call with our team.