Skip to main content
Configure how fees are collected and distributed when using the 1Click Swap API. As a distribution channel, you can add your own fees on top of the base platform fees.
This guide covers distribution channel fees (fees you collect). For an overview of all platform fees including protocol fees and API fees, see Fees.

Fee Parameters

Include these parameters in the appFees array when requesting a quote: percentage = fee / 10,000 (so fee: 50 is 0.5%). Each fee must be an integer. After 1Click adds its share, the combined total cannot exceed 500 bps (5%). A submitted 480 bps without an API key is rejected (480 + 25 = 505). Public ANY_INPUT quotes cannot include appFees. Set appFees on the user-facing quotes that pay into your aggregation deposit address.

What happens to the fee you send

API key, no fee of your own: 20 bps to 1Click

Omit appFees, or send only fee: 0. 1Click charges 20 bps. USDC, USDT, and DAI pairs, and same-asset transfers across chains, are 1 bp.

API key with appFees: 50/50 split

Your fee is split 50/50 with 1Click. 1Click’s half has a 20 bps minimum (1 bp for USDC, USDT, and DAI pairs and same-asset multichain routes). You keep your half. If 1Click’s half would be under 20, 1Click still takes 20. That means any fee below 40 is charged as your half plus 20. For example, "fee": 5 → 3 bps to you (half of 5, rounded up). 1Click’s half would be 3, which is under 20, so 20 is added. The swap is charged 23. "fee": 21 is the same pattern: 21 is already above 20, but half of 21 is 11, which is still under 20. You get 11, 1Click takes 20, charged 31. "fee": 40 → 20 bps to you, 20 bps to 1Click. Half meets the minimum, so nothing extra is added. This split is the default for authenticated partners. Better fee sharing and custom conditions are available: reach out through the Partner Portal.

No API key: your fee plus 25 bps

Without an API key there is no 50/50 split. You keep the full fee you submit, and 1Click adds 25 bps on top. Omit appFees or send fee: 0, and the swap is still charged 25 bps, all to 1Click. For example, "fee": 50 → 50 bps to you and 25 bps to 1Click (75 charged). "fee": 5 → 5 to you and 25 to 1Click (30 charged).

How Fees Are Applied

The formulas below use the combined fee in basis points: your share plus 1Click’s share, after any split or automatic add. Fees are calculated differently depending on the swap type:
For EXACT_INPUT swaps, the fee is deducted from your input amount before the swap:
  1. net_in = amount_in * (1 - p) where p = fee / 10,000
  2. The quote calculates amount_out from net_in
  3. fee_amount = amount_in - net_in (deducted in input token)
Example:
  • Input: amount_in = 1,000,000, fee = 100 (1%)
  • Calculation: net_in = 1,000,000 * (1 - 0.01) = 990,000
  • User deposits 1,000,000 and quote calculates output from 990,000
  • Fee: 10,000 units (in input token)


Fee Aggregation

For high-volume integrations that collect fees in many different tokens, the ANY_INPUT swap type aggregates them all into a single destination asset and withdraws automatically.
To compare ANY_INPUT with the other swap types, see the Swap Types page.

How it works

  • Deposits in any supported token are sent to one dedicated depositAddress and accumulate there.
  • A background job continuously swaps everything to your chosen destinationAsset and withdraws it to recipient once the pool reaches $1,000 USD.
  • The deadline is checked only when the quote is created — after that the quote runs indefinitely, so a single quote keeps collecting and withdrawing without being refreshed.
  • Failed swaps retry every 5 minutes.
No refunds. If a swap fails it retries automatically rather than returning funds — set refundTo to an address you control as a safety measure.

Set it up

Every request must include an Authorization: Bearer YOUR_JWT_TOKEN header to receive the quote and its depositAddress. Get your API key from the Partner Dashboard. Public ANY_INPUT quote requests cannot contain appFees.
1

Create an ANY_INPUT quote

Request a quote with originAsset: "1cs_v1:any" and amount: "0" to get a dedicated depositAddress for fee collection.
Set quoteWaitingTimeMs to 5000–10000ms for optimal performance (3–4s is often enough).
2

Wire the deposit address into your fees

Use the depositAddress from the quote response as the appFees.recipient in your user quotes (see Fee Parameters). Collected fees now flow to the aggregation address and convert automatically.

Track withdrawals

Use the /v0/any-input/withdrawals endpoint to retrieve withdrawal records for your deposit address. Request:
Records are filtered by depositAddress and sorted by timestamp (newest first). Page through results with these query parameters: Response:
Response Fields: