Skip to main content
POST

Overview

V2 Available: This endpoint maps to /{network}/v2/routeAndCalldata in V2, with integrator support and metadata. See Route and Calldata V2 and the V2 Migration Guide.
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

Request Body Parameters

string
required
The amount of input tokens in wei format.Example: "1000000000000000000" for 1 token with 18 decimals
string
required
The contract address of the input token.
string
required
The contract address of the output token.
number
default:"0.5"
required
Maximum acceptable slippage in percentage (0.1 to 100).
string
required
The destination address to receive the output tokens.
string[]
Array of protocol IDs to exclude from routing.
boolean
default:"false"
If true, only direct swaps will be considered.

Response

This endpoint combines the route and execute responses:
boolean
Indicates if the route was successfully found
object
Complete route information (same as /route endpoint)
object[]
Swap parameters for execution
string
The encoded transaction calldata ready for execution
string
Fibrous Router contract address
string
The amount of native token to send with the transaction

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

  1. Token Approvals
    • Check token allowance before calling
    • Approve Fibrous Router to spend tokens
    • Not needed for native token swaps
  2. Transaction Execution
    • Use the exact to, calldata, and value from response
    • Set appropriate gas limit (use estimatedGas + buffer)
    • Monitor transaction status after submission
  3. Error Handling
    • Implement retry logic for failed requests
    • Handle insufficient liquidity gracefully
    • Validate addresses before calling

Complete Integration Example

Network-Specific Router Addresses

Router addresses are always included in the API response. No need to hardcode them in your application.