# Get the available routing for ETH/Base/BSC transactions

This interface is divided into two parts. One is to accurately specify the input and obtain the output currency quantity. The other is to accurately specify the output and obtain the minimum amount of the input currency.

### 1. Accurate input <a href="#id-1.-jing-que-shu-ru" id="id-1.-jing-que-shu-ru"></a>

Access point: /defi/router/v1/tx/available\_routes\_exact\_in

Request method: GET

Input parameters:

| <p><br><strong>Parameter name</strong></p> | **Parameter Description**                                 | **Is it necessary** | **Example**                                |
| ------------------------------------------ | --------------------------------------------------------- | ------------------- | ------------------------------------------ |
| token\_in\_chain                           | network code, such as eth/polygon/arb, etc.               | yes                 | eth                                        |
| token\_out\_chain                          | network code, such as eth/polygon/arb, etc.               | yes                 | arb                                        |
| token\_in\_address                         | enter the contract address of the token                   | yes                 | 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 |
| token\_out\_address                        | output token contract address                             | yes                 | 0xb44C0A4624eaEd2C41EB8437d0Fb5A28F91E7335 |
| in\_amount                                 | enter the number of tokens in the smallest unit           | yes                 | 100000000                                  |
| src                                        | source, you can choose gmgn or swapx, the default is gmgn | no                  | swapx                                      |

Return parameter:

<table data-header-hidden><thead><tr><th width="137"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Parameter name</strong></td><td><strong>Parameter Description</strong></td><td><strong>Example</strong></td></tr><tr><td>msg</td><td>error message</td><td>amountIn is required</td></tr><tr><td>code</td><td>correct 0, incorrect -1</td><td>0</td></tr><tr><td>data</td><td><p>Returns the basic information of the cross-chain transaction, mainly including the following information:</p><p>Source chain ID: chain_id,</p><p>Contract address: to,</p><p>Source currency quantity: amount_in,</p><p>Source currency USD value: amount_in_usd,</p><p>Get the amount of currency: amount_out,</p><p>Get the value of USD currency: amount_out_usd,</p><p>Purchase token address: buy_token_address,</p><p>Selling token address: sell_token_address,</p><p>After the step list: steps,</p><p>(Steps has three fields: id/type/tool)</p></td><td><strong>{</strong><code>"routes": [{"chain_id": 1,"to": "0x4313C378Cc91eA583C91387B9216e2c03096b27f","amount_in": "10000000000000000","amount_out": "299609399139476657","input_token_address": "0x0000000000000000000000000000000000000000","output_token_address": "0x81de6d37439afb8c5c0a6d6e39e764c89e81d6b5","type": "v2","path": ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","0x81de6d37439afb8c5c0a6d6e39e764c89e81d6b5"],"pool_address": "0xc8d39a869dee360e19d2a2f189c5b87f013d9f85","factory_address": "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f","fee": 3000,"steps": [{"id": 1,"type": "swap","tool": "uniswapv2"</code><strong>}]</strong>,<code>"token_in_usd_price": "2246.46","amount_in_usd": "22.4646","token_out_usd_price": "0.00000008532060895067131","amount_out_usd": "25.56285638192488514528660222461067","value": "10000000000000000","price_impact": "0.01","gas_limit": "221343"</code><strong>}]</strong>,<code>"volatilities": {"token_in": 0,"token_out": 10}</code></td></tr></tbody></table>

Returns the routes field of data

| **Field Name**         | **type**            | **Is simulation used?** | **Example**                                                                                                                                                                                          |
| ---------------------- | ------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| chain\_id              | number              | yes                     | 1                                                                                                                                                                                                    |
| to                     | string              | yes                     | 0xb2C435F236AE7697341beb0D98EceD5AB7d35052                                                                                                                                                           |
| amount\_in             | string              | yes                     | 129470074265000000                                                                                                                                                                                   |
| amount\_in2            | string              | yes                     | 1232343                                                                                                                                                                                              |
| amount\_out            | string              | yes                     | 1000000000                                                                                                                                                                                           |
| input\_token\_address  | string              | yes                     | 0x0c48250eb1f29491f1efbeec0261eb556f0973c7                                                                                                                                                           |
| output\_token\_address | string              | yes                     | 0x75c97384ca209f915381755c582ec0e2ce88c1ba                                                                                                                                                           |
| type                   | string              | yes                     | v0, v2, v3, v2-v2, v2-v3, v3-v2                                                                                                                                                                      |
| path                   | string \| string\[] | yes                     | <p>\[</p><p>  '0x0c48250eb1f29491f1efbeec0261eb556f0973c7',</p><p>        '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',</p><p>        '0x75c97384ca209f915381755c582ec0e2ce88c1ba'</p><p>      ]</p> |
| path\_bytes            | string              | Yes, V3 multi-hop       |                                                                                                                                                                                                      |
| pool\_address          | string \| string\[] | yes                     | <p>\[</p><p>        '0xe05d099bfd7f4aa9f2e696f6c3ebe181479961a5',</p><p>        '0xb54ce26f2e30f64c5b684b141311ce138ab5e00e'</p><p>      ]</p>                                                       |
| factory\_address       | string \| string\[] | Yes, V2 multi-hop       | 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f                                                                                                                                                           |
| fee                    | string \| string\[] | Yes, V3                 | 3000                                                                                                                                                                                                 |
| Steps                  | array               | no                      | \[ { id: 1, type: 'swap', tool: 'uniswapv2' } ]                                                                                                                                                      |
| token\_in\_usd\_price  | string              | no                      | 10.3099800923283                                                                                                                                                                                     |
| amount\_in\_usd        | string              | no                      | 1.334833                                                                                                                                                                                             |
| token\_out\_usd\_price | string              | no                      | 0.00000000474642715895                                                                                                                                                                               |
| amount\_out\_usd       | string              | no                      | 1.3226                                                                                                                                                                                               |
| value                  | string              | yes                     | 10000                                                                                                                                                                                                |
| gas\_limit             | string              | no                      | 21000                                                                                                                                                                                                |
| from\_address          | string              | yes                     | <p>The address of the wallet that initiated the transaction.<br>e.g: 0xb2bA9EA690428E01d82572438De4514F16446251</p>                                                                                  |

Description of the fields of returned data `volatilities`:

| **Field Name** | **type**                               | **Example** |
| -------------- | -------------------------------------- | ----------- |
| token\_in      | Int, 5-minute price volatility% above  | 5           |
| token\_out     | Int, 5-minute price volatility % above | 10          |
| is\_fomo       | bool, true or false                    | true        |

### 2. Accurate output <a href="#id-2.-jing-que-shu-chu" id="id-2.-jing-que-shu-chu"></a>

Access point: /defi/router/v1/tx/available\_routes\_exact\_out

Request method: GET

Input parameters:

| **Parameter name**  | **Parameter Description**                                 | **Is it necessary** | **Example**                                |
| ------------------- | --------------------------------------------------------- | ------------------- | ------------------------------------------ |
| token\_in\_chain    | Network code, such as eth/polygon/arb, etc.               | yes                 | eth                                        |
| token\_out\_chain   | Network code, such as eth/polygon/arb, etc.               | yes                 | arb                                        |
| token\_in\_address  | Enter the contract address of the token                   | yes                 | 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 |
| token\_out\_address | Output token contract address                             | yes                 | 0xb44C0A4624eaEd2C41EB8437d0Fb5A28F91E7335 |
| out\_amount         | The number of output tokens, in the smallest unit         | yes                 | 100000000                                  |
| src                 | Source, you can choose gmgn or swapx, the default is gmgn | no                  | swapx                                      |

Return parameter:

| **Parameter name** | **Parameter Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                | **Example**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| msg                | error message                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | amountIn is required                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| code               | correct 0, incorrect -1                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | 0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| data               | Returns the basic information of the cross-chain transaction, mainly including the following information:Source chain ID: chain\_id,Contract address: to,Source currency quantity: amount\_in,Source currency USD value: amount\_in\_usd,Output currency quantity: amount\_out,Get the value of USD currency: amount\_out\_usd,Purchase token address: buy\_token\_address,Selling token address: sell\_token\_address,After the step list: steps,(Steps has three fields: id/type/tool) | {"routes":\[{"chain\_id":1,"to":"0x2abbEAf73456b6c0b1a1E7e32Dbd63Bf4fafAC40","amount\_in":"987855194221161593","amount\_out":"100000000000000000","input\_token\_address":"0x481c4572e017e636177920D79db157c0Cf3A4697","output\_token\_address":"0x2C3Bc638031AAbB701EA5f30c522379dEE5c2B22","type":"v3","path":\["0x481c4572e017e636177920D79db157c0Cf3A4697","0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6","0x2C3Bc638031AAbB701EA5f30c522379dEE5c2B22"],"pool\_address":\["0x717BFacEBD23A5505b061Cf15a9C0fB2Ac1CABE4","0x20A741900D8b8Fcd10b4Af1822EE07622aF165C3"],"fee":\[3000,3000],"steps":\[{"id":1,"type":"swap","tool":"uniswapv3"}],"token\_in\_usd\_price":0,"amount\_in\_usd":"0","token\_out\_usd\_price":0,"amount\_out\_usd":"0","value":0}]} |


---

# 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.gmgn.ai/index/cooperation-api-integrate-gmgn-eth-base-bsc-trading-api/get-the-available-routing-for-eth-base-bsc-transactions.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.
