Skip to main content

API Monetization

Odos API V3 enables flexible monetization strategies by allowing partners to specify custom fees and recipient addresses directly in API requests. This off-chain approach eliminates the need for onchain registration and provides greater flexibility for monetization strategies.

Odos supports 2 monetization configurations:

  • Static fee structure and recipient address on all chains. This can be configured by the Odos team.
  • Delegating fees and recipient address in the quote request body. Instructions are outlined below.

Fee Delegation Parameters

When making requests to the Odos API, you can include the following parameters to delegate fees and specify where they should be sent:

partnerFeePercent

The fee percentage to be applied to the swap. This is specified as a decimal value (e.g., 0.001 for 0.1% or 10 basis points).

  • Type: number (float)
  • Required: No
  • Example: 0.001 (0.1% fee)

feeRecipient

The address that will receive the delegated fee. This must be a valid checksummed Ethereum address.

  • Type: string (address)
  • Required: No (required if partnerFeePercent is specified)
  • Format: Checksummed Ethereum address (e.g., 0x...)

Revenue Split

When you specify a fee using these parameters:

  • 80% of the fee is sent to your specified feeRecipient address
  • 20% is retained by Odos as protocol revenue

This revenue split applies automatically when fees are delegated through the API.


Usage Example

These parameters can be included in your quote requests to enable monetization:

import 'dotenv/config';
import fetch from 'node-fetch';

const quoteUrl = 'https://enterprise-api.odos.xyz/sor/quote/v3';

const quoteRequestBody = {
chainId: 8453,
inputTokens: [
{
tokenAddress: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
amount: '10000000'
}
],
outputTokens: [
{
tokenAddress: '0xca73ed1815e5915489570014e024b7EbE65dE679',
proportion: 1
}
],
userAddr: '0x...',
slippageLimitPercent: 0.3,
partnerFeePercent: 0.001, // 0.1% fee
feeRecipient: '0x...', // Your recipient address
compact: true
};

const response = await fetch(quoteUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': process.env.ODOS_API_KEY
},
body: JSON.stringify(quoteRequestBody)
});

const quote = await response.json();
console.log(quote);

Benefits of API V3 Monetization

Flexible Monetization Strategies

Unlike the previous on-chain registration system, API V3 allows you to:

  • Set different fees for different token pairs
  • Specify different fee recipients for different scenarios
  • Adjust monetization strategies without on-chain transactions
  • Use chain-agnostic referral management

No On-Chain Registration Required

With API V3, you no longer need to:

  • Register referral codes on each chain
  • Make on-chain transactions to set up monetization
  • Maintain separate configurations per chain

Simply include the parameters in your API requests to enable monetization.


Important Notes

  • The feeRecipient parameter is required when partnerFeePercent is specified
  • Fees are deducted from the output tokens of the swap
  • The fee percentage should be specified as a decimal (e.g., 0.001 for 0.1%)
  • Addresses must be checksummed (EIP-55 format)
  • This feature is only available for API V3 endpoints

Need Help?

  • For a deeper dive, the API Endpoints page provides extensive documentation on all available endpoints
  • Join the Odos Discord Community to connect with other developers and our team