Gateway Swaps

Get a price quote for a swap.

Example: connector: 'jupiter' (or typed: 'jupiter/router', 'meteora/clmm', 'raydium/amm') network: 'solana-mainnet-beta' trading_pair: 'SOL-USDC' side: 'BUY' amount: 1 slippage_pct: 1 (optional; omit to use the connector's configured slippagePct) extra_params: {"approximateIfNoExactOut": false} # Solana routers

Returns: Quote with price, expected output amount, and execution-safety fields

post/gateway/swap/quote

Request

  • Base URL
    http://localhost:8000
  • URL
    http://localhost:8000/gateway/swap/quote
  • Auth
    HTTP basic

Request body

connectorstring required

DEX router connector (e.g., 'jupiter', '0x')

networkstring required

Network ID in 'chain-network' format (e.g., 'solana-mainnet-beta', 'ethereum-mainnet')

trading_pairstring required

Trading pair in BASE-QUOTE format (e.g., 'SOL-USDC')

sidestring required

Trade side: 'BUY' or 'SELL'

extra_paramsobject nullable

Connector-specific params passed through to Gateway under its own names: approximateIfNoExactOut (Solana routers). Unknown keys are rejected.

Response

Successful Response

basestring required

Base token symbol

quotestring required

Quote token symbol

pricestring required

Quoted price (base/quote)

amountstring required

Amount specified in request (BUY: base amount to receive, SELL: base amount to sell)

amount_instring nullable

Actual input amount (BUY: quote to spend, SELL: base to sell)

amount_outstring nullable

Actual output amount (BUY: base to receive, SELL: quote to receive)

min_amount_outstring nullable

Minimum output the transaction will accept after slippage

max_amount_instring nullable

Maximum input the transaction will spend after slippage

price_impact_pctstring nullable

Price impact of this trade size on the route

pool_addressstring nullable

Pool the quote was priced against

route_pathstring nullable

Route taken (router connectors)

slippage_pctstring nullable

Slippage percentage Gateway applied to the quote (the request value when Gateway omits it)

quote_idstring nullable

Identifier for this quote, on the router connectors that hold a price. Pass it to /swap/execute-quote to execute THIS quote instead of re-pricing. Absent on pool-scoped connectors, which price against the pool at execution time.

approximationboolean nullable

True when amount_out is an ESTIMATE rather than the exact-out amount asked for. A BUY is an ExactOut order, and many thin tokens have no ExactOut route, so Gateway falls back to quoting the sell leg and then quoting that input forward — which pays the pool fee and crosses the spread twice. Measured at a near-constant ~2.5% across eleven pools spanning $17 to $1,963 of liquidity, and it is reached for ONLY on the thin, high-fee pools where it hurts most. The caller is not overcharged; the order is silently resized, which is what matters to a strategy that asked for a specific quantity. Set extra_params={'approximateIfNoExactOut': false} to require an exact route.

Changes

    • breaking

      the response property became optional for the status

    • breaking

      response property slippage_pct list-of-types was widened by adding types null to media type application/json of response 200

    • warning

      removed the optional property from the response with the status

    • warning

      removed the optional property from the response with the status

    • info

      added the new optional request property

    • info

      the request property default value 1 was removed

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      the response's property pattern ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$ was removed for the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status