Create Swap
Execute a token swap.
Fully gasless — the user never needs the source chain's native gas token. One unified call handles same-chain swaps, cross-chain swaps, and EVM↔Solana bridges, with bridging built in.
Use ?wait=true&timeout=60 to block until the swap completes instead of receiving a task_id.
Pass agent_id to trade from one of your own strategy wallets instead of the main one. To sell a position, set token_out to the chain's stablecoin. Selling the whole position (99.9% or more of the balance) removes that coin's stop-loss/take-profit orders automatically; a partial sell keeps them on the remaining amount. cancel_conditional_orders acts on token_out's orders, so it does not clear the sold coin's orders.
Request
- Base URLhttps://api.fereai.xyz
- URLhttps://api.fereai.xyz/v1/swap
- Authnone declared
Query parameters
Block until task completes
Seconds to block when wait=true (max 90; the ~100s edge cuts longer waits — use wait=false + poll for longer).
Request body
Example request
{
"amount": "1000000000000000000",
"chain_id_in": 8453,
"chain_id_out": 8453,
"dryrun": false,
"slippage_bps": 50,
"token_in": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"token_out": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
}Response
Successful Response
Example response
{
"message": "Swap task queued successfully",
"notification_stream": "/v1/notifications/stream",
"poll_url": "/v1/tasks/d290f1ee-...",
"status": "queued",
"task_id": "d290f1ee-6c54-4b01-90e6-d701748f0851"
}Changes
No recorded changes to this operation across all 1 revision of this API.