Find a route
curl --request GET \
--url https://api.swap.shield.fi/route \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.swap.shield.fi/route"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.swap.shield.fi/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://api.swap.shield.fi/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: Bearer <token>"
],
]);
$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://api.swap.shield.fi/route"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.swap.shield.fi/route")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swap.shield.fi/route")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"hops": [
{
"fee": "<string>",
"initialized_ticks": [
123
],
"pool_key": "<string>",
"token_in": "<string>",
"token_out": "<string>",
"zero_for_one": true,
"active_tick": 123,
"liquidity": "<string>",
"price": "<string>",
"sqrt_price_raw": "<string>",
"tick_spacing": 123
}
],
"protocol_revision": 123,
"token_in": "<string>",
"token_out": "<string>",
"estimated_amount_out": "<string>",
"protocol_config_observed_block": 123
}
}{
"error": "<string>",
"ref": "<string>"
}{
"error": "<string>",
"ref": "<string>"
}{
"error": "<string>",
"ref": "<string>"
}Find a route
Find an indexed Shield Swap route between two tokens.
GET
/
route
Find a route
curl --request GET \
--url https://api.swap.shield.fi/route \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.swap.shield.fi/route"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.swap.shield.fi/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://api.swap.shield.fi/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: Bearer <token>"
],
]);
$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://api.swap.shield.fi/route"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.swap.shield.fi/route")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swap.shield.fi/route")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"hops": [
{
"fee": "<string>",
"initialized_ticks": [
123
],
"pool_key": "<string>",
"token_in": "<string>",
"token_out": "<string>",
"zero_for_one": true,
"active_tick": 123,
"liquidity": "<string>",
"price": "<string>",
"sqrt_price_raw": "<string>",
"tick_spacing": 123
}
],
"protocol_revision": 123,
"token_in": "<string>",
"token_out": "<string>",
"estimated_amount_out": "<string>",
"protocol_config_observed_block": 123
}
}{
"error": "<string>",
"ref": "<string>"
}{
"error": "<string>",
"ref": "<string>"
}{
"error": "<string>",
"ref": "<string>"
}Authorizations
Session JWT (browsers receive it as an httpOnly cookie from POST /auth/verify; 15 min, silently renewed via POST /auth/refresh), or a long-lived API token (ss_…) minted at POST /api-tokens. API tokens work on data and trading endpoints and can request WebSocket tickets; token management and admin endpoints accept session JWTs only.
Query Parameters
Input token ID
Output token ID
Optional positive canonical decimal amount for output estimation
Optional pool key. The route uses only this pool, as a single hop, with no fallback.
Response
Best swap route (max 3 hops)
Show child attributes
Show child attributes
⌘I