curl --request POST \
--url https://raptor.solanatracker.io/quote-and-swap \
--header 'Content-Type: application/json' \
--data '
{
"userPublicKey": "YOUR_WALLET_ADDRESS",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": 100000000,
"slippageBps": "50",
"priorityFee": "high"
}
'import requests
url = "https://raptor.solanatracker.io/quote-and-swap"
payload = {
"userPublicKey": "YOUR_WALLET_ADDRESS",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": 100000000,
"slippageBps": "50",
"priorityFee": "high"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
userPublicKey: 'YOUR_WALLET_ADDRESS',
inputMint: 'So11111111111111111111111111111111111111112',
outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
amount: 100000000,
slippageBps: '50',
priorityFee: 'high'
})
};
fetch('https://raptor.solanatracker.io/quote-and-swap', 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://raptor.solanatracker.io/quote-and-swap",
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([
'userPublicKey' => 'YOUR_WALLET_ADDRESS',
'inputMint' => 'So11111111111111111111111111111111111111112',
'outputMint' => 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
'amount' => 100000000,
'slippageBps' => '50',
'priorityFee' => 'high'
]),
CURLOPT_HTTPHEADER => [
"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 := "https://raptor.solanatracker.io/quote-and-swap"
payload := strings.NewReader("{\n \"userPublicKey\": \"YOUR_WALLET_ADDRESS\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amount\": 100000000,\n \"slippageBps\": \"50\",\n \"priorityFee\": \"high\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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("https://raptor.solanatracker.io/quote-and-swap")
.header("Content-Type", "application/json")
.body("{\n \"userPublicKey\": \"YOUR_WALLET_ADDRESS\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amount\": 100000000,\n \"slippageBps\": \"50\",\n \"priorityFee\": \"high\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://raptor.solanatracker.io/quote-and-swap")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"userPublicKey\": \"YOUR_WALLET_ADDRESS\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amount\": 100000000,\n \"slippageBps\": \"50\",\n \"priorityFee\": \"high\"\n}"
response = http.request(request)
puts response.read_body{
"quote": {
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amountIn": "100000000",
"amountOut": "11703794",
"minAmountOut": "11645275",
"priceImpact": 0,
"slippageBps": 50,
"routePlan": [
{
"programId": "9H6tua7jkLhdm3w8BvgpTn5LZNU7g4ZynDmCiNN3q6Rp",
"dex": "Humidifi",
"pool": "8sKQHfjNhvmAw94PhfvfMcytmqW6jmxvwieYyzXCCPu",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amountIn": "100000000",
"amountOut": "11703794",
"priceImpact": 0,
"percent": 100
}
],
"swapUsdValue": "11.72",
"contextSlot": 454215370,
"timeTaken": 0.026
},
"swapTransaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAHEf…",
"lastValidBlockHeight": 432253100,
"contextSlot": 454215370,
"prioritizationFeeLamports": 20000
}{
"error": "Invalid amount: must be greater than 0",
"code": 400
}{
"error": "Failed to get quote: No multi-hop route found",
"code": 422
}{
"error": "Failed to build swap: Execution plan expired",
"code": 500
}Quote and swap in one request
Get a quote and the transaction in one call. Use it when the user does not need to review the price before signing.
curl --request POST \
--url https://raptor.solanatracker.io/quote-and-swap \
--header 'Content-Type: application/json' \
--data '
{
"userPublicKey": "YOUR_WALLET_ADDRESS",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": 100000000,
"slippageBps": "50",
"priorityFee": "high"
}
'import requests
url = "https://raptor.solanatracker.io/quote-and-swap"
payload = {
"userPublicKey": "YOUR_WALLET_ADDRESS",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": 100000000,
"slippageBps": "50",
"priorityFee": "high"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
userPublicKey: 'YOUR_WALLET_ADDRESS',
inputMint: 'So11111111111111111111111111111111111111112',
outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
amount: 100000000,
slippageBps: '50',
priorityFee: 'high'
})
};
fetch('https://raptor.solanatracker.io/quote-and-swap', 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://raptor.solanatracker.io/quote-and-swap",
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([
'userPublicKey' => 'YOUR_WALLET_ADDRESS',
'inputMint' => 'So11111111111111111111111111111111111111112',
'outputMint' => 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
'amount' => 100000000,
'slippageBps' => '50',
'priorityFee' => 'high'
]),
CURLOPT_HTTPHEADER => [
"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 := "https://raptor.solanatracker.io/quote-and-swap"
payload := strings.NewReader("{\n \"userPublicKey\": \"YOUR_WALLET_ADDRESS\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amount\": 100000000,\n \"slippageBps\": \"50\",\n \"priorityFee\": \"high\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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("https://raptor.solanatracker.io/quote-and-swap")
.header("Content-Type", "application/json")
.body("{\n \"userPublicKey\": \"YOUR_WALLET_ADDRESS\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amount\": 100000000,\n \"slippageBps\": \"50\",\n \"priorityFee\": \"high\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://raptor.solanatracker.io/quote-and-swap")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"userPublicKey\": \"YOUR_WALLET_ADDRESS\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amount\": 100000000,\n \"slippageBps\": \"50\",\n \"priorityFee\": \"high\"\n}"
response = http.request(request)
puts response.read_body{
"quote": {
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amountIn": "100000000",
"amountOut": "11703794",
"minAmountOut": "11645275",
"priceImpact": 0,
"slippageBps": 50,
"routePlan": [
{
"programId": "9H6tua7jkLhdm3w8BvgpTn5LZNU7g4ZynDmCiNN3q6Rp",
"dex": "Humidifi",
"pool": "8sKQHfjNhvmAw94PhfvfMcytmqW6jmxvwieYyzXCCPu",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amountIn": "100000000",
"amountOut": "11703794",
"priceImpact": 0,
"percent": 100
}
],
"swapUsdValue": "11.72",
"contextSlot": 454215370,
"timeTaken": 0.026
},
"swapTransaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAHEf…",
"lastValidBlockHeight": 432253100,
"contextSlot": 454215370,
"prioritizationFeeLamports": 20000
}{
"error": "Invalid amount: must be greater than 0",
"code": 400
}{
"error": "Failed to get quote: No multi-hop route found",
"code": 422
}{
"error": "Failed to build swap: Execution plan expired",
"code": 500
}Body
Wallet that signs and pays for the swap
Mint of the token you sell
Mint of the token you buy
Amount to sell, in the input token's smallest unit
Slippage in basis points, or dynamic
Only route through these DEXes (comma-separated)
Only route through these pools (comma-separated)
1 <= x <= 4auto, true, false fast, deep Case-sensitive. LEGACY and V1 need jitRouting: false.
V0, LEGACY, V1 Same as txVersion: "LEGACY"
A level (min, low, medium, auto, high, veryHigh, turbo, unsafeMax) or a total fee in lamports as a string. Default auto.
Cap on the compute unit price, in micro-lamports
Send the output to this token account instead of the wallet's associated token account
Response
Quote and unsigned transaction
Was this page helpful?