Skip to main content

Overview

Test the full swap lifecycle — getting quotes and executing cross-chain or same-chain token swaps — 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.

Step 1 — Get a Swap Quote

Request a price quote before executing. The quote includes the expected output amount, rate, and fees.
POST https://crypto-sandbox.yativo.com/api/swap/quote
from_chain
string
required
Source blockchain: solana, ethereum, base, polygon, etc.
from_ticker
string
required
Source token ticker: USDC_SOL, ETH, SOL, etc.
to_chain
string
required
Destination blockchain. Can be the same as from_chain for same-chain swaps.
to_ticker
string
required
Destination token ticker: USDC_ETH, USDC_SOL, etc.
amount
string
required
Input amount in the source token’s native units, e.g. "100.00".
from_address
string
required
Source wallet address sending the funds.
to_address
string
required
Destination wallet address to receive the swapped funds.
curl -X POST 'https://crypto-sandbox.yativo.com/api/swap/quote' \
  -H 'Authorization: Bearer YOUR_SANDBOX_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "sourceAsset": "USDC_SOL",
    "destinationAsset": "ETH_Base",
    "amount": "10"
  }'
Response — Quote
{
  "status": "success",
  "data": {
    "quote_id": "qte_01HX9KZMB3F7VNQP8R2WDGT4EG",
    "from_chain": "solana",
    "from_ticker": "USDC_SOL",
    "from_amount": "10",
    "to_chain": "base",
    "to_ticker": "ETH_Base",
    "to_amount": "0.00284",
    "exchange_rate": "0.000284",
    "fee": "0.05",
    "fee_ticker": "USDC",
    "price_impact": "0.01",
    "quote_valid_until": "2026-03-28T11:02:00Z",
    "estimated_execution_time_seconds": 120
  }
}
Quotes expire quickly (typically 60–120 seconds). If the quote expires before you execute, request a new one.

Step 2 — Execute the Swap

Execute a swap using a previously obtained quote ID.
POST https://crypto-sandbox.yativo.com/api/swap/execute
quote_id
string
required
The quote ID obtained from POST /swap/quote.
from_asset_id
string
required
The asset ID of the source wallet to deduct funds from.
to_address
string
required
Destination wallet address to receive the swapped tokens.
Execute 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": "qte_01HX9KZMB3F7VNQP8R2WDGT4EG",
    "from_asset_id": "ast_01HX9KZMB3F7VNQP8R2WDGT4E6",
    "to_address": "0x1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b"
  }'
{
  "status": "success",
  "message": "Swap initiated successfully",
  "data": {
    "swap_id": "swp_01HX9KZMB3F7VNQP8R2WDGT4EH",
    "quote_id": "qte_01HX9KZMB3F7VNQP8R2WDGT4EG",
    "from_chain": "solana",
    "from_ticker": "USDC_SOL",
    "to_chain": "base",
    "to_ticker": "ETH_Base",
    "from_amount": "10",
    "to_amount": "0.00284",
    "status": "pending",
    "from_tx_hash": "5KgF7hJ2mN4pQ8rT9vX1yC3bA6wD0eG2jL5nP8sU1z4",
    "created_at": "2026-03-28T11:01:00Z"
  }
}

Step 3 — Check Swap History

Retrieve the history of your swaps.
GET https://crypto-sandbox.yativo.com/api/swap/history
limit
integer
Max results to return. Defaults to 20.
offset
integer
Records to skip for pagination. Defaults to 0.
status
string
Filter by status: pending, completed, failed.
cURL
curl -X GET 'https://crypto-sandbox.yativo.com/api/swap/history?limit=10&status=completed' \
  -H 'Authorization: Bearer YOUR_SANDBOX_TOKEN'
Response
{
  "success": true,
  "data": [
    {
      "swap_id": "swp_01HX9KZMB3F7VNQP8R2WDGT4EH",
      "from_ticker": "USDC_SOL",
      "from_chain": "solana",
      "from_amount": "10",
      "to_ticker": "ETH_Base",
      "to_chain": "base",
      "to_amount": "0.00284",
      "status": "completed",
      "created_at": "2026-03-28T11:01:00Z"
    }
  ]
}

Swap Status Values

StatusDescription
pendingSwap submitted, awaiting processing.
processingSwap in progress — tokens are being exchanged.
completedSwap completed. Destination tokens credited.
failedSwap failed. Source tokens returned (minus gas fees).

Testing Scenarios

Wait 60–120 seconds after getting a quote, then try to execute it. Your application should receive an error and re-request a fresh quote.
Request a quote for more than your available balance, then try to execute it. Verify your application handles the INSUFFICIENT_BALANCE error.
After a swap completes, verify the balance update by calling POST /assets/get-user-assets. The source asset balance should decrease and the destination asset balance should increase.