Skip to main content
GET
/
{network}
/
v2
/
route
{
  "success": true,
  "routeSwapType": 123,
  "inputToken": {
    "name": "<string>",
    "address": "<string>",
    "decimals": 123,
    "price": 123
  },
  "inputAmount": "<string>",
  "outputToken": {},
  "outputAmount": "<string>",
  "outputAmountAfterFee": "<string>",
  "estimatedGasUsed": "<string>",
  "estimatedGasUsedInUsd": 123,
  "route": [
    {
      "percent": "<string>",
      "swaps": [
        {
          "protocol": 123,
          "poolName": "<string>",
          "poolAddress": "<string>",
          "percent": "<string>",
          "extraData": {}
        }
      ]
    }
  ],
  "integratorAddress": "<string>",
  "integratorFeePercentageBps": 123,
  "integratorSurplusPercentageBps": 123,
  "integratorName": "<string>",
  "meta": {
    "apiVersion": "<string>",
    "timestamp": "<string>"
  }
}

Overview

The Route V2 endpoint provides the same routing functionality as V1, with additional features including integrator support, enhanced metadata, and improved response structure. Currently available on Evm networks.
V2 API is currently available on Evm networks. V1 endpoints remain available for backward compatibility.

Endpoint

  • Evm networks
https://api.fibrous.finance/{network}/v2/route
Find the optimal trading route through Fibrous Finance’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.

What’s New in V2

Integrator Support

Monetize your integration with fees or surplus sharing

Enhanced Metadata

All responses include API version and timestamp

Better Tracking

Track output amounts before and after fees

API Key Support

Use API keys for higher rate limits and integrator features

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 token
tokenInAddress
string
required
The address of the input token.Example: "0x0000000000000000000000000000000000000000" for native token
tokenOutAddress
string
required
The address of the output token.Example: "0x3bd359c1119da7da1d913d1c4d2b7c461115433a" for wrapped token
reverse
boolean
Not supported yet - reserved for future use. Default: false
direct
boolean
If true, only direct swaps between the input and output tokens will be considered. Default: false
excludeProtocols
string
Comma-separated list of protocol IDs to exclude from routing (e.g., “1,2,3”). Default: ""
integratorAddress
string
Integrator wallet address to receive fees or surplus. Requires API key authentication.
integratorFeePercentageBps
number
Integrator fee percentage in basis points (0-500, maximum 5%). Cannot be used together with integratorSurplusPercentageBps.
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, integratorSurplusPercentageBps) require an API key. Partners must obtain an API key from Fibrous Finance to use these monetization features. Include the API key in the request headers as X-API-Key.

Response

success
boolean
Indicates if the request was successful.
routeSwapType
number
Type of swap route (0: ETH to Token, 1: Token to ETH, 2: Token to Token).
inputToken
object
Details about the input token.
inputAmount
string
The input amount in wei format.
outputToken
object
Details about the output token (same structure as inputToken).
outputAmount
string
The estimated amount of output tokens in wei format.
outputAmountAfterFee
string
The output amount after integrator fee deduction (if integrator fee is used).
estimatedGasUsed
string
Estimated gas cost for the swap in wei.
estimatedGasUsedInUsd
number
Estimated gas cost in USD.
route
array
Array of route segments with detailed swap information.
integratorAddress
string
Integrator address (if provided).
integratorFeePercentageBps
number
Integrator fee percentage in basis points (if applicable).
integratorSurplusPercentageBps
number
Integrator surplus percentage in basis points (if applicable).
integratorName
string
Integrator name from API key (if applicable).
meta
object
required
API metadata including version and timestamp.

Example Request

curl -L \
  "https://api.fibrous.finance/{network}/v2/route?amount=1000000000000000000&tokenInAddress=0x0000000000000000000000000000000000000000&tokenOutAddress=0x3bd359c1119da7da1d913d1c4d2b7c461115433a" \
  --header "Accept: */*"

Example Response

{
  "success": true,
  "routeSwapType": 0,
  "inputToken": {
    "name": "Monad",
    "address": "0x0000000000000000000000000000000000000000",
    "decimals": 18,
    "price": 0
  },
  "inputAmount": "1000000000000000000",
  "outputToken": {
    "name": "Wrapped Monad",
    "address": "0x3bd359c1119da7da1d913d1c4d2b7c461115433a",
    "decimals": 18,
    "price": 0
  },
  "outputAmount": "1000000000000000000",
  "estimatedGasUsed": "0",
  "estimatedGasUsedInUsd": 0,
  "route": [],
  "time": 0,
  "bestQuotesByProtocols": [],
  "initial": false,
  "meta": {
    "apiVersion": "2.0",
    "timestamp": "2024-01-15T10:30:00.000Z"
  }
}

Integrator Features

API Key Required: To use integrator features, partners must obtain an API key from Fibrous Finance. Contact us at [email protected] or join our Discord to request an API key.
To use integrator features, include your API key in the request headers:
const headers = {
  'X-API-Key': 'your-api-key-here'
};

const params = {
  amount: '1000000000000000000',
  tokenInAddress: '0x0000000000000000000000000000000000000000',
  tokenOutAddress: '0x3bd359c1119da7da1d913d1c4d2b7c461115433a',
  integratorAddress: '0xYourWalletAddress',
  integratorFeePercentageBps: 100 // 1% fee
};

const response = await fetch('https://api.fibrous.finance/{network}/v2/route?' + new URLSearchParams(params), {
  headers
});
You cannot use both integratorFeePercentageBps and integratorSurplusPercentageBps in the same request. Choose one monetization method.

Differences from V1

FeatureV1V2
Meta field✅ Always present
Integrator support✅ With API key
outputAmountAfterFee✅ When fee is used
API version tracking✅ In meta field

Best Practices

  1. Always check meta.apiVersion to ensure you’re using the expected API version
  2. Use API keys for production integrations to access integrator features
  3. Monitor meta.timestamp for debugging and tracking response times
  4. Handle outputAmountAfterFee when using integrator fees to show accurate amounts to users