Skip to main content

Introduction

The Fibrous Router API is a cutting-edge discovery and routing algorithm that offers asset exchanges at the best rates on the market. Our API finds the most efficient paths for token swaps, capable of splitting between different protocols and even different market depths within one protocol in the shortest possible time.

Supported Networks

Fibrous Finance API is available on multiple blockchain networks:
  • Starknet - Cairo-based Layer 2 with batch operations support
  • Base - Optimistic rollup on Ethereum with low fees
  • HyperEVM - High-performance EVM chain with ultra-fast execution
  • Scroll - zkEVM Layer 2 solution with zero-knowledge proofs
  • Monad - High-performance Layer 1 with parallel execution
For detailed network information, see Supported Chains.

Core Endpoints

All networks (except Starknet) share the same endpoint structure:
Starknet has a different architecture and additional capabilities. See Starknet API for details.

Quick Start

Here’s a complete example of how to perform a swap:
1

Get the optimal route

curl -X GET "https://api.fibrous.finance/base/route" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": "1000000000000000000",
    "tokenInAddress": "0x0000000000000000000000000000000000000000",
    "tokenOutAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "slippage": 0.5
  }'
2

Execute the swap

curl -X POST "https://api.fibrous.finance/base/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "route": { ... },
    "slippage": 0.5,
    "destination": "0xYourAddress"
  }'
3

Send the transaction

Use the returned calldata to send a transaction using your preferred Web3 library.

Base URL

https://api.fibrous.finance
All endpoints follow the pattern: /{network}/{endpoint} Examples:
  • https://api.fibrous.finance/base/route
  • https://api.fibrous.finance/hyperevm/execute
  • https://api.fibrous.finance/scroll/calldata
  • https://api.fibrous.finance/starknet/route

Authentication

No authentication is required to use the Fibrous Router API. However, rate limits apply to ensure fair usage.

Rate Limits

Learn about API rate limits and best practices

Key Features

Fibrous aggregates liquidity from multiple DEX protocols on each network, finding the best possible route for your swap.
Large swaps can be split across multiple protocols and pools to minimize price impact and maximize output.
Routes are calculated in real-time based on current liquidity and prices across all integrated protocols.
Our routing algorithm considers gas costs to ensure the best net outcome for your swap.
Set custom slippage tolerance to protect against unfavorable price movements during execution.

Response Format

All API responses follow a consistent JSON format:
{
  "success": true,
  "data": {
    // Endpoint-specific data
  },
  "timestamp": 1699564800
}
Error responses include detailed information:
{
  "success": false,
  "error": {
    "code": "INSUFFICIENT_LIQUIDITY",
    "message": "Not enough liquidity available for this swap amount",
    "details": {}
  },
  "timestamp": 1699564800
}

Best Practices

Fresh Routes

Always fetch a new route before executing. Routes can become stale within 30-60 seconds.

Appropriate Slippage

Set slippage based on token volatility and liquidity. Stable pairs: 0.1-0.5%, Volatile: 1-3%

Error Handling

Implement proper error handling and retry logic for production applications.

Gas Estimation

Use the estimated gas from API responses and add a 10-20% buffer for safety.

Need Help?

Next Steps