Create a plan to swap one asset for another
| Parameter | Type | Description |
|---|---|---|
account_id | string | The sub-account ID |
| Parameter | Type | Required | Description |
|---|---|---|---|
sell_asset | string | Yes | Asset to sell (e.g., "USDC") |
buy_asset | string | Yes | Asset to buy (e.g., "WETH") |
network | string | Yes | Target network (e.g., "base", "mainnet"). Funds on other chains are bridged automatically. |
sell_amount | string | One of | Amount to sell in the asset’s smallest unit |
buy_amount | string | One of | Amount to buy in the asset’s smallest unit |
sell_amount or buy_amount must be provided.
| Field | Type | Description |
|---|---|---|
plan_id | string | Unique identifier for this plan (pln_ prefix) |
details | object | Transaction details including EIP-712 signing data |
details.eip712_data.digest | string | The hash to sign with the account’s signer key |
expires_at | string | ISO 8601 timestamp — plan must be executed before this time |
| Status | Code | Description |
|---|---|---|
| 400 | invalid_params | Missing required parameters or both sell_amount and buy_amount provided |
| 400 | plan_failed | Could not generate a valid plan (e.g., insufficient balance) |
| 400 | no_wallet | Account has no wallets |
| 408 | timeout | Folio computation timed out |
| 422 | swap_quote_failed | Could not fetch a swap quote from the DEX aggregator |
sell_amount or buy_amount. If sell_amount is given, the API finds the best quote for selling that exact amount. If buy_amount is given, it finds a quote to buy that exact amount.