Skip to main content
POST
Plan Swap

Plan Swap

Creates a plan to swap one asset for another via DEX aggregation. Legend fetches the best available quote and returns a plan with the swap details. Returns a plan ID and an EIP-712 digest that must be signed to authorize execution.

Request

Path parameters

Body parameters

Exactly one of sell_amount or buy_amount must be provided.

Examples

Sell exact amount

Buy exact amount

Response (201 Created)

Response fields

Errors

Notes

  • Plans expire after 2 minutes. Sign and execute via Execute Plan before expiry.
  • Provide exactly one of 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.
  • A 0.15% Legend fee is applied to the buy side of the quote.