Portals Logo

Execute Swaps and Zaps


The Portal endpoints allow you to take advantage of transaction bundling and any-to-any swaps via a simple API interface. The response includes an EIP-712 Signed Order (intent) and a valid unsigned transaction that can be submitted to a node by an externally owned account (EOA) or consumed in a smart contract. The API handles the assembly of the transaction bundle and will determine the optimal route for the exchange, ensuring the highest possible output and least gas usage, splitting the order if necessary.

In addition, because these endpoints combine both combine swaps and zaps together you can simply re-use the same request type regardless of the complexity of the transaction. This means you can swap tokens, add liquidity, remove liquidity, and even swap and add liquidity in the same transaction. You can also swap between any two tokens, even if there is no direct market between them.

Auto Slippage and Price Impact Protection

The Portal transaction includes robust slippage and price impact protection mechanisms to ensure that the transaction will revert (fail) if the minOutputAmount is not satisfied at the end of the bundle. In addition, in order for the Portal transaction to succeed, all actions included in the bundle must be successful, or the transaction will revert (i.e., a Portal transaction is atomic).

Get Started

  • You can use the estimate endpoint to quickly generate a quote for swapping an inputToken for an outputToken. The response time for this endpoint is much faster than the portal endpoint, as it does not generate a transaction bundle. This can be useful for quickly displaying the output of a Portal for informational purposes.

  • When you're ready to commit to a transaction, use the portal endpoint which generates a tx or signedOrder bundle that can be submitted to carry out the encoded Portal call.

  • If you'd like to take advantage of Gasless swaps and zaps, you can use the Gasless Transactions guide here.