Overview
The Yativo Crypto swap feature allows you to exchange one token for another across supported chains. Use the sandbox to test the full swap lifecycle — getting quotes, executing swaps, and checking swap status — without spending real funds.
Sandbox base URL: https://crypto-sandbox.yativo.com/api/
Swap rates in the sandbox are simulated. They reflect approximate market conditions but are not live market prices. Do not use sandbox swap rates for financial calculations.
Get a Swap Quote
Before executing a swap, request a quote to see the expected output amount, rate, and fees.
GET https://crypto-sandbox.yativo.com/api/swap/quote
The source blockchain. Example: solana, ethereum, polygon.
The token to swap from. Example: SOL, ETH, USDC.
The destination blockchain. Can be the same as from_chain for same-chain swaps.
The token to receive. Example: USDC, SOL.
The input amount to swap.
SOL to USDC (same chain)
ETH to USDC (cross-chain)
USDC Solana to USDC Ethereum
curl -X GET 'https://crypto-sandbox.yativo.com/api/swap/quote?from_chain=solana&from_token=SOL&to_chain=solana&to_token=USDC&amount=1' \
-H 'Authorization: Bearer YOUR_SANDBOX_TOKEN'
SOL to USDC Quote
Cross-chain ETH to USDC Quote
{
"status" : "success" ,
"data" : {
"quote_id" : "quote_sandbox_01HX9KZMB3F7VNQP8R2WDGT200" ,
"from_chain" : "solana" ,
"from_token" : "SOL" ,
"from_amount" : 1.0 ,
"to_chain" : "solana" ,
"to_token" : "USDC" ,
"to_amount" : 174.82 ,
"exchange_rate" : 174.82 ,
"fee" : 0.87 ,
"fee_token" : "USDC" ,
"fee_percentage" : 0.5 ,
"price_impact" : 0.02 ,
"quote_valid_until" : "2026-03-25T11:03:00Z" ,
"estimated_execution_time_seconds" : 30 ,
"network" : "devnet"
}
}
Quotes expire quickly (typically 60–120 seconds). If the quote expires before you execute, request a new quote.
Execute a Swap
Execute a swap using a previously obtained quote.
POST https://crypto-sandbox.yativo.com/api/swap/execute
The quote ID obtained from the quote endpoint.
The wallet ID to deduct the source tokens from.
The wallet ID to credit the destination tokens to.
Maximum acceptable price slippage as a percentage. Default: 1.0 (1%). If actual slippage exceeds this, the swap will fail.
Execute SOL to USDC Swap
Execute cross-chain swap
curl -X POST 'https://crypto-sandbox.yativo.com/api/swap/execute' \
-H 'Authorization: Bearer YOUR_SANDBOX_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"quote_id": "quote_sandbox_01HX9KZMB3F7VNQP8R2WDGT200",
"from_wallet_id": "wlt_sandbox_01HX9KZMB3F7VNQP8R2WDGT012",
"to_wallet_id": "wlt_sandbox_01HX9KZMB3F7VNQP8R2WDGT010",
"slippage_tolerance": 1.0
}'
Swap Initiated
Quote Expired
{
"status" : "success" ,
"data" : {
"swap_id" : "swp_sandbox_01HX9KZMB3F7VNQP8R2WDGT300" ,
"quote_id" : "quote_sandbox_01HX9KZMB3F7VNQP8R2WDGT200" ,
"from_chain" : "solana" ,
"from_token" : "SOL" ,
"from_amount" : 1.0 ,
"to_chain" : "solana" ,
"to_token" : "USDC" ,
"expected_to_amount" : 174.82 ,
"status" : "processing" ,
"tx_hash" : "5yMq8rLmKv3xFjNw4aBcYhUeT8sGkZoP2iMnDuWr5CxPQRSTUVWXYZAB" ,
"network" : "devnet" ,
"created_at" : "2026-03-25T11:02:00Z"
}
}
Get Swap Status
Check the status of an executed swap.
GET https://crypto-sandbox.yativo.com/api/swap/{swapId}
The swap ID returned when the swap was executed.
curl -X GET 'https://crypto-sandbox.yativo.com/api/swap/swp_sandbox_01HX9KZMB3F7VNQP8R2WDGT300' \
-H 'Authorization: Bearer YOUR_SANDBOX_TOKEN'
{
"status" : "success" ,
"data" : {
"swap_id" : "swp_sandbox_01HX9KZMB3F7VNQP8R2WDGT300" ,
"from_chain" : "solana" ,
"from_token" : "SOL" ,
"from_amount" : 1.0 ,
"to_chain" : "solana" ,
"to_token" : "USDC" ,
"expected_to_amount" : 174.82 ,
"actual_to_amount" : 174.79 ,
"actual_exchange_rate" : 174.79 ,
"fee_charged" : 0.87 ,
"slippage" : 0.017 ,
"status" : "completed" ,
"tx_hash" : "5yMq8rLmKv3xFjNw4aBcYhUeT8sGkZoP2iMnDuWr5CxPQRSTUVWXYZAB" ,
"network" : "devnet" ,
"created_at" : "2026-03-25T11:02:00Z" ,
"completed_at" : "2026-03-25T11:02:35Z"
}
}
List Swap History
Retrieve a list of all swaps for your sandbox account.
GET https://crypto-sandbox.yativo.com/api/swap
Results per page. Default: 20.
Pagination offset. Default: 0.
Filter by status: pending, processing, completed, failed.
curl -X GET 'https://crypto-sandbox.yativo.com/api/swap?limit=10&status=completed' \
-H 'Authorization: Bearer YOUR_SANDBOX_TOKEN'
{
"status" : "success" ,
"data" : {
"swaps" : [
{
"swap_id" : "swp_sandbox_01HX9KZMB3F7VNQP8R2WDGT300" ,
"from_token" : "SOL" ,
"from_chain" : "solana" ,
"from_amount" : 1.0 ,
"to_token" : "USDC" ,
"to_chain" : "solana" ,
"actual_to_amount" : 174.79 ,
"status" : "completed" ,
"created_at" : "2026-03-25T11:02:00Z"
}
],
"total" : 1 ,
"limit" : 10 ,
"offset" : 0
}
}
Swap Status Values
Status Description pendingSwap has been submitted, awaiting processing. processingSwap is in progress — tokens are being exchanged. completedSwap completed successfully. Destination tokens credited. failedSwap failed. Source tokens are returned (minus any gas fees). refundedSwap was refunded due to failure. Check refund_tx_hash if applicable.
Testing Scenarios
Set slippage_tolerance to 0.0 (no tolerance). In an active testnet environment, this may trigger a slippage exceeded error: curl -X POST 'https://crypto-sandbox.yativo.com/api/swap/execute' \
-H 'Authorization: Bearer YOUR_SANDBOX_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"quote_id": "quote_sandbox_01HX9KZMB3F7VNQP8R2WDGT200",
"from_wallet_id": "wlt_sandbox_01HX9KZMB3F7VNQP8R2WDGT012",
"to_wallet_id": "wlt_sandbox_01HX9KZMB3F7VNQP8R2WDGT010",
"slippage_tolerance": 0.0
}'
Test with an expired quote
Wait for a quote to expire (typically 60–120 seconds after retrieval) before executing, to validate your application handles the QUOTE_EXPIRED error.
Test insufficient balance
Attempt to swap more than your available balance to test the INSUFFICIENT_BALANCE error handling in your application.
After a swap completes, verify the balance update by calling GET /wallets/{walletId} on both the source and destination wallets. The source balance should decrease and the destination balance should increase by the swap amounts.