Multi-Fee Support

View as Markdown

The Swap and Gasless APIs support collecting fees for multiple recipients in a single transaction. This is useful for use cases like revenue sharing between a protocol and a frontend, splitting fees between partners, or distributing fees across multiple treasury addresses — all without requiring multiple transactions or custom contracts.

Overview

Both swapFeeRecipient and swapFeeBps accept comma-separated lists, allowing you to define multiple fee recipients, each with their own fee rate.

Each fee is:

  • Collected in the swapFeeToken (the buy token by default)
  • Delivered directly to the specified recipient address
  • Reported individually in the response under fees.integratorFees

Parameters

swapFeeRecipient
string

The wallet address(es) to receive trading fees. Accepts a single address or multiple comma-separated addresses.

Example: 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045,0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359

When providing multiple values, the list must be the same length as swapFeeBps. You must also specify swapFeeBps to use this parameter.

swapFeeBps
string

The fee amount(s) in basis points (Bps) to charge per recipient. Accepts a single value or multiple comma-separated values.

Example: 5,10

When providing multiple values, the list must be the same length as swapFeeRecipient. The default maximum is 1000 Bps per recipient. Contact us if your integration requires a higher limit.

swapFeeRecipient and swapFeeBps are co-dependent — you must specify both together. When using multiple fees, both lists must be the same length and positionally matched (index 0 of swapFeeBps applies to index 0 of swapFeeRecipient, and so on).

Example Request

The following examples split fees between two recipient addresses — 5 Bps to 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 and 10 Bps to 0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359.

$curl "https://api.0x.org/swap/allowance-holder/price\
>?chainId=1\
>&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7\
>&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\
>&sellAmount=100000000\
>&taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e\
>&swapFeeRecipient=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045,0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359\
>&swapFeeBps=5,10" \
>-H "0x-api-key: <YOUR_API_KEY>"

Example Response

When multiple fees are configured, the response includes both the legacy integratorFee field (containing the first fee, for backwards compatibility) and the new integratorFees array (containing all fees):

1{
2 "fees": {
3 "integratorFee": {
4 "amount": "49989",
5 "token": "0xdac17f958d2ee523a2206206994597c13d831ec7",
6 "type": "volume"
7 },
8 "integratorFees": [
9 {
10 "amount": "49989",
11 "token": "0xdac17f958d2ee523a2206206994597c13d831ec7",
12 "type": "volume"
13 },
14 {
15 "amount": "99978",
16 "token": "0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359",
17 "type": "volume"
18 }
19 ],
20 "zeroExFee": {
21 "amount": "149968",
22 "token": "0xdac17f958d2ee523a2206206994597c13d831ec7",
23 "type": "volume"
24 },
25 "gasFee": null
26 }
27}

fees.integratorFee is retained for backwards compatibility and always reflects the first fee in the list. Use fees.integratorFees to access the full breakdown of all fees.

Each entry in integratorFees corresponds positionally to the swapFeeRecipient and swapFeeBps values in your request:

IndexRecipientFee (Bps)Amount (in buy token)
00xdac17f958d2ee523a2206206994597c13d831ec7549,989
10xfb6916095ca1df60bb79ce92ce3ea74c37c5d3591099,978