POST /v1/build takes a quote_id from a previous Quote response and assembles an unsigned transaction ready for wallet signing and on-chain submission. This is the second step in the swap flow.
New to the API? Start with Getting Started for authentication and your first quote request.
Attach a Permit2 signature for gasless token approval. The signature comes from signing the permit2.eip712 typed data returned in the quote response (when requested with include_permit2=true):
The permit2_signature is silently ignored if the original quote was not requested with include_permit2=true.
Build with Simulation
Run a fork simulation on the assembled transaction before returning. The simulation verifies the transaction will succeed and reports actual output amounts:
Simulation failures do not block the response -- the transaction is still returned with simulation.success=false and an error message.
Request Fields
Field
Type
Required
Default
Description
quote_id
string
Yes
--
Quote identifier from a previous /v1/quote response.
permit2_signature
string
No
--
Hex-encoded Permit2 signature from signing the EIP-712 typed data in the quote's permit2 field.
simulate
boolean
No
false
Run fork simulation on the assembled transaction.
Quotes can be built multiple times -- building does not consume or invalidate the quote.
ETH value to send in wei (decimal string). "0" for ERC-20 only swaps.
gas
integer
Recommended gas limit for the transaction.
chain_id
integer
Target blockchain network ID.
estimated_outputs
Carried forward from the quote. Same structure as the Quote response.
simulation
Only present when simulate=true. Fork simulation result:
Field
Type
Description
success
boolean
Whether the simulation succeeded.
gas_used
integer
Actual gas consumed in simulation. Only present on success.
output_amounts
object
Map of token addresses to simulated output amounts. Only present on success.
error
string
Error message if simulation failed (e.g., "execution reverted: INSUFFICIENT_OUTPUT_AMOUNT").
Example with simulation:
What to Do Next
After receiving the build response:
Check estimated outputs -- Verify the expected_amount and minimum_amount meet your requirements.
Review simulation results (if requested) -- If simulation.success is false, the transaction is likely to revert on-chain. Check the error field for details.
Sign the transaction -- Use the to, data, value, gas, and chain_id fields to construct and sign the transaction with the taker's wallet.
Submit on-chain -- Broadcast the signed transaction to the network. The transaction executes atomically through the ExecutionProxy contract -- all swaps succeed or the entire transaction reverts.
Handle ERC-20 approvals -- If the quote response included approvals, ensure the taker has approved the specified tokens and amounts for the spender address before submitting the transaction. Alternatively, use Permit2 to handle approvals via signature.