Overview
The Execute endpoint generates the necessary transaction data to execute a token swap using a previously obtained route. This endpoint is available across all supported networks.Supported Networks
- Base
- HyperEVM
- Scroll
- Starknet
Request Body Parameters
The route object returned from the
/route endpoint. This contains all necessary information about the swap path and expected outcomes.Maximum acceptable slippage in percentage (0.1 to 100).Example:
0.5 for 0.5% slippage toleranceThe destination address to receive the output tokens.
Unix timestamp (in seconds) after which the transaction will revert.Defaults to 20 minutes from the current time if not specified.
Response
The executed route details
Swap parameters for every hop in the route
The encoded transaction calldata ready for execution
The Fibrous Router contract address to send the transaction to
The amount of native token to send with the transaction (for native token swaps)
Example Request
Example Response
Best Practices
-
Route Freshness
- Always use a fresh route from the
/routeendpoint - Routes can become stale due to market movements
- Implement retry logic with fresh routes if execution fails
- Always use a fresh route from the
-
Slippage Management
- Set appropriate slippage tolerance based on:
- Token pair volatility
- Available liquidity
- Market conditions
- Higher values increase success rate but may result in worse prices
- Lower values ensure better prices but may cause more failed transactions
- Set appropriate slippage tolerance based on:
-
Deadline Setting
- Set reasonable deadlines to prevent stale transactions
- Consider network congestion when setting deadlines
- Default of 20 minutes is suitable for most cases
-
Gas Optimization
- Monitor gas costs in responses to optimize future transactions
- Consider using direct routes for major pairs
- Batch multiple swaps when possible
Error Responses
Route Expired
Route Expired
Status Code: 400Solution: Fetch a new route and retry the execution.
Insufficient Liquidity
Insufficient Liquidity
Status Code: 400Solution: Reduce the swap amount or try again later.
Invalid Slippage
Invalid Slippage
Status Code: 400Solution: Adjust slippage to be within the valid range.
Network-Specific Notes
- EVM Chains (Base, HyperEVM, Scroll)
- Starknet
- Use standard EVM transaction format
- Native token swaps require sending value with transaction
- Approve token spending before swap if not native token
- Gas estimation included in response
Complete Swap Flow
Related Endpoints
- Get Route - Find optimal route before execution
- Get Calldata - Alternative endpoint combining route and execute
- Health Check - Check API status