Skip to main content

Overview

Fibrous Router API V2 introduces enhanced features and improved response structure while maintaining backward compatibility with V1 endpoints. This guide will help you migrate your integration to take advantage of V2 features.

Quick Reference: Endpoint Mapping

Important: V2 endpoint names have changed to better reflect their functionality. Pay special attention to these mappings:
Key Changes:
  • V1 /calldataV2 /routeAndCalldata: Endpoint renamed for clarity (still GET, still returns route + calldata)
  • V1 /executeV2 /calldata: Endpoint renamed for clarity (still POST, still generates calldata from route)

What’s New in V2

Integrator Features

Support for integrator fees and surplus sharing to monetize your integration

Enhanced Metadata

All responses include API version and timestamp for better tracking

Endpoint Reorganization

Endpoints renamed for clarity: /calldata/routeAndCalldata, /execute/calldata

Improved Structure

Better organized response format with consistent meta fields

Key Differences

Response Structure

V1 Response:
V2 Response:

Endpoint Mapping

V2 API reorganizes endpoint names for better clarity. Here’s how V2 endpoints map to V1:
Important: The V2 endpoint names better reflect their functionality:
  • routeAndCalldata (V2) replaces calldata (V1) - combines route finding and calldata generation
  • calldata (V2) replaces execute (V1) - generates calldata from a pre-calculated route

Integrator Features

V2 supports monetization through integrator fees or surplus sharing:
  • Integrator Fee: Charge a percentage (0-5%) on swaps routed through your integration
  • Integrator Surplus: Share in surplus value (0-50%) when routing finds better prices
  • Note: You cannot use both fee and surplus in the same request
API Key Required: Integrator features require an API key from Fibrous. Generate and manage your API keys at the Fibrous Partnership Portal.

Migration Steps

Step 1: Update Base URL

Change your base URL from:
To:

Step 2: Handle Meta Field

All V2 responses include a meta field. Update your response handling:

Step 3: Update Route Endpoint

V1:
V2:
Optional integrator parameters:

Step 4: Update Calldata Endpoint (V1 → routeAndCalldata V2)

Important: V1’s /calldata endpoint is now /routeAndCalldata in V2. V1 /calldata endpoint:
V2 /routeAndCalldata endpoint:
Migration Note: If you were using V1’s /calldata endpoint, update your code to use /v2/routeAndCalldata. The functionality is the same - it gets route and calldata in one request.

Step 5: Update Execute Endpoint (V1 → calldata V2)

Important: V1’s /execute endpoint is now /calldata in V2. V1 /execute endpoint:
V2 /calldata endpoint:
Migration Note: If you were using V1’s /execute endpoint, update your code to use /v2/calldata. The functionality is the same - it generates calldata from a pre-calculated route.

Step 6: Handle Integrator Features (Optional)

API Key Required: To use integrator features, you must first obtain an API key from Fibrous. Generate and manage your API keys at the Fibrous Partnership Portal.
If you want to monetize your integration:

Parameter Changes

New Optional Parameters

All V2 endpoints support these optional integrator parameters:
API Key Required: Integrator parameters require an API key from Fibrous. Generate and manage your API keys at the Fibrous Partnership Portal.You cannot use both integratorFeePercentageBps and integratorSurplusPercentageBps in the same request.

Response Field Changes

Code Examples

Complete Migration Example

With Integrator Features

Backward Compatibility

V1 endpoints remain available and fully functional. You can migrate at your own pace without breaking existing integrations.
  • V1 endpoints: https://api.fibrous.finance/{network}/*
  • V2 endpoints: https://api.fibrous.finance/{network}/v2/*
Both versions will continue to be supported, but we recommend migrating to V2 to take advantage of new features.

Testing Your Migration

  1. Test with small amounts first
    • Verify responses match expected format
    • Check that meta fields are present
    • Validate integrator features if used
  2. Monitor API version in responses
    • Log meta.apiVersion to ensure you’re using V2
    • Track meta.timestamp for debugging
  3. Verify integrator features
    • Test with API key authentication
    • Verify fee calculations
    • Check outputAmountAfterFee values

Common Issues

Issue: Missing Meta Field

Problem: Response doesn’t include meta field Solution: Ensure you’re using /{network}/v2/* endpoints, not /{network}/*

Issue: Integrator Features Not Working

Problem: Integrator parameters are ignored Solution:
  • Obtain an API key: Generate and manage your API keys at the Fibrous Partnership Portal
  • Verify API key is included in request headers as X-API-Key
  • Check that integrator address is valid
  • Ensure only one of fee or surplus is set

Issue: Route and Calldata Endpoint Returns 404

Problem: /{network}/v2/routeAndCalldata not found Solution: This endpoint is V2-only. Use /{network}/v2/routeAndCalldata (not /{network}/routeAndCalldata) Note: If you were using V1’s /calldata endpoint, remember it’s now /v2/routeAndCalldata in V2.

Issue: Endpoint Name Confusion

Problem: Confused about which V2 endpoint to use Solution: Use this mapping guide: Key Points:
  • V1’s /calldata → V2’s /routeAndCalldata (GET request, gets route and calldata together)
  • V1’s /execute → V2’s /calldata (POST request, generates calldata from route)

Next Steps

Support

If you encounter issues during migration: