curl --request POST \
--url http://localhost:8000/gateway/swap/quote \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"connector": "<string>",
"network": "<string>",
"trading_pair": "<string>",
"side": "<string>",
"amount": 123,
"slippage_pct": 123,
"extra_params": {}
}
'import requests
url = "http://localhost:8000/gateway/swap/quote"
payload = {
"connector": "<string>",
"network": "<string>",
"trading_pair": "<string>",
"side": "<string>",
"amount": 123,
"slippage_pct": 123,
"extra_params": {}
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
connector: '<string>',
network: '<string>',
trading_pair: '<string>',
side: '<string>',
amount: 123,
slippage_pct: 123,
extra_params: {}
})
};
fetch('http://localhost:8000/gateway/swap/quote', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/gateway/swap/quote",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'connector' => '<string>',
'network' => '<string>',
'trading_pair' => '<string>',
'side' => '<string>',
'amount' => 123,
'slippage_pct' => 123,
'extra_params' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:8000/gateway/swap/quote"
payload := strings.NewReader("{\n \"connector\": \"<string>\",\n \"network\": \"<string>\",\n \"trading_pair\": \"<string>\",\n \"side\": \"<string>\",\n \"amount\": 123,\n \"slippage_pct\": 123,\n \"extra_params\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:8000/gateway/swap/quote")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"connector\": \"<string>\",\n \"network\": \"<string>\",\n \"trading_pair\": \"<string>\",\n \"side\": \"<string>\",\n \"amount\": 123,\n \"slippage_pct\": 123,\n \"extra_params\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/gateway/swap/quote")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"connector\": \"<string>\",\n \"network\": \"<string>\",\n \"trading_pair\": \"<string>\",\n \"side\": \"<string>\",\n \"amount\": 123,\n \"slippage_pct\": 123,\n \"extra_params\": {}\n}"
response = http.request(request)
puts response.read_body{
"base": "<string>",
"quote": "<string>",
"price": "<string>",
"amount": "<string>",
"amount_in": "<string>",
"amount_out": "<string>",
"min_amount_out": "<string>",
"max_amount_in": "<string>",
"price_impact_pct": "<string>",
"pool_address": "<string>",
"route_path": "<string>",
"slippage_pct": "<string>",
"quote_id": "<string>",
"approximation": true
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Get Swap Quote
curl --request POST \
--url http://localhost:8000/gateway/swap/quote \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"connector": "<string>",
"network": "<string>",
"trading_pair": "<string>",
"side": "<string>",
"amount": 123,
"slippage_pct": 123,
"extra_params": {}
}
'import requests
url = "http://localhost:8000/gateway/swap/quote"
payload = {
"connector": "<string>",
"network": "<string>",
"trading_pair": "<string>",
"side": "<string>",
"amount": 123,
"slippage_pct": 123,
"extra_params": {}
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
connector: '<string>',
network: '<string>',
trading_pair: '<string>',
side: '<string>',
amount: 123,
slippage_pct: 123,
extra_params: {}
})
};
fetch('http://localhost:8000/gateway/swap/quote', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/gateway/swap/quote",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'connector' => '<string>',
'network' => '<string>',
'trading_pair' => '<string>',
'side' => '<string>',
'amount' => 123,
'slippage_pct' => 123,
'extra_params' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:8000/gateway/swap/quote"
payload := strings.NewReader("{\n \"connector\": \"<string>\",\n \"network\": \"<string>\",\n \"trading_pair\": \"<string>\",\n \"side\": \"<string>\",\n \"amount\": 123,\n \"slippage_pct\": 123,\n \"extra_params\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:8000/gateway/swap/quote")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"connector\": \"<string>\",\n \"network\": \"<string>\",\n \"trading_pair\": \"<string>\",\n \"side\": \"<string>\",\n \"amount\": 123,\n \"slippage_pct\": 123,\n \"extra_params\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/gateway/swap/quote")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"connector\": \"<string>\",\n \"network\": \"<string>\",\n \"trading_pair\": \"<string>\",\n \"side\": \"<string>\",\n \"amount\": 123,\n \"slippage_pct\": 123,\n \"extra_params\": {}\n}"
response = http.request(request)
puts response.read_body{
"base": "<string>",
"quote": "<string>",
"price": "<string>",
"amount": "<string>",
"amount_in": "<string>",
"amount_out": "<string>",
"min_amount_out": "<string>",
"max_amount_in": "<string>",
"price_impact_pct": "<string>",
"pool_address": "<string>",
"route_path": "<string>",
"slippage_pct": "<string>",
"quote_id": "<string>",
"approximation": true
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Body
Request for swap price quote
DEX router connector (e.g., 'jupiter', '0x')
Network ID in 'chain-network' format (e.g., 'solana-mainnet-beta', 'ethereum-mainnet')
Trading pair in BASE-QUOTE format (e.g., 'SOL-USDC')
Trade side: 'BUY' or 'SELL'
Amount denominated in the BASE token (SELL: base to sell; BUY: base to receive — Gateway quotes BUY as ExactOut)
Maximum slippage percentage; omit to use the connector's configured slippagePct
Connector-specific params passed through to Gateway under its own names: approximateIfNoExactOut (Solana routers). Unknown keys are rejected.
Response
Successful Response
Swap quote, re-framed from Gateway's token-flow response into trading-pair terms.
Gateway's quote-swap routes speak tokenIn/tokenOut; this keeps the base/quote + side framing bots use and passes Gateway's execution-safety fields through in snake_case. No gas estimate: Gateway's quote does not return one.
Base token symbol
Quote token symbol
Quoted price (base/quote)
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Amount specified in request (BUY: base amount to receive, SELL: base amount to sell)
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Actual input amount (BUY: quote to spend, SELL: base to sell)
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Actual output amount (BUY: base to receive, SELL: quote to receive)
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Minimum output the transaction will accept after slippage
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Maximum input the transaction will spend after slippage
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Price impact of this trade size on the route
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Pool the quote was priced against
Route taken (router connectors)
Slippage percentage Gateway applied to the quote (the request value when Gateway omits it)
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$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.
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.
Was this page helpful?

