List chains
curl --request GET \
--url https://api.ternswap.xyz/v1/chains \
--header 'x-api-key: <api-key>'import requests
url = "https://api.ternswap.xyz/v1/chains"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.ternswap.xyz/v1/chains', 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.ternswap.xyz/v1/chains",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$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.ternswap.xyz/v1/chains"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
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.ternswap.xyz/v1/chains")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ternswap.xyz/v1/chains")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"chains": [
{
"chain": "base",
"type": "evm",
"chainId": 8453,
"escrow": "0x53cac833e629e7453197a2808da550dd9c535d6d",
"assets": [
{
"asset": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"decimals": 6,
"logoURI": "https://assets.coingecko.com/coins/images/6319/large/USDC.png",
"verified": true
}
],
"anyAsset": true
},
{
"chain": "starknet",
"type": "starknet",
"chainId": "0x534e5f4d41494e",
"escrow": "0x0412cfc5d8b6e0b1a0f8c1e5d2b7a9c4e3f6d8b1a2c5e7f9d0b3a6c8e1f4d7b2",
"assets": [
{
"asset": "0x53c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8",
"symbol": "USDC",
"decimals": 6,
"logoURI": null,
"verified": false
}
],
"anyAsset": false
}
]
}{
"type": "https://docs.ternswap.xyz/api-reference/errors#no_route",
"title": "No route",
"status": 422,
"code": "invalid_request",
"detail": "no solver quoted this route",
"requestId": "01JC2W6Q0Z8V5K3M7N1P4R9T2X",
"errors": [
{
"pointer": "#/fromAmount",
"detail": "must be a positive base-10 integer"
}
]
}{
"type": "https://docs.ternswap.xyz/api-reference/errors#no_route",
"title": "No route",
"status": 422,
"code": "invalid_request",
"detail": "no solver quoted this route",
"requestId": "01JC2W6Q0Z8V5K3M7N1P4R9T2X",
"errors": [
{
"pointer": "#/fromAmount",
"detail": "must be a positive base-10 integer"
}
]
}{
"type": "https://docs.ternswap.xyz/api-reference/errors#no_route",
"title": "No route",
"status": 422,
"code": "invalid_request",
"detail": "no solver quoted this route",
"requestId": "01JC2W6Q0Z8V5K3M7N1P4R9T2X",
"errors": [
{
"pointer": "#/fromAmount",
"detail": "must be a positive base-10 integer"
}
]
}Chains
List chains
Supported chains, and the assets solvers connected now advertise on each. anyAsset is true when any token with
enough DEX liquidity can be quoted on the chain: a connected solver accepts any token there, or the chain has
same-chain swaps, whose routers price any token.
Each asset has a logoURI (null until one is found) and verified: true when CoinGecko lists the token at that
address. Logos are matched by address, never by symbol, so an unverified token may carry a familiar symbol. To show
a quote leg’s logo, look up its (chain, asset) here.
GET
/
v1
/
chains
List chains
curl --request GET \
--url https://api.ternswap.xyz/v1/chains \
--header 'x-api-key: <api-key>'import requests
url = "https://api.ternswap.xyz/v1/chains"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.ternswap.xyz/v1/chains', 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.ternswap.xyz/v1/chains",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$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.ternswap.xyz/v1/chains"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
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.ternswap.xyz/v1/chains")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ternswap.xyz/v1/chains")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"chains": [
{
"chain": "base",
"type": "evm",
"chainId": 8453,
"escrow": "0x53cac833e629e7453197a2808da550dd9c535d6d",
"assets": [
{
"asset": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"decimals": 6,
"logoURI": "https://assets.coingecko.com/coins/images/6319/large/USDC.png",
"verified": true
}
],
"anyAsset": true
},
{
"chain": "starknet",
"type": "starknet",
"chainId": "0x534e5f4d41494e",
"escrow": "0x0412cfc5d8b6e0b1a0f8c1e5d2b7a9c4e3f6d8b1a2c5e7f9d0b3a6c8e1f4d7b2",
"assets": [
{
"asset": "0x53c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8",
"symbol": "USDC",
"decimals": 6,
"logoURI": null,
"verified": false
}
],
"anyAsset": false
}
]
}{
"type": "https://docs.ternswap.xyz/api-reference/errors#no_route",
"title": "No route",
"status": 422,
"code": "invalid_request",
"detail": "no solver quoted this route",
"requestId": "01JC2W6Q0Z8V5K3M7N1P4R9T2X",
"errors": [
{
"pointer": "#/fromAmount",
"detail": "must be a positive base-10 integer"
}
]
}{
"type": "https://docs.ternswap.xyz/api-reference/errors#no_route",
"title": "No route",
"status": 422,
"code": "invalid_request",
"detail": "no solver quoted this route",
"requestId": "01JC2W6Q0Z8V5K3M7N1P4R9T2X",
"errors": [
{
"pointer": "#/fromAmount",
"detail": "must be a positive base-10 integer"
}
]
}{
"type": "https://docs.ternswap.xyz/api-reference/errors#no_route",
"title": "No route",
"status": 422,
"code": "invalid_request",
"detail": "no solver quoted this route",
"requestId": "01JC2W6Q0Z8V5K3M7N1P4R9T2X",
"errors": [
{
"pointer": "#/fromAmount",
"detail": "must be a positive base-10 integer"
}
]
}