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"
}
}
}Get a real-time quote for swapping between two stablecoin assets including exchange rate and fees.
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"
}
}
}Service key for API authentication
x >= 0base: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 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