# Swap params

{% hint style="danger" %}
CAUTION

The public Swap API api.vulpefi.com is deprecated. To continue using the Swap API please migrate to the **VULPEFI Developer Portal**
{% endhint %}

## Generate data for calling the VulpeFI router for exchange: [`/api/swap`](/aggregation-protocol/api/swagger/ethereum-network.md) <a href="#generate-data-for-calling-the-1inch-router-for-exchange-apiswap" id="generate-data-for-calling-the-1inch-router-for-exchange-apiswap"></a>

### Description of query parameters <a href="#description-of-query-parameters" id="description-of-query-parameters"></a>

<table><thead><tr><th width="231">Parameter name</th><th width="104">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>src *</code></td><td>string</td><td>contract address of a token to sell<br>e.g.: <code>0x...xxx example</code></td></tr><tr><td><code>dst *</code></td><td>string</td><td>contract address of a token to buy<br>e.g.: <code>0x...xxx example</code></td></tr><tr><td><code>amount *</code></td><td>integer</td><td><p>amount of a token to sell, set in minimal divisible units </p><p>e.g.:<br><code>1.00 DAI</code> set as <code>1000000000000000000</code><br><code>51.03 USDC</code> set as <code>51030000</code></p></td></tr><tr><td><code>from *</code></td><td>string</td><td>address of a seller, make sure that this address has approved to spend src in needed amount<br>e.g.: <code>0x...xxx example</code></td></tr><tr><td><code>slippage *</code></td><td>number</td><td>limit of price slippage you are willing to accept in percentage, may be set with decimals. &#x26;slippage=0.5 means 0.5% slippage is acceptable. Low values increase chances that transaction will fail, high values increase chances of front running. Set values in the range from 0 to 50</td></tr><tr><td><code>protocols</code></td><td>string</td><td>specify liquidity protocols. If not set, all liquidity protocols will be used; you can disable any protocol by listing all protocols except those you don't need<br>e.g.: <code>&#x26;protocols=</code><br><code>default: all protocols can be used</code></td></tr><tr><td><code>receiver</code></td><td>string</td><td>recipient address of a purchased token<br>if not set, from will receive a purchased token</td></tr><tr><td><code>includeTokensInfo</code></td><td>boolean</td><td>if set to <code>true</code>, response will include from token and to token info<br><code>default: false</code></td></tr><tr><td><code>includeProtocols</code></td><td>boolean</td><td>if set to <code>true</code>, response will include protocols used in the quote<br><code>default: false</code></td></tr><tr><td><code>referrer</code></td><td>string</td><td>referrer's address</td></tr><tr><td><code>fee</code></td><td>number</td><td>this percentage of src token amount will be sent to referrer, the rest will be used as input for a swap<br><code>min: 0;</code> <code>max: 3;</code> <code>default: 0</code><br>example to set a fee to 1.5%: <code>&#x26;fee=1.5</code></td></tr><tr><td><code>gasPrice</code></td><td>string</td><td>VulpeFI takes in account gas expenses to determine exchange route. It is important to use the same gas price on the quote and swap methods.<br>Gas price set in wei: <code>12.5 GWEI</code> set as <code>12500000000</code><br><code>default: "fast" from network</code></td></tr><tr><td><code>permit</code></td><td>string</td><td>https://eips.ethereum.org/EIPS/eip-2612</td></tr><tr><td><code>compatibility</code></td><td>boolean</td><td>If true, the <code>swap</code> function will always be used. This helps when the token being traded has a tax or fee on trade or transfer <code>default: false</code></td></tr><tr><td><code>complexityLevel</code></td><td>string</td><td>maximum number of token-connectors to be used in a transaction. The more is used — the longer route estimation will take, the more complex route might be as a result. If not set, two token-connectors may be used<br><code>min: 0;</code> <code>max: 3;</code> <code>default: 2</code></td></tr><tr><td><code>connectorTokens</code></td><td>string</td><td>token-connectors can be specified via this parameter. The more is set — the longer route estimation will take. If not set, default token-connectors will be used. If a token you want to exchange doesn't have a pool with one of the default token-connectors this parameter will help find the route; should be the same for a quote and swap <code>max: 5;</code><br>e.g.: <code>&#x26;connectorTokens=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE, 0x...xxx example</code><br><code>default: list of default token-connectors</code></td></tr><tr><td><code>allowPartialFill</code></td><td>boolean</td><td>if true, the algorithm can cancel part of the route, if the rate has become less attractive. Unswapped tokens will return to the from<br><code>default: true</code></td></tr><tr><td><code>disableEstimate</code></td><td>boolean</td><td>if true, disable most of the checks<br><code>default: false</code></td></tr><tr><td><code>gasLimit</code></td><td>integer</td><td>maximum amount of gas for a swap;<br>should be the same for a quote and swap<br><code>default: 11500000;</code> <code>max: 11500000</code></td></tr><tr><td><code>mainRouteParts</code></td><td>integer</td><td>limit maximum number of main route parts;<br>should be the same for a quote and swap<br><code>default: 20;</code> <code>max: 50</code></td></tr><tr><td><code>parts</code></td><td>integer</td><td>limit maximum number of parts each main route parts can be split into; should be the same for a quote and swap <br><code>default: 20;</code> <code>max: 100</code></td></tr></tbody></table>

### Description of response parameters <a href="#description-of-response-parameters" id="description-of-response-parameters"></a>

**By default only toAmount and the tx object are returned**

<table><thead><tr><th width="232">Parameter name</th><th width="104">Type</th><th>Description</th></tr></thead><tbody><tr><td>fromToken</td><td>string</td><td>parameters of a token to sell</td></tr><tr><td>toToken</td><td>string</td><td>parameters of a token to buy</td></tr><tr><td>fromAmount</td><td>string</td><td>input amount of <code>fromToken</code> in minimal divisible units</td></tr><tr><td>toAmount</td><td>string</td><td>result amount of <code>toToken</code> in minimal divisible units</td></tr><tr><td>protocols</td><td>string</td><td>route of the trade</td></tr><tr><td>from</td><td>string</td><td>transactions will be sent from this address</td></tr><tr><td>to</td><td>string</td><td>transactions will be sent to our contract address</td></tr><tr><td>data</td><td>string</td><td>bytes of call data</td></tr><tr><td>value</td><td>string</td><td>amount of ETH (in wei) will be sent to the contract address</td></tr><tr><td>gasPrice</td><td>string</td><td>gas price in wei</td></tr><tr><td>gas</td><td>string</td><td>estimated amount of the gas limit, increase this value by 25%</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.vulpefi.com/aggregation-protocol/api/swap-params.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
