Quote Endpoint
The quote endpoint finds the optimal swap route between two tokens and returns detailed execution information including ready-to-use transaction data.
Endpoint
GET /api/v1/quoteRequest Parameters
Required Parameters
from
string
Input token identifier (e.g., WEGLD-bd4d79)
to
string
Output token identifier (e.g., USDC-c76f1f)
Amount Parameters
Provide exactly one of the following:
amountIn
string
Amount to swap in smallest units. Returns maximum achievable output.
amountOut
string
Desired output amount in smallest units. Returns required input.
Providing both or neither returns an error. See Error Reference.
Optional Parameters
slippage
number
0.01
Slippage tolerance as a decimal (0.01 = 1%)
maxSplits
number
5
Maximum number of route splits
maxHops
number
10
Maximum swaps per individual route path
includePaths
boolean
true
Include detailed path breakdown in response
referralId
number
0
Referral ID for fee sharing
algorithm
string
hybrid
Split allocation algorithm: greedy, lagrangian, or hybrid
maxBuiltinCalls
number
β
Cap on smart contract calls per transaction (gas optimization)
includeLpRoutes
boolean
false
Allow LP tokens as intermediate hops (auto-enabled when from or to is an LP token)
sender
string
β
Sender address (bech32). When provided, returns a complete transaction object ready for signing instead of raw txData
Algorithm Parameter
greedy
Incrementally allocates trade chunks to the highest-rate path. Fast (~99% optimal). Applies early termination when marginal rates decline.
lagrangian
Uses binary search on the Lagrange multiplier to equalize marginal rates across all active paths. Mathematically optimal for convex AMMs. Best for large trades.
hybrid
Runs both algorithms and returns whichever produces greater output. Recommended for all use cases.
LP Routing (includeLpRoutes)
includeLpRoutes)When from or to is an LP token, the router automatically handles mint and burn operations β no flag required.
Set includeLpRoutes=true only to allow LP tokens as intermediate hops in routes between two non-LP tokens, when doing so might improve output.
includeLpRoutes=true increases the number of candidate paths and may slightly increase response latency.
Transaction Building (sender)
sender)Pass the caller's bech32 address to receive a complete, ready-to-sign transaction object instead of raw txData.
When sender is present the API:
Fetches the sender's current nonce from the gateway.
Simulates the transaction to measure exact gas cost (adds a buffer).
Constructs the correct envelope β native EGLD value transfer for
EGLDinput,ESDTTransferdata prefix for all other tokens.Returns the
transactionfield and omitstxDataandinstructions.
If fetching the nonce or simulating gas takes longer than 5 seconds, the API falls back to returning txData without a transaction object. Handle both shapes in your client.
Arbitrage Parameters
When from equals to, the API switches to arbitrage detection mode and finds profitable cycles in the DEX graph:
minProfitBps
number
10
Minimum profit threshold in basis points (10 bps = 0.1%)
maxCycles
number
5
Maximum number of arbitrage cycles to return
fastMode
boolean
false
Use faster but less exhaustive cycle search
Arbitrage mode is compute-intensive. Use fastMode=true and set a meaningful minProfitBps to avoid unnecessary load.
Response Format
Successful Response
Response Fields
from
string
Input token identifier
to
string
Output token identifier
amountIn
string
Input amount in smallest units
amountOut
string
Output amount in smallest units
amountInShort
number
Human-readable input amount (divided by token decimals)
amountOutShort
number
Human-readable output amount
amountOutMin
string
Minimum output after slippage, in smallest units (forward quotes)
amountOutMinShort
number
Human-readable minimum output (forward quotes)
amountInMax
string
Maximum input after slippage, in smallest units (reverse quotes only)
amountInMaxShort
number
Human-readable maximum input (reverse quotes only)
amountInUsd
number
USD value of input amount (omitted if price unavailable)
amountOutUsd
number
USD value of output amount (omitted if price unavailable)
amountOutMinUsd
number
USD value of minimum output after slippage (omitted if price unavailable)
slippage
number
Applied slippage tolerance
priceImpact
number
Estimated price impact as a decimal (0.01 = 1%)
rate
number
Exchange rate: output units per input unit
rateInverse
number
Inverse rate: input units per output unit
paths
array
Detailed route breakdown; present when includePaths=true
txData
string
Hex-encoded transaction data; omitted when transaction is present
feeBps
number
Protocol fee in basis points
feeAmount
string
Fee amount in smallest units
feeAmountShort
number
Human-readable fee amount
feeToken
string
Token identifier the fee is charged on
transaction
object
Complete transaction ready for signing; present only when sender is provided (see Transaction Building)
arbitrage
object
Arbitrage metadata; present only for same-token (from == to) forward quotes
Path Object
When includePaths=true, each element in the paths array describes one route leg:
splitPpm
number
Fraction of total input allocated to this path, in parts per million (1,000,000 = 100%)
swaps
array
Ordered list of individual pool swaps within this path
swaps[].dex
string
DEX name: xExchange, AshSwap, JEX, or OneDex
swaps[].address
string
Pool smart contract address (bech32)
Using Transaction Data
Pass sender to receive a fully-built transaction object. The API fetches the sender's nonce, simulates gas, and constructs the correct EGLD or ESDT envelope automatically β no manual assembly needed.
What txData contains
txData containsWhen sender is omitted, txData contains only the aggregator endpoint call β the function name and its arguments:
It does not include any token transfer prefix. You must wrap it inside the correct MultiversX transaction envelope depending on your input token:
EGLD
Send native value to the aggregator contract; use txData as the data field directly
ESDT (single)
ESDTTransfer@<token_hex>@<amount_hex>@<txData> β receiver is the aggregator contract
Multiple ESDTs
MultiESDTNFTTransfer@<aggregator_hex>@<count>@<token1>@<nonce1>@<amount1>@...@<txData> β receiver is your own address
Refer to the MultiversX docs on ESDT transfers with SC execution for the full encoding rules before assembling the transaction data field manually.
A common mistake is using txData as the full data field for an ESDT swap. Without the ESDTTransfer prefix the contract never receives the tokens and the transaction will fail.
txData encodes the minimum output amount derived from the slippage parameter. A different slippage value produces different txData. Do not reuse txData across quote requests.
Examples
Forward Quote
Reverse Quote
Large Trade with Split Optimization
Arbitrage Detection
Quote with Ready-to-Sign Transaction
Minimal Response (High-Frequency Polling)
Error Responses
"unknown token_in 'X'"
Input token identifier not recognized
"unknown token_out 'X'"
Output token identifier not recognized
"routing failed: no path between tokens"
No liquidity path connects the requested tokens
"invalid amount_in: expected unsigned integer amount"
Amount is non-numeric, negative, or fractional
"specify either amount_in or amount_out, not both"
Both amountIn and amountOut provided
"amount_in or amount_out must be provided"
Neither amountIn nor amountOut provided
See Error Reference for HTTP status codes, full error bodies, and resolution steps.
Token Identifiers
MultiversX token identifiers use the format TICKER-hexcode:
Wrapped EGLD
WEGLD-bd4d79
USDC
USDC-c76f1f
USDT
USDT-f8c08c
UTK
UTK-2f80e9
MEX
MEX-455c57
Use the pair-config endpoint to verify that a token is supported before requesting a quote. It also returns the token's decimal precision, which is required to convert amounts correctly.
Rate Limiting
100 requests per second per IP address
Each request computes routes fresh against current pool state; responses are not cached
For high-frequency applications, use
includePaths=falseto reduce response size and processing time
Related Topics
Pair Configuration β Verify token support before quoting
Integration Guide β Complete integration walkthrough
Error Reference β Full error code reference
Last updated
Was this helpful?