Swap quote API
Request routes, inspect token amounts, and handle quote responses.
The Astros quote API returns swap routes across Sui liquidity venues. Start with the read-only quick start for a runnable request.
Get Quote
Send a GET request to /find_routes. Send parameters in the URL query string.
Base URL
https://open-aggregator-api.naviprotocol.io| Query parameter | Meaning |
|---|---|
from | Sell coin type, for example 0x2::sui::SUI. |
target | Buy coin type, for example the native USDC type in the request below. |
amount | Integer amount in the sell token’s smallest unit for an exact-input quote. For SUI, 100000000 means 0.1 SUI. |
by_amount_in | Set to true for an exact-input quote. |
depth | Route search depth. The SDK defaults to 3. |
providers | Optional provider filter. Repeat the key for multiple venues, for example providers=cetus&providers=bluefin. The SDK calls the corresponding option dexList. |
version | The router capability version supported by your client. Published SDK 2.0.9 sends 18. |
The SDK sends the optional API key in the x-navi-token header. The quick-start request works without a key.
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&version=18Sample responses
The successful response below is a historical example. Pool paths, prices and amounts change between quotes, and amounts may arrive as numbers or numeric strings. Check HTTP status and the response body before using a route. The error example shows one possible message.
{
"data": {
"amount_in": "100000000",
"amount_out": 223857,
"routes": [
{
"path": [
{
"id": "0xa63347f0a3d79e36c629866d72d148403907088cca219d80bdd5461d79d34d46",
"type": "0x3492c874c1e3b3e2984e8c41b589e642d4d0a5d6459e5a9cfc2d52fd7c89c267::pool::Pool<0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI, 0x2::sui::SUI>",
"provider": "bluefin",
"from": "0x2::sui::SUI",
"target": "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI",
"a2b": false,
"direction": false,
"fee_rate": 100,
"lot_size": 0,
"amount_in": 100000000,
"amount_out": 95226771,
"extended_details": {
"after_sqrt_price": 0
},
"info_for_ptb": {
"packageId": "0x6c796c3ab3421a68158e0df18e4657b2827b1f8fed5ed4b82dba9c935988711b",
"moduleName": "gateway",
"functionName": "route_swap",
"byAmountIn": true,
"minSqrtPrice": "79226673515401279992447579055",
"amountLimit": 0,
"typeArguments": [
"0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI",
"0x2::sui::SUI"
]
}
},
{
"id": "0xaa020ad81e1621d98d4fb82c4acb80dc064722f24ef828ab633bef50fc28268b",
"type": "0x1eabed72c53feb3805120a081dc15963c204dc8d091542592abaf7a35689b2fb::pool::Pool<0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC, 0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI>",
"provider": "cetus",
"from": "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI",
"target": "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
"a2b": false,
"direction": false,
"fee_rate": 500,
"lot_size": 0,
"amount_in": 95226771,
"amount_out": 223857,
"extended_details": {
"after_sqrt_price": 0
},
"info_for_ptb": {
"globalConfigId": "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f",
"packageId": "0x6f5e582ede61fe5395b50c4a449ec11479a54d7ff8e0158247adfda60d98970b",
"moduleName": "router",
"functionName": "swap",
"typeArguments": [
"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
"0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI"
],
"minSqrtPrice": "79226673515401279992447579055"
}
}
],
"amount_in": 100000000,
"amount_out": 223857,
"initial_price": 0
}
],
"from_token": {
"address": "0x2::sui::SUI",
"decimals": 9,
"price": 2.178773719491083
},
"to_token": {
"address": "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
"decimals": 6,
"price": 1.0002348920262438
},
"is_accurate": true
}
}