Skip to main content
The Swap API lets your users exchange tokens within and across chains. Get a quote, review the rate and fees, then execute when ready. Quotes are time-limited, so execute promptly after receiving one.

Get Swappable Assets

GET /swap/assets Returns all tokens that can be used as swap sources or destinations.
cURL
curl -X GET https://crypto-api.yativo.com/api/swap/assets \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response
{
  "assets": [
    { "chain": "ethereum", "ticker": "USDC", "name": "USD Coin" },
    { "chain": "solana", "ticker": "USDC_SOL", "name": "USD Coin (Solana)" },
    { "chain": "ethereum", "ticker": "ETH", "name": "Ether" },
    { "chain": "solana", "ticker": "SOL", "name": "Solana" }
  ]
}

Get Available Routes

GET /swap/routes Returns all valid swap routes — which chain/token pairs can be swapped into which other pairs.
cURL
curl -X GET https://crypto-api.yativo.com/api/swap/routes \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Get a Quote

POST /swap/quote Request a swap quote. Returns the expected output amount, exchange rate, slippage, and fees.
from_chain
string
required
The source chain (e.g., ethereum).
from_ticker
string
required
The token to swap from (e.g., USDC).
to_chain
string
required
The destination chain (e.g., solana).
to_ticker
string
required
The token to swap to (e.g., USDC_SOL).
amount
string
required
Amount to swap, as a decimal string.
from_address
string
required
The sender’s address on the source chain.
to_address
string
required
The recipient’s address on the destination chain.
curl -X POST https://crypto-api.yativo.com/api/swap/quote \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "from_chain": "ethereum",
    "from_ticker": "USDC",
    "to_chain": "solana",
    "to_ticker": "USDC_SOL",
    "amount": "500",
    "from_address": "0x742d35Cc6634C0532925a3b8D4C9C2A5Ef8C2B1",
    "to_address": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"
  }'
Response
{
  "quote_id": "quote_01abc123",
  "from_chain": "ethereum",
  "from_ticker": "USDC",
  "from_amount": "500",
  "to_chain": "solana",
  "to_ticker": "USDC_SOL",
  "to_amount": "498.75",
  "exchange_rate": "0.9975",
  "price_impact": "0.05%",
  "fee_usd": "1.25",
  "estimated_time_seconds": 120,
  "expires_at": "2026-03-26T10:11:00Z"
}
Quotes expire after a short window (typically a few minutes). Execute the swap before expires_at.

Execute a Swap

POST /swap/execute Executes a previously quoted swap.
quote_id
string
required
The quote ID from the /swap/quote response.
from_asset_id
string
required
The asset (wallet) ID to debit the source tokens from.
to_address
string
required
The destination address to receive the swapped tokens.
curl -X POST https://crypto-api.yativo.com/api/swap/execute \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "quote_id": "quote_01abc123",
    "from_asset_id": "asset_01xyz789",
    "to_address": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"
  }'
Response
{
  "swap_id": "swap_01def456",
  "quote_id": "quote_01abc123",
  "status": "processing",
  "from_chain": "ethereum",
  "from_ticker": "USDC",
  "from_amount": "500",
  "to_chain": "solana",
  "to_ticker": "USDC_SOL",
  "expected_to_amount": "498.75",
  "from_tx_hash": "0xabc123...",
  "created_at": "2026-03-26T10:06:00Z"
}

Swap History

GET /swap/history Returns a list of past swaps.
limit
number
Number of results to return. Defaults to 20.
offset
number
Offset for pagination. Defaults to 0.
status
string
Filter by status: processing, completed, failed.
cURL
curl -X GET "https://crypto-api.yativo.com/api/swap/history?limit=20&offset=0&status=completed" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response
{
  "swaps": [
    {
      "swap_id": "swap_01def456",
      "status": "completed",
      "from_chain": "ethereum",
      "from_ticker": "USDC",
      "from_amount": "500",
      "to_chain": "solana",
      "to_ticker": "USDC_SOL",
      "to_amount": "498.71",
      "completed_at": "2026-03-26T10:08:20Z"
    }
  ],
  "total": 1,
  "limit": 20,
  "offset": 0
}

Swap Statuses

StatusDescription
processingSwap initiated, source transaction broadcast
completedSwap fully settled, destination tokens delivered
failedSwap failed; source funds are returned
Subscribe to the swap.completed and swap.failed webhook events to get real-time notifications instead of polling the history endpoint.