Swap tokens within an Earn Account.
Use this endpoint to exchange one token for another without transferring funds out of the Earn Account.
The swap executes atomically within the Earn Account and can be combined with other actions using the bundle endpoint. For example, swap ETH to USDC, then deposit USDC into a vault—all in one transaction.
Returns either an unsigned transaction (when gas_sponsorship=false) or EIP-712 typed data for off-chain signing (when gas_sponsorship=true). For gas-sponsored swaps, submit the signed typed data to /gas_sponsorship/prepare.
Request model for swap endpoint.
Inherits swap params and adds context fields (owner, chain, gas_sponsorship).
Token to sell (input). Provide a token symbol from a limited set (e.g., 'USDC') or any token address.
"USDC"
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
Token to buy (output). Provide a token symbol from a limited set (e.g., 'USDT') or any token address.
"USDT"
"0xdAC17F958D2ee523a2206206994597C13D831ec7"
Human-readable amount of token_in to swap (token units, not wei).
x > 01.5
The owner's wallet address.
Target blockchain network where the swap will execute.
base, ethereum, arbitrum Action type identifier for swap operations.
"V2_SWAP"Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%).
0.5
Optionally request gas sponsorship. If true, EIP-712 typed data will be returned that must be signed by the owner and submitted to the 'Prepare gas-sponsored transaction' endpoint (/gas_sponsorship/prepare).