Skip to main content
GET
Important: If integrator fees are used (integratorFeePercentageBps > 0), the min_received value in the calldata response will be the amount after fees have been deducted and slippage has been applied. This ensures the minimum received amount accounts for the integrator fee that will be taken from the output.

Overview

The Route and Calldata V2 endpoint combines route finding and calldata generation in a single request, reducing API calls and latency. This is a V2-only endpoint that provides enhanced features including integrator support and metadata. Currently available on EVM networks.
This endpoint is V2-only and currently available on EVM networks. For V1, use separate /route and /calldata endpoints.

Endpoint

Find the optimal trading route through Fibrous’ integrated liquidity sources and generate the transaction calldata for executing the swap. This endpoint combines route finding with calldata generation, making it ideal for direct integration with smart contracts.

Query Parameters

string
required
The amount of input tokens in wei format. For tokens with 18 decimals, multiply the amount by 10^18.Example: "1000000000000000000" for 1 token
string
required
The address of the input token.Example: "0x0000000000000000000000000000000000000000" for native token
string
required
The address of the output token.Example: "0x3bd359c1119da7da1d913d1c4d2b7c461115433a" for wrapped token
boolean
Not supported yet - reserved for future use. Default: false
boolean
If true, only direct swaps between the input and output tokens will be considered. Default: false
string
Comma-separated list of protocol IDs to exclude from routing (e.g., “1,2,3”). Default: ""
number
required
Maximum acceptable slippage percentage (0-49, e.g., 0.5 for 0.5%).
string
required
Recipient address for the output tokens.
string
Integrator wallet address to receive fees or surplus. Requires API key authentication.
number
Integrator fee percentage in basis points (0-500, maximum 5%). Cannot be used together with integratorSurplusPercentageBps.
number
Integrator surplus percentage in basis points (0-5000, maximum 50%). Cannot be used together with integratorFeePercentageBps.
API Key Required: Integrator features (integratorAddress, integratorFeePercentageBps or integratorSurplusPercentageBps) require an API key. Generate and manage your API keys at the Fibrous Partnership Portal. Include the API key in the request headers as X-API-Key.

Response

object
The complete route response object (same structure as /v2/route endpoint).
object
Transaction calldata for executing the swap.
string
Router contract address for executing the swap.
object
required
API metadata including version and timestamp.

When to Use This Endpoint

Use This Endpoint

  • Single-step swap execution
  • Minimizing API calls
  • Reducing latency
  • Simple integrations
  • Immediate execution needed

Use Separate Endpoints

  • Need to display route preview
  • User confirmation required
  • Complex routing logic
  • Custom route manipulation
  • Two-step flow preferred

Benefits Over V1 Approach

V1 (2 API calls):
  1. GET /route - Get optimal route
  2. GET /calldata - Generate calldata from route
V2 (1 API call):
  1. GET /v2/routeAndCalldata - Get route and calldata together
This reduces:
  • API latency (one round trip instead of two)
  • API call count (50% reduction)
  • Code complexity (single request handling)

Best Practices

  1. Verify min_received - Always check that the minimum received amount matches your expectations. Note that if integrator fees are used, min_received already accounts for the fee deduction.
  2. Check destination - Ensure the destination address is correct before executing
  3. Use fresh data - This endpoint provides fresh route and calldata, ideal for immediate execution
  4. Monitor meta.timestamp - Track when the response was generated for debugging