Query Parameters
The wallet address of the user who will execute the trade.
The address of the base token you want to trade (e.g. ETH address).
The address of the collateral/quote token (e.g. USDC address).
The leverage multiplier (e.g. 10 for 10x leverage).
Set to true or "true" for a long position, false or "false" for a short position.
The amount of collateral token to use for the position.
Required for limit and stop_limit orders. The trigger price for the order.
Take Profit price. Must be valid based on direction (above open price for long, below for short).
Stop Loss price. Must be valid based on direction (below open price for long, above for short).
The type of order. Possible values: market, limit, stop_limit. Defaults to market.
Position size in raw token units. If not provided, calculated from collateral amount and leverage.
Maximum allowed slippage in percentage.
Chain ID to search for quotes (e.g. "evm:42161"). If omitted, searches all supported chains.
DEX to query. Supported values: gains. If omitted, queries all supported DEXes.
Referrer wallet address for fee sharing.
Response
Quote result containing execution payload.
The DEX that provided the quote. Possible values: gains
Blockchain ID where the order will be executed
Execution payload object. Structure varies by DEX type.
Order type: market, limit, or stop_limit
Take profit price (optional)
Stop loss price (optional)
Encoded function call data
JSON stringified version of the payload. Use this with the execute endpoint.
Error Response
If the quote cannot be generated, the API returns a 500 error with:
Error message (e.g. “could not find quote”)
Array of error strings from each DEX that was queried. Format: "dex - error message" or just "error message" if no DEX specified.
long
booleanstring
required
Available options:
market,
limit,
stop_limit