Get Quote
Request a quote for swapping tokens. This endpoint calculates the optimal route and expected output amount.
Endpoint
POST
/quoteGet swap quoteRequest Body
json
{
"tokenA": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"tokenB": "0x59ef6f3943bbdfe2fb19565037ac85071223e94c",
"dexId": "ALL",
"amountIn": "1000000000000000000"
}Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| tokenA | string | Input token address (use 0xEeee...EEeE for native token) | |
| tokenB | string | Output token address | |
| dexId | string | DEX identifier (e.g., "ALL", "ZERO_G") | |
| amountIn | string | Amount to swap in wei (smallest unit) |
Response
json
{
"tokenA": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"tokenB": "0x59ef6f3943bbdfe2fb19565037ac85071223e94c",
"amountIn": "1000000000000000000",
"amountOut": "2429260061494",
"tokenPrice": "2436.737744408513",
"routePlan": [
{
"tokenA": "0x1cd0690ff9a693f5ef2dd976660a8dafc81a109c",
"tokenB": "0x59ef6f3943bbdfe2fb19565037ac85071223e94c",
"dexId": "ZERO_G",
"poolAddress": "0x224D0891D63Ca83e6DD98B4653C27034503a5E76",
"aToB": true,
"fee": 3000
}
],
"dexId": "ALL",
"dexFactory": "0x9bdcA5798E52e592A08e3b34d3F18EeF76Af7ef4",
"isNativeIn": true,
"isNativeOut": false
}Response Fields
amountOut:The amount of tokens you will receive (in smallest unit). In this example, you'll get 2,429,260,061,494 units of the output token.
tokenPrice:The effective price rate for the swap (2436.74 output tokens per 1 input token).
routePlan:The optimal swap path. May include multiple hops through different pools.
aToB:Direction of the swap in the pool (true = tokenA to tokenB).
fee:Pool fee in basis points (3000 = 0.3%).
isNativeIn/isNativeOut:Indicates if native token (0G) is being used as input or output.
Need help? Contact support or visit our developer community.