Skip to main content
GET
/
base
/
route
curl -L \
  "https://api.fibrous.finance/base/route?amount=1000000000000000000&tokenInAddress=0x4200000000000000000000000000000000000006&tokenOutAddress=0x833589fcd6edb6e08f4c7c32d4f71b54bda02913" \
  --header "Accept: */*"
{
  "success": true,
  "inputToken": {
    "name": "Wrapped Ether",
    "address": "0x4200000000000000000000000000000000000006",
    "decimals": 18,
    "price": 4337.55
  },
  "inputAmount": "1000000000000000000",
  "outputToken": {
    "name": "USD Coin",
    "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
    "decimals": 6,
    "price": 0.999796
  },
  "outputAmount": "4303439184",
  "estimatedGasUsed": "347407383168",
  "estimatedGasUsedInUsd": 0.0031034457390210508,
  "route": [
    {
      "percent": "100%",
      "swaps": [
        [
          {
            "protocol": 9,
            "poolName": "PancakeSwap V3",
            "poolAddress": "0x72ab388e2e2f6facef59e3c3fa2c4e29011c2d38",
            "fromTokenAddress": "0x4200000000000000000000000000000000000006",
            "toTokenAddress": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
            "percent": "100%",
            "extraData": {
              "fee": 100
            }
          }
        ]
      ]
    }
  ],
  "time": 0.858,
  "bestQuotesByProtocols": [],
  "initial": true,
  "routeSwapType": 2,
  "meta": {
    "apiVersion": "2.0",
    "timestamp": "2024-01-15T10:30:00.000Z"
  }
}

Endpoint

https://api.fibrous.finance/base/route
Find the optimal trading route through Fibrous’s liquidity pools to maximize output and minimize slippage. This endpoint analyzes multiple protocols, pool depths, and potential paths to deliver the most efficient swap execution for your tokens.

Query Parameters

amount
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 ETH
tokenInAddress
string
required
The address of the input token.Example: "0x4200000000000000000000000000000000000006" for ETH
tokenOutAddress
string
required
The address of the output token.Example: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" for USDC
reverse
boolean
Not supported yet - reserved for future use. Default: false
direct
boolean
If true, only direct routes (single hop) will be considered. Default: false
excludeProtocols
array[number]
Comma-separated list of protocol IDs to exclude from routing (e.g., “1,2,3”). Default: []
integratorAddress
string
Integrator address for fee distribution.
integratorFeePercentageBps
number
Integrator fee percentage in basis points (0-500) maximum 5%. Example: 100 for 1%
integratorSurplusPercentageBps
number
Integrator surplus percentage in basis points (0-5000) maximum 50%. Example: 1000 for 10%

Response

success
boolean
Indicates if the route calculation was successful.
inputToken
object
Details about the input token.
inputAmount
string
Input amount in wei format.
outputToken
object
Details about the output token.
outputAmount
string
The estimated amount of output tokens in wei format.
estimatedGasUsed
string
Estimated gas cost for the swap in wei.
estimatedGasUsedInUsd
number
Estimated gas cost in USD.
time
number
Timestamp of route calculation.
bestQuotesByProtocols
array[string]
Best quotes by protocols.
initial
boolean
Whether this is an initial route.
routeSwapType
number
Route swap type.
integratorAddress
string
Integrator address.
integratorFeePercentage
number
Integrator fee percentage in basis points (0-500) maximum 5%.
integratorSurplusPercentage
number
Integrator surplus percentage in basis points (0-5000) maximum 50%.
meta
object
API metadata including version and response timestamp.
route
array
Array of route segments with detailed swap information.
curl -L \
  "https://api.fibrous.finance/base/route?amount=1000000000000000000&tokenInAddress=0x4200000000000000000000000000000000000006&tokenOutAddress=0x833589fcd6edb6e08f4c7c32d4f71b54bda02913" \
  --header "Accept: */*"
{
  "success": true,
  "inputToken": {
    "name": "Wrapped Ether",
    "address": "0x4200000000000000000000000000000000000006",
    "decimals": 18,
    "price": 4337.55
  },
  "inputAmount": "1000000000000000000",
  "outputToken": {
    "name": "USD Coin",
    "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
    "decimals": 6,
    "price": 0.999796
  },
  "outputAmount": "4303439184",
  "estimatedGasUsed": "347407383168",
  "estimatedGasUsedInUsd": 0.0031034457390210508,
  "route": [
    {
      "percent": "100%",
      "swaps": [
        [
          {
            "protocol": 9,
            "poolName": "PancakeSwap V3",
            "poolAddress": "0x72ab388e2e2f6facef59e3c3fa2c4e29011c2d38",
            "fromTokenAddress": "0x4200000000000000000000000000000000000006",
            "toTokenAddress": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
            "percent": "100%",
            "extraData": {
              "fee": 100
            }
          }
        ]
      ]
    }
  ],
  "time": 0.858,
  "bestQuotesByProtocols": [],
  "initial": true,
  "routeSwapType": 2,
  "meta": {
    "apiVersion": "2.0",
    "timestamp": "2024-01-15T10:30:00.000Z"
  }
}