Overview
The Calldata endpoint combines the functionality of both/route and /execute endpoints, providing an optimized way to get transaction calldata in a single API call. This is ideal for applications that want to minimize API calls and latency.
Supported Networks
- Base
- HyperEVM
- Scroll
- Starknet
Request Body Parameters
The amount of input tokens in wei format.Example:
"1000000000000000000" for 1 token with 18 decimalsThe contract address of the input token.
The contract address of the output token.
Maximum acceptable slippage in percentage (0.1 to 100).
The destination address to receive the output tokens.
Array of protocol IDs to exclude from routing.
If true, only direct swaps will be considered.
Response
This endpoint combines the route and execute responses:Indicates if the route was successfully found
Complete route information (same as /route endpoint)
Swap parameters for execution
The encoded transaction calldata ready for execution
The Fibrous Router contract address
The amount of native token to send with the transaction
Example Request
Example Response
When to Use This Endpoint
Use Calldata
- Single-step swap execution
- Minimizing API calls
- Reducing latency
- Simple integrations
Use Route + Execute
- Need to display route preview
- User confirmation required
- Complex routing logic
- Custom route manipulation
Best Practices
-
Token Approvals
- Check token allowance before calling
- Approve Fibrous Router to spend tokens
- Not needed for native token swaps
-
Transaction Execution
- Use the exact
to,calldata, andvaluefrom response - Set appropriate gas limit (use
estimatedGas+ buffer) - Monitor transaction status after submission
- Use the exact
-
Error Handling
- Implement retry logic for failed requests
- Handle insufficient liquidity gracefully
- Validate addresses before calling
Complete Integration Example
Network-Specific Router Addresses
- Base
- HyperEVM
- Scroll
- Starknet
Router addresses are always included in the API response. No need to hardcode them in your application.
Related Endpoints
- Get Route - Get route without execution data
- Execute Swap - Execute with existing route
- Health Check - Check API status