3ī¸âƒŖAggregator API

At Navi Protocol, we provide both SDK and API to empower users with seamless access to our powerful NAVI Aggregator for fetching token swap quotes.

Get Quote

Base URL:

https://open-aggregator-api.naviprotocol.io

Get /find_routes

The find_routes API endpoint identifies the optimal routes for swapping one token (from) to another (target) based on the specified amount and additional parameters. It determines the best swap paths by considering factors such as route depth and the input amount type.

Headers

Name
Value
Description

x-navi-token

String (optional)

Serves the same function as apiKey in sdk, used to authenticate user requests.

Body

Name
Type
Description

from

String

The token address you are swapping from (e.g., Sui-0x2::sui::SUI).

target

String

The token address you want to swap to (e.g., NAVX-0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX).

amount

String

The amount of the fromCoinAddress token to swap, specified with decimals (e.g., 1000000000).

by_amount_in

Boolean (optional)

Specifies whether the provided amount is the input amount for the swap. Please only use True

depth

String (optional)

The maximum number of hops allowed in the route search, balancing performance and accuracy. Default: 3

dexList

Enum List (optional)

A comma-separated list of decentralized exchanges (DEXs) to include for routing the swap. If left empty, all available DEXs will be considered. (e.g., ['cetus', 'turbos'])

Supported DEXs:

  • Cetus

  • Turbos

  • KriyaV2

  • KriyaV3

  • Aftermath

  • Deepbook

Sample Request

https://open-aggregator-api.naviprotocol.io/find_routes?from=0x2::sui::SUI&target=0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7%3A%3Ausdc%3A%3AUSDC&amount=100000000&by_amount_in=true&depth=3

Sample Response

{
    "data": {
        "amount_in": "100000000",
        "amount_out": 372824,
        "routes": [
            {
                "path": [
                    {
                        "id": "0xf385dee283495bb70500f5f8491047cd5a2ef1b7ff5f410e6dfe8a3c3ba58716",
                        "type": "0xa0eba10b173538c8fecca1dff298e488402cc9ff374f8a12ca7758eebe830b66::spot_dex::Pool<0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT,0x2::sui::SUI>",
                        "provider": "kriyaV2",
                        "from": "0x2::sui::SUI",
                        "target": "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT",
                        "a2b": false,
                        "direction": false,
                        "fee_rate": 75,
                        "lot_size": 0,
                        "amount_in": 100000000,
                        "amount_out": 96691690,
                        "extended_details": {
                            "after_sqrt_price": 0
                        },
                        "info_for_ptb": {
                            "packageId": "0xa0eba10b173538c8fecca1dff298e488402cc9ff374f8a12ca7758eebe830b66",
                            "moduleName": "spot_dex",
                            "functionName": "swap_token_y",
                            "typeArguments": [
                                "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT",
                                "0x2::sui::SUI"
                            ]
                        }
                    },
                    {
                        "id": "0x3621c2726246bb60bf8de75292f7227d0d4af33d33db305610ec44e5290da197",
                        "type": "0x1eabed72c53feb3805120a081dc15963c204dc8d091542592abaf7a35689b2fb::pool::Pool<0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC, 0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT>",
                        "provider": "cetus",
                        "from": "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT",
                        "target": "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
                        "a2b": false,
                        "direction": false,
                        "fee_rate": 500,
                        "lot_size": 0,
                        "amount_in": 96691690,
                        "amount_out": 372824,
                        "extended_details": {
                            "after_sqrt_price": 0
                        },
                        "info_for_ptb": {
                            "globalConfigId": "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f",
                            "packageId": "0x6f5e582ede61fe5395b50c4a449ec11479a54d7ff8e0158247adfda60d98970b",
                            "moduleName": "router",
                            "functionName": "swap",
                            "typeArguments": [
                                "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
                                "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT"
                            ],
                            "minSqrtPrice": "79226673515401279992447579055"
                        }
                    }
                ],
                "amount_in": 100000000,
                "amount_out": 372824,
                "initial_price": 0
            }
        ]
    }
}

Last updated