Build Transaction
POST /api/v1/swap builds a complete unsigned Solana transaction for a token swap. Sign it with the user’s wallet and submit to the network.
Request
User’s wallet address (base58). This wallet signs and pays for the transaction.
Input token mint address.
Output token mint address.
Amount in smallest token units.
ExactIn or ExactOut.Slippage tolerance in basis points. Default: 50 (0.5%).
Skip transaction simulation. Faster but no pre-flight validation. Only set
true if you handle validation yourself.Example
Response
Response fields
Base64-encoded unsigned transaction. Deserialize, sign, and submit.
Transaction expires after this block height (~60 seconds from creation).
Input amount in smallest units.
Estimated output amount in smallest units.
Minimum output after slippage (
ExactIn only). Transaction reverts if actual output is less.Maximum input after slippage (
ExactOut only). Transaction reverts if actual input exceeds this.Aggregator fee in output token units.
Simulation result (omitted if
skipSimulation: true).Estimated compute units for execution.
Token path from input to output.
Number of swap hops.
Pool addresses used, in execution order.
Whether liquidity is split across multiple pools.
Percentage split per pool (only if
isSplitRoute is true).Simulation
By default, the API simulates the transaction before returning it. This catches common issues early:simulation field | Meaning | What to do |
|---|---|---|
insufficientFunds: true | Wallet doesn’t have enough tokens or SOL for fees | Show balance error to user |
slippageExceeded: true | Price changed between quote and transaction build | Retry with a fresh quote |
success: false + error | Other simulation failure | Check logs for details |
skipSimulation: true only if you need lower latency and handle validation yourself.