Base API Overview

Welcome to the Base API documentation. Our API provides powerful endpoints for finding optimal trading routes and executing swaps on Base network. ETH addresses accepted by the API are listed below
TokenAddress
ETH0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
ETH0x0000000000000000000000000000000000000000

Base URL

https://api.fibrous.finance/base

Common Concepts

Authentication

No authentication is required for the API endpoints.

Rate Limiting

Please refer to our Rate Limit documentation for details about rate limiting.

Common Token Addresses

Here are some commonly used token addresses on Base:
TokenAddressDecimals
ETH0x000000000000000000000000000000000000000018
USDC0x833589fCD6eDb6E08f4c7C32D4f71b54bdA029136
USDbC0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA6
WETH0x420000000000000000000000000000000000000618
DAI0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb18

Response Codes

CodeDescription
200Success - The request was successful
400Bad Request - Check your request parameters
429Too Many Requests - You’ve hit the rate limit
500Internal Server Error - Something went wrong on our end

Available Endpoints

Route

Find the optimal trading route through Fibrous’ liquidity pools to maximize output and minimize slippage.

Execute

Generate calldata for the Fibrous router contract to execute the swap.

Calldata

Get the calldata for executing the swap transaction.

Best Practices

Slippage Protection

  • Always set a reasonable slippage value (0.1% - 1% for stable pairs)
  • Use higher slippage for volatile pairs or low liquidity tokens
  • Monitor price impact to ensure favorable trades

Gas Optimization

  • Use the direct parameter for simple swaps between major tokens
  • Set excludeProtocols to skip specific protocols if needed
  • Consider batch swaps for multiple transactions

Error Handling

  • Always check the success field in responses
  • Implement proper error handling in your code
  • Monitor transaction status after execution

Quick Start Example

Here’s a complete example of how to perform a swap using our API:
  1. First, get the optimal route:
curl -X GET "https://api.fibrous.finance/base/route" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": "1000000000000000000",  # 1 WETH
    "tokenInAddress": "0x4200000000000000000000000000000000000006",
    "tokenOutAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
  }'
  1. Then, get the execution calldata:
curl -X GET "https://api.fibrous.finance/base/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": "1000000000000000000",
    "tokenInAddress": "0x4200000000000000000000000000000000000006",
    "tokenOutAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "slippage": 0.5,
    "destination": "YOUR_ADDRESS"
  }'
  1. Finally, execute the transaction using the returned calldata with your preferred Web3 library.

Need Help?