Fee Parameters
Include these parameters in theappFees array when requesting a quote:
| Parameter | Type | Description |
|---|---|---|
recipient | string | Any NEAR-supported address (named account like alice.near, implicit account, or EVM-like address) |
fee | number | Fee in basis points. 100 = 1.00%. Fee is charged from the input token. |
- Conversion formula:
percentage = fee / 10,000(e.g.fee: 50equals 0.5% fee) - Constraints: Fee range:
0to500(where500= 5%)
A 50/50 revenue share applies by default — half of the
fee amount goes to your recipient address and half goes to the 1Click protocol address. For example, "fee": 10 means 5 bps to you and 5 bps to 1Click.How Fees Are Applied
Fees are calculated differently depending on the swap type:- EXACT_IN
- EXACT_OUT
- FLEX_INPUT
For EXACT_IN swaps, the fee is deducted from your input amount before the swap:
net_in = amount_in * (1 - p)wherep = fee / 10,000- The quote calculates
amount_outfromnet_in fee_amount = amount_in - net_in(deducted in input token)
- Input:
amount_in = 1,000,000,fee = 100(1%) - Calculation:
net_in = 1,000,000 * (1 - 0.01) = 990,000 - User deposits
1,000,000and quote calculates output from990,000 - Fee:
10,000units (in input token)
Example Quote with Fees
Example Quote with Fees
Fee Aggregation
For high-volume integrations that collect fees in many different tokens, theANY_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
depositAddressand accumulate there. - A background job continuously swaps everything to your chosen
destinationAssetand withdraws it torecipientonce the pool reaches $1,000 USD. - The
deadlineis 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.
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.Create an ANY_INPUT quote
Request a quote with
originAsset: "1cs_v1:any" and amount: "0" to get a dedicated depositAddress for fee collection.Example ANY_INPUT request
Example ANY_INPUT request
| Field | Description |
|---|---|
originAsset | Must be "1cs_v1:any" for fee aggregation |
destinationAsset | Token you want to collect fees in |
recipient | Address where converted fees will be withdrawn |
recipientType | "DESTINATION_CHAIN" or "INTENTS" |
refundTo | Set to an address you control |
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:
depositAddress and sorted by timestamp (newest first). Page through results with these query parameters:
| Parameter | Description |
|---|---|
depositAddress | Required. The deposit address whose withdrawals you’re fetching |
depositMemo | Memo, if the deposit address requires one |
timestampFrom | Only return withdrawals from this ISO timestamp onward |
page | Page number (default 1) |
limit | Records per page (max and default 50) |
sortOrder | asc or desc by timestamp (default desc) |
| Field | Description |
|---|---|
status | Withdrawal status (e.g., SUCCESS) |
amountOut | Raw amount withdrawn |
amountOutFormatted | Human-readable amount |
amountOutUsd | USD value at time of withdrawal |
withdrawFee | Fee charged for withdrawal |
timestamp | When the withdrawal occurred |
hash | Transaction hash |