curl --request GET \
--url https://swaps.sprinter.tech/mainnet/v1/route \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://swaps.sprinter.tech/mainnet/v1/route"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://swaps.sprinter.tech/mainnet/v1/route', 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://swaps.sprinter.tech/mainnet/v1/route",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$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://swaps.sprinter.tech/mainnet/v1/route"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://swaps.sprinter.tech/mainnet/v1/route")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://swaps.sprinter.tech/mainnet/v1/route")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"requestId": "<string>",
"amountOut": "<string>",
"minAmountOut": "<string>",
"target": "<string>",
"callData": "<string>",
"gasUsed": 180000,
"gasLimit": 234000
}{
"code": 123,
"requestId": "<string>",
"error": "<string>"
}{
"code": 123,
"requestId": "<string>",
"error": "<string>"
}{
"code": 123,
"requestId": "<string>",
"error": "<string>"
}{
"code": 123,
"requestId": "<string>",
"error": "<string>"
}Route
Calculate the optimal swap route and generate execution parameters for a token exchange
curl --request GET \
--url https://swaps.sprinter.tech/mainnet/v1/route \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://swaps.sprinter.tech/mainnet/v1/route"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://swaps.sprinter.tech/mainnet/v1/route', 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://swaps.sprinter.tech/mainnet/v1/route",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$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://swaps.sprinter.tech/mainnet/v1/route"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://swaps.sprinter.tech/mainnet/v1/route")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://swaps.sprinter.tech/mainnet/v1/route")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"requestId": "<string>",
"amountOut": "<string>",
"minAmountOut": "<string>",
"target": "<string>",
"callData": "<string>",
"gasUsed": 180000,
"gasLimit": 234000
}{
"code": 123,
"requestId": "<string>",
"error": "<string>"
}{
"code": 123,
"requestId": "<string>",
"error": "<string>"
}{
"code": 123,
"requestId": "<string>",
"error": "<string>"
}{
"code": 123,
"requestId": "<string>",
"error": "<string>"
}Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Query Parameters
The amount of input tokens to swap (in token's smallest unit)
^[0-9]+$"5000000000"
Contract address of the input token to sell. The zero address (0x00…00) represents the native currency ETH.
^0x[a-fA-F0-9]{40}$"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
Contract address of the output token to buy. The zero address (0x00…00) represents the native currency ETH.
^0x[a-fA-F0-9]{40}$"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
The slippage tolerance in basis points (e.g., 50 for 0.5%)
0 <= x <= 10000Optional timeout in milliseconds. If set, returns the best pathfinder result within the timeout window. Must be a positive integer.
x >= 1Response
Successfully calculated swap route with execution details
Successfully created route with execution details
Unique request identifier (16 bytes) encoded as hexadecimal with 0x prefix
^0x[a-fA-F0-9]{32}$Amount of tokens to receive
^[0-9]+$Minimum amount of tokens to receive after slippage
^[0-9]+$The target contract address for the swap
^0x[a-fA-F0-9]{40}$Hex encoded calldata for the swap
^0x[a-fA-F0-9]*$Actual gas consumed by the swap simulation
x >= 0180000
Recommended gas limit for the swap transaction (gasUsed * 1.3)
x >= 0234000