curl --request GET \
--url https://public-api-v2.bags.fm/api/v1/trade/v2/quote \
--header 'x-api-key: <api-key>'import requests
url = "https://public-api-v2.bags.fm/api/v1/trade/v2/quote"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://public-api-v2.bags.fm/api/v1/trade/v2/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_URL => "https://public-api-v2.bags.fm/api/v1/trade/v2/quote",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://public-api-v2.bags.fm/api/v1/trade/v2/quote"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://public-api-v2.bags.fm/api/v1/trade/v2/quote")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-api-v2.bags.fm/api/v1/trade/v2/quote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"response": {
"requestId": "<string>",
"provider": "jupiter",
"inputMint": "<string>",
"outputMint": "<string>",
"inAmount": "<string>",
"outAmount": "<string>",
"slippageBps": 123,
"feeMint": "<string>",
"feeSide": "input",
"feeLamports": "<string>",
"expiresAtMs": 123
}
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}Get Trade V2 Quote
Get a server-built swap quote, racing Jupiter swap/v2/build against Titan (when configured). The winning quote is cached in Redis for 60 seconds under the returned requestId, which is then passed to POST /trade/v2/swap to build the unsigned transaction.
Every pair is charged the 1% Bags fee, including token-to-token. The mint and leg are resolved by preference and reported as feeMint/feeSide: native SOL wins on either leg, otherwise a preferred stablecoin/LST mint if either leg is one, otherwise the input mint. When feeSide is input, the fee is deducted from amount before the provider quote. When feeSide is output, the full amount is quoted and the fee is taken from the proceeds.
curl --request GET \
--url https://public-api-v2.bags.fm/api/v1/trade/v2/quote \
--header 'x-api-key: <api-key>'import requests
url = "https://public-api-v2.bags.fm/api/v1/trade/v2/quote"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://public-api-v2.bags.fm/api/v1/trade/v2/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_URL => "https://public-api-v2.bags.fm/api/v1/trade/v2/quote",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://public-api-v2.bags.fm/api/v1/trade/v2/quote"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://public-api-v2.bags.fm/api/v1/trade/v2/quote")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-api-v2.bags.fm/api/v1/trade/v2/quote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"response": {
"requestId": "<string>",
"provider": "jupiter",
"inputMint": "<string>",
"outputMint": "<string>",
"inAmount": "<string>",
"outAmount": "<string>",
"slippageBps": 123,
"feeMint": "<string>",
"feeSide": "input",
"feeLamports": "<string>",
"expiresAtMs": 123
}
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}Authorizations
API key authentication. Provide your API key as the header value.
Query Parameters
Public key of the input token mint
Public key of the output token mint
Public key of the wallet that will sign the swap
Amount to swap in the token's smallest unit, as a positive integer string of raw base units (1-20 digits, no leading zeros)
'auto' or an integer 0-10000 in basis points
auto Priority fee tier used when building the transaction
normal, fast, turbo Provider to quote against. 'auto' races Jupiter and Titan (when Titan is configured) and serves the first success
auto, jupiter, titan 