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
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
The amount of input tokens in wei format. For tokens with 18 decimals, multiply the amount by 10^18. Example: "1000000000000000000" for 1 token
The address of the input token. Example: "0x0000000000000000000000000000000000000000" for native token
The address of the output token. Example: "0x3bd359c1119da7da1d913d1c4d2b7c461115433a" for wrapped token
Not supported yet - reserved for future use.
Default: false
If true, only direct swaps between the input and output tokens will be considered.
Default: false
Comma-separated list of protocol IDs to exclude from routing (e.g., “1,2,3”).
Default: ""
Integrator wallet address to receive fees or surplus. Requires API key authentication.
integratorFeePercentageBps
Integrator fee percentage in basis points (0-500, maximum 5%).
Cannot be used together with integratorSurplusPercentageBps.
integratorSurplusPercentageBps
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
Indicates if the request was successful.
Type of swap route (0: ETH to Token, 1: Token to ETH, 2: Token to Token).
Details about the input token. The token’s contract address
Number of decimals the token uses
Current price of the token in USD
The input amount in wei format.
Details about the output token (same structure as inputToken).
The estimated amount of output tokens in wei format.
The output amount after integrator fee deduction (if integrator fee is used).
Estimated gas cost for the swap in wei.
Estimated gas cost in USD.
Array of route segments with detailed swap information. Percentage of input amount going through this route
Array of swap steps in this route segment Name of the liquidity pool
Address of the liquidity pool
Percentage of the segment amount through this pool
Protocol-specific parameters
Integrator address (if provided).
integratorFeePercentageBps
Integrator fee percentage in basis points (if applicable).
integratorSurplusPercentageBps
Integrator surplus percentage in basis points (if applicable).
Integrator name from API key (if applicable).
API metadata including version and timestamp. API version (e.g., “2.0”)
Response timestamp in ISO 8601 format
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
Feature V1 V2 Meta field ❌ ✅ Always present Integrator support ❌ ✅ With API key outputAmountAfterFee ❌ ✅ When fee is used API version tracking ❌ ✅ In meta field
Best Practices
Always check meta.apiVersion to ensure you’re using the expected API version
Use API keys for production integrations to access integrator features
Monitor meta.timestamp for debugging and tracking response times
Handle outputAmountAfterFee when using integrator fees to show accurate amounts to users