Skip to main content
GET

Overview

V2 Available: An enhanced version of this endpoint is available at /{network}/v2/route with integrator support, metadata, and API key features. See Get Route V2 and the V2 Migration Guide.
Route endpoint finds the optimal trading path through Fibrous’ integrated liquidity sources to maximize output and minimize slippage. This endpoint is available across all supported networks.

Supported Networks

Request Parameters

string
required
The amount of input tokens in wei format (for EVM chains) or the smallest unit for the token.Example: "1000000000000000000" for 1 token with 18 decimals
string
required
The contract address of the input token.
Use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE or 0x0000000000000000000000000000000000000000 for native tokens
string
required
The contract address of the output token.
number
default:"0.5"
Maximum acceptable slippage in percentage (0.1 to 100).Example: 0.5 for 0.5% slippage tolerance
string
The destination address to receive the output tokens. If not provided, defaults to the sender address.
string[]
Array of protocol IDs to exclude from routing.
boolean
default:"false"
If true, only direct swaps will be considered (no multi-hop routes).

Response

boolean
Indicates if the route was successfully found
number
Type of swap route (0 = standard)
object
Information about the input token
object
Information about the output token (same structure as inputToken)
string
The amount of input tokens in wei format
string
The expected amount of output tokens in wei format
number
Time taken to calculate the route (in seconds)
string
Estimated gas units for the transaction
number
Estimated gas cost in USD
object[]
Array of route segments showing how the swap is split
boolean
Indicates if this is an initial route calculation

Example Request

Best Practices

  1. Fresh Routes
    • Always fetch a new route before executing a swap
    • Routes can become stale due to market movements
    • Typical validity: 30-60 seconds depending on market volatility
  2. Slippage Settings
    • Stable pairs: 0.1% - 0.5%
    • Volatile pairs: 1% - 3%
    • Low liquidity tokens: 3% - 5%
  3. Gas Optimization
    • Use direct: true for major token pairs
    • Consider gas costs vs. price improvement for small amounts
    • Exclude high-gas protocols when optimizing for speed
  4. Error Handling
    • Implement retry logic with exponential backoff
    • Check for insufficient liquidity errors
    • Validate token addresses before calling

Network-Specific Notes

  • Native token: ETH
  • Common tokens: USDC, USDbC, WETH, DAI
  • Average block time: ~2 seconds
  • Native token: HYPE
  • Common tokens: USDC, WHYPE
  • Average block time: ~2 seconds
  • Native token: cBTC
  • Common tokens: wcBTC, USDC.e
  • Average block time: TBD
  • Bitcoin’s first ZK rollup with EVM compatibility