# Transit Swap Aggregation

> chain supported:
>
> ETH
>
> BSC
>
> HECO
>
> OEC
>
> HSC
>
> MATIC
>
> FTM
>
> AVAX
>
> ARB
>
> KLAY
>
> KCC
>
> Solana
>
> Aptos

## Transit Swap API for Aggregation

<mark style="color:blue;">`GET`</mark> `https://aggserver.transit.finance/v3/transit/swap`

Query Swap Info and ABI data

#### Query Parameters

| Name                                           | Type    | Description                                 |
| ---------------------------------------------- | ------- | ------------------------------------------- |
| token0<mark style="color:red;">\*</mark>       | string  | contract address of a token to sell         |
| token1<mark style="color:red;">\*</mark>       | string  | contract address of a token to buy.         |
| decimal0<mark style="color:red;">\*</mark>     | integer | Decimals of a token to sell                 |
| decimal1<mark style="color:red;">\*</mark>     | integer | Decimals of a token to buy                  |
| impact<mark style="color:red;">\*</mark>       | integer | Slippage Tolerance. 0 - 10000               |
| part<mark style="color:red;">\*</mark>         | integer | The scale of amountIn. 1 - 100              |
| amountIn<mark style="color:red;">\*</mark>     | integer | Amount of a token to sell                   |
| amountOutMin<mark style="color:red;">\*</mark> | integer | Minimum received                            |
| to<mark style="color:red;">\*</mark>           | string  | Recipient of desToken                       |
| issuer                                         | string  | Sender of transaction push                  |
| chain<mark style="color:red;">\*</mark>        | string  | chain flag                                  |
| channel                                        | string  | "default"、"web"、"android"、"ios"、"extension" |

{% tabs %}
{% tab title="200: OK swap data" %}

```javascript
{
    "result": 0, //if error will be -1
    "message": "success", //if error: error info
    "data": {
        "srcToken": "",
        "dstToken": "",
        "part": "",
        "to": "",
        "sender": "",
        "amountIn": "",
        "usedAmountIn": "",
        "totalAmountOut": "",
        "totalAmountOutMin": "",
        "impact": "",
        "normalFee": "",
        "fee": "",
        "feeRate": "",
        "aggregator": "",
        "dexPath": [
            "Uniswap:50",
            "Sushi:50"
        ],
        "amounts": [
            {
                "exchange": "",
                "icon_url": "",
                "amountOut": ""
            },
            ...
        ],
        "data": ""
    }
}
```

{% endtab %}
{% endtabs %}

> Request Params Details

* amountIn: calculated with decimals, For example 1ETH = 10\*\*18
* impact: base 1000, uint:‱, For example 1% = 100‱
* amountOutMin: first time set 0, when user push transaction and set amountOutMin of last query
* chain: set chain string of supported.

> Responses Details

* totalAmountOut: dstToken received (estimated)
* normalFee: calc fee with feeRate
* fee: actual fees paid
* aggregator: Transit swap Router v3
* dexPath: the sources of used dex for used part
* amounts: all sources of dex's single amountOut
* data: ABI data can be sent directly to router contract


---

# 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.transit.finance/reference/api-reference/transit-swap-aggregation.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.
