Skip to main content
This guide covers how to include a partner fee in your quote requests. Fee collection works differently depending on which API you use. For business context - fee models, payment terms, and practical considerations - see Monetize.
If you’ve agreed on a flat fee with Bebop, fees are applied automatically. You do not need to pass the fee parameter.

How fees work

Pass fee (in basis points) on any quote request. One basis point is 0.01%, so fee=25 means 0.25%. The fee is deducted from the buy side of the trade - the taker receives slightly less of the buy token. The taker’s sell amount stays the same.
ParameterTypeRangeDescription
feeinteger0-500 (0%-5%)Partner fee in basis points. Deducted from the buy side of the trade.
fee_recipientstring-Wallet address that receives the fee on-chain. Required when fee is set (Aggregation API only).
The two APIs differ in how fees are collected:
Aggregation APIRFQ API
CollectionOn-chain, atomicOff-chain, monthly
Parametersfee + fee_recipientfee
PayoutInstant to your walletMonthly invoice via Bebop
TrackingOn-chain transfersTrade History API

RFQ API

The RFQ API tracks fees off-chain. Pass fee (bps) on the quote request. Fees are converted to the chain’s native token and attributed to your integration via the source parameter.
import httpx

resp = httpx.get(
    "https://api.bebop.xyz/pmm/ethereum/v3/quote",
    params={
        "sell_tokens": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
        "buy_tokens": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
        "sell_amounts": "1000000000000000000",
        "taker_address": "0x2e7E7cc62919eAf4c502dAC34753cFc5A29e9693",
        "fee": 25,  # 0.25%
        "source": "bebop.xyz",
    },
)
quote = resp.json()

# The buyTokens amount already reflects the 25 bps deduction.
print(quote)

Fee reconciliation

Use the Trade History API to monitor trades attributed to your integration at any time. Pass source with your partner identifier and authenticate with your API key. See Authentication for details on auth options. For a complete walkthrough including pagination, see the Trade History quickstart.

Aggregation API

The Aggregation API collects fees atomically as part of the trade transaction. Pass fee (bps) and fee_recipient (your wallet address) on the quote request. The settlement contract transfers the fee directly to the recipient on-chain when the trade settles. There is no reconciliation step - you receive the fee in your wallet with every trade.
import httpx

resp = httpx.get(
    "https://api.bebop.xyz/jam/ethereum/v2/quote",
    params={
        "sell_tokens": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
        "buy_tokens": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
        "sell_amounts": "1000000000000000000",
        "taker_address": "0x2e7E7cc62919eAf4c502dAC34753cFc5A29e9693",
        "fee": 25,  # 0.25%
        "fee_recipient": "0xYourWalletAddress",
    },
)
quote = resp.json()

# The buyAmounts already reflects the 25 bps deduction.
# The fee will be transferred to fee_recipient on settlement.
print(quote)