Skip to main content
GET
/
getPaths
Get Paths
curl --request GET \
  --url https://api-v2.swaps.xyz/api/getPaths \
  --header 'x-api-key: <api-key>'
import requests

url = "https://api-v2.swaps.xyz/api/getPaths"

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-v2.swaps.xyz/api/getPaths', 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-v2.swaps.xyz/api/getPaths",
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-v2.swaps.xyz/api/getPaths"

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-v2.swaps.xyz/api/getPaths")
.header("x-api-key", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api-v2.swaps.xyz/api/getPaths")

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
{
  "srcChainId": 123,
  "srcToken": {
    "chainId": 123,
    "address": "<string>",
    "name": "<string>",
    "symbol": "<string>",
    "decimals": 123,
    "isNative": true,
    "minAmount": "<string>",
    "maxAmount": "<string>",
    "logo": "<string>",
    "swapsXyzCode": "<string>"
  },
  "paths": [
    {
      "chainId": 123,
      "tokens": "all",
      "supportsExactAmountIn": true,
      "supportsExactAmountOut": true,
      "amountLimits": {
        "minAmount": "<string>",
        "maxAmount": "<string>"
      }
    }
  ],
  "timestamp": "<string>"
}
{
"success": false,
"error": {
"code": "<string>",
"name": "<string>",
"message": "<string>",
"title": "<string>",
"statusCode": 123,
"timestamp": "<string>",
"details": {}
}
}
{
"success": false,
"error": {
"code": "<string>",
"name": "<string>",
"message": "<string>",
"title": "<string>",
"statusCode": 123,
"timestamp": "<string>",
"details": {}
}
}

Authorizations

x-api-key
string
header
required

Limited demo key for API Reference: 5c951bc81da566bbd030ba8e20724063.

Query Parameters

srcChainId
integer
required

Source chain ID Chain ID. Find in the list of supported networks.

srcToken
string
required

Source token address

dstChainId
integer

Recommended: destination chain ID Chain ID. Find in the list of supported networks.

dstToken
string

Recommended: destination token address

excludeBridgeIds
string[]

Bridge IDs to exclude from routing

Bridge protocol identifier (e.g. "across", "relay", "mayan").

excludeDexIds
string[]

DEX IDs to exclude from routing

DEX identifier (depends on integration)

Response

Paths response

srcChainId
integer
required

The source chain ID

srcToken
object
required

Source token information including amount limits

paths
object[]
required
timestamp
string
required

Response timestamp (ISO string) for cache validation