curl --request POST \
--url https://api.vulcx.xyz/api/v1/swap \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"userWallet": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG",
"amount": "1000000000",
"swapMode": "ExactIn",
"slippageBps": 50,
"skipSimulation": false
}
'import requests
url = "https://api.vulcx.xyz/api/v1/swap"
payload = {
"userWallet": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG",
"amount": "1000000000",
"swapMode": "ExactIn",
"slippageBps": 50,
"skipSimulation": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
userWallet: '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM',
inputMint: 'So11111111111111111111111111111111111111112',
outputMint: 'uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG',
amount: '1000000000',
swapMode: 'ExactIn',
slippageBps: 50,
skipSimulation: false
})
};
fetch('https://api.vulcx.xyz/api/v1/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://api.vulcx.xyz/api/v1/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([
'userWallet' => '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM',
'inputMint' => 'So11111111111111111111111111111111111111112',
'outputMint' => 'uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG',
'amount' => '1000000000',
'swapMode' => 'ExactIn',
'slippageBps' => 50,
'skipSimulation' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.vulcx.xyz/api/v1/swap"
payload := strings.NewReader("{\n \"userWallet\": \"9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG\",\n \"amount\": \"1000000000\",\n \"swapMode\": \"ExactIn\",\n \"slippageBps\": 50,\n \"skipSimulation\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.vulcx.xyz/api/v1/swap")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"userWallet\": \"9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG\",\n \"amount\": \"1000000000\",\n \"swapMode\": \"ExactIn\",\n \"slippageBps\": 50,\n \"skipSimulation\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vulcx.xyz/api/v1/swap")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userWallet\": \"9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG\",\n \"amount\": \"1000000000\",\n \"swapMode\": \"ExactIn\",\n \"slippageBps\": 50,\n \"skipSimulation\": false\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"transaction": "<string>",
"lastValidBlockHeight": 245832190,
"amountIn": "1000000000",
"amountOut": "145320000",
"feeAmount": "0",
"route": [
"<string>"
],
"hopCount": 1,
"pools": [
"<string>"
],
"minAmountOut": "<string>",
"maxAmountIn": "<string>",
"simulation": {
"success": true,
"logs": [
"<string>"
],
"computeUnitsConsumed": 85000,
"insufficientFunds": true,
"slippageExceeded": true,
"error": "<string>"
},
"computeUnitsEstimate": 85000,
"isSplitRoute": false,
"splitPercents": [
123
]
}
}{
"success": false,
"error": "no route found"
}{
"success": false,
"error": "no route found"
}{
"success": false,
"error": "no route found"
}Build Swap
POST /api/v1/swap — Build an unsigned swap transaction ready to sign and submit.
curl --request POST \
--url https://api.vulcx.xyz/api/v1/swap \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"userWallet": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG",
"amount": "1000000000",
"swapMode": "ExactIn",
"slippageBps": 50,
"skipSimulation": false
}
'import requests
url = "https://api.vulcx.xyz/api/v1/swap"
payload = {
"userWallet": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG",
"amount": "1000000000",
"swapMode": "ExactIn",
"slippageBps": 50,
"skipSimulation": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
userWallet: '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM',
inputMint: 'So11111111111111111111111111111111111111112',
outputMint: 'uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG',
amount: '1000000000',
swapMode: 'ExactIn',
slippageBps: 50,
skipSimulation: false
})
};
fetch('https://api.vulcx.xyz/api/v1/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://api.vulcx.xyz/api/v1/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([
'userWallet' => '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM',
'inputMint' => 'So11111111111111111111111111111111111111112',
'outputMint' => 'uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG',
'amount' => '1000000000',
'swapMode' => 'ExactIn',
'slippageBps' => 50,
'skipSimulation' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.vulcx.xyz/api/v1/swap"
payload := strings.NewReader("{\n \"userWallet\": \"9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG\",\n \"amount\": \"1000000000\",\n \"swapMode\": \"ExactIn\",\n \"slippageBps\": 50,\n \"skipSimulation\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.vulcx.xyz/api/v1/swap")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"userWallet\": \"9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG\",\n \"amount\": \"1000000000\",\n \"swapMode\": \"ExactIn\",\n \"slippageBps\": 50,\n \"skipSimulation\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vulcx.xyz/api/v1/swap")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userWallet\": \"9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM\",\n \"inputMint\": \"So11111111111111111111111111111111111111112\",\n \"outputMint\": \"uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG\",\n \"amount\": \"1000000000\",\n \"swapMode\": \"ExactIn\",\n \"slippageBps\": 50,\n \"skipSimulation\": false\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"transaction": "<string>",
"lastValidBlockHeight": 245832190,
"amountIn": "1000000000",
"amountOut": "145320000",
"feeAmount": "0",
"route": [
"<string>"
],
"hopCount": 1,
"pools": [
"<string>"
],
"minAmountOut": "<string>",
"maxAmountIn": "<string>",
"simulation": {
"success": true,
"logs": [
"<string>"
],
"computeUnitsConsumed": 85000,
"insufficientFunds": true,
"slippageExceeded": true,
"error": "<string>"
},
"computeUnitsEstimate": 85000,
"isSplitRoute": false,
"splitPercents": [
123
]
}
}{
"success": false,
"error": "no route found"
}{
"success": false,
"error": "no route found"
}{
"success": false,
"error": "no route found"
}Authorizations
API key sent as Authorization: Bearer vulcx_.... Required on every endpoint except GET /health and GET /api/v1/tokens.
Body
Parameters for building a swap transaction.
User's wallet address that will sign and execute the transaction.
"9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"
Input token mint address.
"So11111111111111111111111111111111111111112"
Output token mint address.
"uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG"
Amount in smallest token units.
"1000000000"
ExactIn: amount is exact input. ExactOut: amount is exact desired output.
ExactIn, ExactOut "ExactIn"
Slippage tolerance in basis points. Default: 50 (0.5%).
50
Skip transaction simulation. Faster but no pre-flight validation. Default: false.
false