Build swap transaction
build_swapBuild an unsigned swap transaction for the taker wallet to sign and submit, returning the transaction, quote, and signed receipt, with optional token safety screening.
Instructions
Build an unsigned swap transaction for the taker wallet to sign and submit. Costs an x402 toll (paid automatically when TOLLBOOTH_PAYER_KEY is set). Returns the transaction, the quote, and a signed receipt.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | Yes | Chain to swap on | |
| taker | Yes | Wallet address that will sign and send the swap | |
| amount | Yes | Sell amount as an integer string in the input token's base units | |
| safeMode | No | Screen both tokens first; refuses the build if either is critical-risk (honeypot etc.) | |
| inputToken | Yes | Token being sold: mint address (solana) or ERC-20 address (EVM chains) | |
| outputToken | Yes | Token being bought: mint address (solana) or ERC-20 address (EVM chains) | |
| slippageBps | No | Max slippage in bps (default 100) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| next | No | Suggested follow-up calls | |
| chain | No | ||
| error | No | Present when the request failed or payment is required | |
| quote | No | Quote the transaction was built from | |
| safety | No | Safety reports when safeMode was requested | |
| accepts | No | x402 payment options when unpaid | |
| receipt | No | Signed receipt for this build | |
| transaction | No | Unsigned transaction for the taker to sign |