Build swap instructions
curl --request POST \
--url https://raptor.solanatracker.io/swap-instructions \
--header 'Content-Type: application/json' \
--data '
{
"userPublicKey": "YOUR_WALLET_ADDRESS",
"quoteResponse": {
"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
}
],
"contextSlot": 454215309,
"timeTaken": 0.026,
"quoteId": "AbvXxjPyBhaxiDuRNB5XM54c_V8e-S0jPyMceNLpJQmU"
}
}
'import requests
url = "https://raptor.solanatracker.io/swap-instructions"
payload = {
"userPublicKey": "YOUR_WALLET_ADDRESS",
"quoteResponse": {
"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
}
],
"contextSlot": 454215309,
"timeTaken": 0.026,
"quoteId": "AbvXxjPyBhaxiDuRNB5XM54c_V8e-S0jPyMceNLpJQmU"
}
}
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',
quoteResponse: {
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
}
],
contextSlot: 454215309,
timeTaken: 0.026,
quoteId: 'AbvXxjPyBhaxiDuRNB5XM54c_V8e-S0jPyMceNLpJQmU'
}
})
};
fetch('https://raptor.solanatracker.io/swap-instructions', 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/swap-instructions",
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',
'quoteResponse' => [
'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
]
],
'contextSlot' => 454215309,
'timeTaken' => 0.026,
'quoteId' => 'AbvXxjPyBhaxiDuRNB5XM54c_V8e-S0jPyMceNLpJQmU'
]
]),
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/swap-instructions"
payload := strings.NewReader("{\n \"userPublicKey\": \"YOUR_WALLET_ADDRESS\",\n \"quoteResponse\": {\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amountIn\": \"100000000\",\n \"amountOut\": \"11703794\",\n \"minAmountOut\": \"11645275\",\n \"priceImpact\": 0,\n \"slippageBps\": 50,\n \"routePlan\": [\n {\n \"programId\": \"9H6tua7jkLhdm3w8BvgpTn5LZNU7g4ZynDmCiNN3q6Rp\",\n \"dex\": \"Humidifi\",\n \"pool\": \"8sKQHfjNhvmAw94PhfvfMcytmqW6jmxvwieYyzXCCPu\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amountIn\": \"100000000\",\n \"amountOut\": \"11703794\",\n \"priceImpact\": 0,\n \"percent\": 100\n }\n ],\n \"contextSlot\": 454215309,\n \"timeTaken\": 0.026,\n \"quoteId\": \"AbvXxjPyBhaxiDuRNB5XM54c_V8e-S0jPyMceNLpJQmU\"\n }\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/swap-instructions")
.header("Content-Type", "application/json")
.body("{\n \"userPublicKey\": \"YOUR_WALLET_ADDRESS\",\n \"quoteResponse\": {\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amountIn\": \"100000000\",\n \"amountOut\": \"11703794\",\n \"minAmountOut\": \"11645275\",\n \"priceImpact\": 0,\n \"slippageBps\": 50,\n \"routePlan\": [\n {\n \"programId\": \"9H6tua7jkLhdm3w8BvgpTn5LZNU7g4ZynDmCiNN3q6Rp\",\n \"dex\": \"Humidifi\",\n \"pool\": \"8sKQHfjNhvmAw94PhfvfMcytmqW6jmxvwieYyzXCCPu\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amountIn\": \"100000000\",\n \"amountOut\": \"11703794\",\n \"priceImpact\": 0,\n \"percent\": 100\n }\n ],\n \"contextSlot\": 454215309,\n \"timeTaken\": 0.026,\n \"quoteId\": \"AbvXxjPyBhaxiDuRNB5XM54c_V8e-S0jPyMceNLpJQmU\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://raptor.solanatracker.io/swap-instructions")
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 \"quoteResponse\": {\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amountIn\": \"100000000\",\n \"amountOut\": \"11703794\",\n \"minAmountOut\": \"11645275\",\n \"priceImpact\": 0,\n \"slippageBps\": 50,\n \"routePlan\": [\n {\n \"programId\": \"9H6tua7jkLhdm3w8BvgpTn5LZNU7g4ZynDmCiNN3q6Rp\",\n \"dex\": \"Humidifi\",\n \"pool\": \"8sKQHfjNhvmAw94PhfvfMcytmqW6jmxvwieYyzXCCPu\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amountIn\": \"100000000\",\n \"amountOut\": \"11703794\",\n \"priceImpact\": 0,\n \"percent\": 100\n }\n ],\n \"contextSlot\": 454215309,\n \"timeTaken\": 0.026,\n \"quoteId\": \"AbvXxjPyBhaxiDuRNB5XM54c_V8e-S0jPyMceNLpJQmU\"\n }\n}"
response = http.request(request)
puts response.read_body{
"computeBudgetInstructions": [
{
"programId": "ComputeBudget111111111111111111111111111111",
"accounts": [],
"data": "AsBcFQA="
}
],
"setupInstructions": [
{
"programId": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
"accounts": [
{
"pubkey": "YOUR_WALLET_ADDRESS",
"isSigner": true,
"isWritable": true
}
],
"data": "AQ=="
}
],
"tokenLedgerInstruction": null,
"swapInstruction": {
"programId": "RaptorD5ojtsqDDtJeRsunPLg6GvLYNnwKJWxYE4m87",
"accounts": [
{
"pubkey": "YOUR_WALLET_ADDRESS",
"isSigner": true,
"isWritable": true
}
],
"data": "…"
},
"cleanupInstruction": null,
"addressLookupTableAddresses": [
"…"
]
}{
"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
}API Reference
Build Solana Swap Instructions with Raptor
Get individual swap instructions from a Raptor quote so you can add your own and build the transaction yourself. POST /swap-instructions.
POST
/
swap-instructions
Build swap instructions
curl --request POST \
--url https://raptor.solanatracker.io/swap-instructions \
--header 'Content-Type: application/json' \
--data '
{
"userPublicKey": "YOUR_WALLET_ADDRESS",
"quoteResponse": {
"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
}
],
"contextSlot": 454215309,
"timeTaken": 0.026,
"quoteId": "AbvXxjPyBhaxiDuRNB5XM54c_V8e-S0jPyMceNLpJQmU"
}
}
'import requests
url = "https://raptor.solanatracker.io/swap-instructions"
payload = {
"userPublicKey": "YOUR_WALLET_ADDRESS",
"quoteResponse": {
"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
}
],
"contextSlot": 454215309,
"timeTaken": 0.026,
"quoteId": "AbvXxjPyBhaxiDuRNB5XM54c_V8e-S0jPyMceNLpJQmU"
}
}
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',
quoteResponse: {
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
}
],
contextSlot: 454215309,
timeTaken: 0.026,
quoteId: 'AbvXxjPyBhaxiDuRNB5XM54c_V8e-S0jPyMceNLpJQmU'
}
})
};
fetch('https://raptor.solanatracker.io/swap-instructions', 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/swap-instructions",
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',
'quoteResponse' => [
'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
]
],
'contextSlot' => 454215309,
'timeTaken' => 0.026,
'quoteId' => 'AbvXxjPyBhaxiDuRNB5XM54c_V8e-S0jPyMceNLpJQmU'
]
]),
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/swap-instructions"
payload := strings.NewReader("{\n \"userPublicKey\": \"YOUR_WALLET_ADDRESS\",\n \"quoteResponse\": {\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amountIn\": \"100000000\",\n \"amountOut\": \"11703794\",\n \"minAmountOut\": \"11645275\",\n \"priceImpact\": 0,\n \"slippageBps\": 50,\n \"routePlan\": [\n {\n \"programId\": \"9H6tua7jkLhdm3w8BvgpTn5LZNU7g4ZynDmCiNN3q6Rp\",\n \"dex\": \"Humidifi\",\n \"pool\": \"8sKQHfjNhvmAw94PhfvfMcytmqW6jmxvwieYyzXCCPu\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amountIn\": \"100000000\",\n \"amountOut\": \"11703794\",\n \"priceImpact\": 0,\n \"percent\": 100\n }\n ],\n \"contextSlot\": 454215309,\n \"timeTaken\": 0.026,\n \"quoteId\": \"AbvXxjPyBhaxiDuRNB5XM54c_V8e-S0jPyMceNLpJQmU\"\n }\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/swap-instructions")
.header("Content-Type", "application/json")
.body("{\n \"userPublicKey\": \"YOUR_WALLET_ADDRESS\",\n \"quoteResponse\": {\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amountIn\": \"100000000\",\n \"amountOut\": \"11703794\",\n \"minAmountOut\": \"11645275\",\n \"priceImpact\": 0,\n \"slippageBps\": 50,\n \"routePlan\": [\n {\n \"programId\": \"9H6tua7jkLhdm3w8BvgpTn5LZNU7g4ZynDmCiNN3q6Rp\",\n \"dex\": \"Humidifi\",\n \"pool\": \"8sKQHfjNhvmAw94PhfvfMcytmqW6jmxvwieYyzXCCPu\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amountIn\": \"100000000\",\n \"amountOut\": \"11703794\",\n \"priceImpact\": 0,\n \"percent\": 100\n }\n ],\n \"contextSlot\": 454215309,\n \"timeTaken\": 0.026,\n \"quoteId\": \"AbvXxjPyBhaxiDuRNB5XM54c_V8e-S0jPyMceNLpJQmU\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://raptor.solanatracker.io/swap-instructions")
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 \"quoteResponse\": {\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amountIn\": \"100000000\",\n \"amountOut\": \"11703794\",\n \"minAmountOut\": \"11645275\",\n \"priceImpact\": 0,\n \"slippageBps\": 50,\n \"routePlan\": [\n {\n \"programId\": \"9H6tua7jkLhdm3w8BvgpTn5LZNU7g4ZynDmCiNN3q6Rp\",\n \"dex\": \"Humidifi\",\n \"pool\": \"8sKQHfjNhvmAw94PhfvfMcytmqW6jmxvwieYyzXCCPu\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amountIn\": \"100000000\",\n \"amountOut\": \"11703794\",\n \"priceImpact\": 0,\n \"percent\": 100\n }\n ],\n \"contextSlot\": 454215309,\n \"timeTaken\": 0.026,\n \"quoteId\": \"AbvXxjPyBhaxiDuRNB5XM54c_V8e-S0jPyMceNLpJQmU\"\n }\n}"
response = http.request(request)
puts response.read_body{
"computeBudgetInstructions": [
{
"programId": "ComputeBudget111111111111111111111111111111",
"accounts": [],
"data": "AsBcFQA="
}
],
"setupInstructions": [
{
"programId": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
"accounts": [
{
"pubkey": "YOUR_WALLET_ADDRESS",
"isSigner": true,
"isWritable": true
}
],
"data": "AQ=="
}
],
"tokenLedgerInstruction": null,
"swapInstruction": {
"programId": "RaptorD5ojtsqDDtJeRsunPLg6GvLYNnwKJWxYE4m87",
"accounts": [
{
"pubkey": "YOUR_WALLET_ADDRESS",
"isSigner": true,
"isWritable": true
}
],
"data": "…"
},
"cleanupInstruction": null,
"addressLookupTableAddresses": [
"…"
]
}{
"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
}Same input as
/swap, but returns the individual instructions so you can add your own and build the transaction yourself.
The swap is built as an ordinary swap unless you send jitRouting: true, so it can be called from your own program. If the response includes quoteResponse, use its amounts. When topLevelOnly is true, put swapInstruction last in the transaction and do not call it through CPI.Body
application/json
Response
Instructions
Put the instructions in this order: computeBudgetInstructions, setupInstructions, tokenLedgerInstruction, swapInstruction, cleanupInstruction, tipInstruction. Skip any that are null. Exception: if topLevelOnly is true, swapInstruction must be last.
Was this page helpful?