swap

Build an unsigned swap transaction. Routes to user for signing.

Tier: Free

Parameters

ParameterTypeRequiredDescription
sellTokenstringYesToken to sell — symbol or address
buyTokenstringYesToken to buy — symbol or address
sellAmountstringYesAmount in human-readable units
chainIdnumberNoChain ID (default: 1)
slippagenumberNoSlippage tolerance % (default: 1)
walletAddressstringYesUser’s wallet address

Example

"Swap 100 USDC to ETH on Ethereum for wallet 0xd8dA..."

Signing Flow

  1. MCP server calls signing service /api/build/swap
  2. Signing service fetches route from 0x (fallback: 1inch)
  3. Unsigned tx is queued with status pending
  4. User gets WebSocket notification
  5. User reviews and signs on their device
  6. Returns pending transaction ID

Notes

  • Non-custodial: y0 never touches the signed transaction
  • Uses 0x as primary router, 1inch as fallback
  • Transaction expires after 5 minutes if not signed