Skip to main content
POST
/
swap
/
quote
Get quote
curl --request POST \
  --url https://api.onswitch.xyz/swap/quote \
  --header 'Content-Type: application/json' \
  --header 'x-service-key: <api-key>' \
  --data '
{
  "amount": 100,
  "from_asset": "base:usdc",
  "to_asset": "solana:usdt",
  "exact_output": false
}
'
{
  "success": true,
  "message": "Swap quote fetched successfully",
  "timestamp": "2024-01-01T00:00:00.000Z",
  "data": {
    "expiry": "2024-01-01T00:15:00.000Z",
    "settlement": "Instant",
    "channel": "BLOCKCHAIN",
    "rate": 1,
    "fee": {
      "total": 0.5,
      "platform": 0.45,
      "developer": 0.05,
      "currency": "USDC"
    },
    "fee_inclusive": true,
    "source": {
      "amount": 100,
      "currency": "USDC"
    },
    "destination": {
      "amount": 99.5,
      "currency": "USDT"
    }
  }
}

Authorizations

x-service-key
string
header
required

Service key for API authentication

Body

application/json
amount
number
required
Required range: x >= 0
from_asset
enum<string>
required
Available options:
base:usdc,
solana:usdc,
solana:usdt,
ethereum:usdc,
ethereum:usdt,
polygon:usdc,
polygon:usdt,
bsc:usdc,
bsc:usdt,
arbitrum:usdc,
optimism:usdc,
gnosis:usdc,
gnosis:usdt,
arbitrum:usdt,
avalanche:usdc,
monad:usdc,
optimism:usdt,
monad:usdt,
plasma:usdt,
avalanche:usdt,
tron:usdt,
linea:usdt,
mantle:usdt,
hyperevm:usdt,
berachain:usdt,
linea:usdc,
berachain:usdc,
sonic:usdc,
base:cngn,
bsc:cngn
to_asset
enum<string>
required
Available options:
base:usdc,
solana:usdc,
solana:usdt,
ethereum:usdc,
ethereum:usdt,
polygon:usdc,
polygon:usdt,
bsc:usdc,
bsc:usdt,
arbitrum:usdc,
optimism:usdc,
gnosis:usdc,
gnosis:usdt,
arbitrum:usdt,
avalanche:usdc,
monad:usdc,
optimism:usdt,
monad:usdt,
plasma:usdt,
avalanche:usdt,
tron:usdt,
linea:usdt,
mantle:usdt,
hyperevm:usdt,
berachain:usdt,
linea:usdc,
berachain:usdc,
sonic:usdc,
base:cngn,
bsc:cngn
exact_output
boolean
default:false

Response

Successfully retrieved swap quote

success
boolean
required
message
string
required
timestamp
string<date-time>
required
data
any | null
required

Response data