Get Li.Fi swap/bridge routes
curl --request POST \
--url https://api.portalhq.io/api/v3/clients/me/integrations/lifi/routes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fromChainId": "<string>",
"toChainId": "<string>",
"fromTokenAddress": "<string>",
"toTokenAddress": "<string>",
"fromAmount": "<string>",
"fromAddress": "<string>",
"toAddress": "<string>",
"fromAmountForGas": "<string>",
"options": {
"integrator": "<string>",
"fee": 123,
"maxPriceImpact": 123,
"slippage": 123,
"referrer": "<string>",
"allowSwitchChain": true,
"allowDestinationCall": true,
"bridges": {
"allow": [
"<string>"
],
"deny": [
"<string>"
],
"prefer": [
"<string>"
]
},
"exchanges": {
"allow": [
"<string>"
],
"deny": [
"<string>"
],
"prefer": [
"<string>"
]
},
"svmSponsor": "<string>"
}
}
'import requests
url = "https://api.portalhq.io/api/v3/clients/me/integrations/lifi/routes"
payload = {
"fromChainId": "<string>",
"toChainId": "<string>",
"fromTokenAddress": "<string>",
"toTokenAddress": "<string>",
"fromAmount": "<string>",
"fromAddress": "<string>",
"toAddress": "<string>",
"fromAmountForGas": "<string>",
"options": {
"integrator": "<string>",
"fee": 123,
"maxPriceImpact": 123,
"slippage": 123,
"referrer": "<string>",
"allowSwitchChain": True,
"allowDestinationCall": True,
"bridges": {
"allow": ["<string>"],
"deny": ["<string>"],
"prefer": ["<string>"]
},
"exchanges": {
"allow": ["<string>"],
"deny": ["<string>"],
"prefer": ["<string>"]
},
"svmSponsor": "<string>"
}
}
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({
fromChainId: '<string>',
toChainId: '<string>',
fromTokenAddress: '<string>',
toTokenAddress: '<string>',
fromAmount: '<string>',
fromAddress: '<string>',
toAddress: '<string>',
fromAmountForGas: '<string>',
options: {
integrator: '<string>',
fee: 123,
maxPriceImpact: 123,
slippage: 123,
referrer: '<string>',
allowSwitchChain: true,
allowDestinationCall: true,
bridges: {allow: ['<string>'], deny: ['<string>'], prefer: ['<string>']},
exchanges: {allow: ['<string>'], deny: ['<string>'], prefer: ['<string>']},
svmSponsor: '<string>'
}
})
};
fetch('https://api.portalhq.io/api/v3/clients/me/integrations/lifi/routes', 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.portalhq.io/api/v3/clients/me/integrations/lifi/routes",
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([
'fromChainId' => '<string>',
'toChainId' => '<string>',
'fromTokenAddress' => '<string>',
'toTokenAddress' => '<string>',
'fromAmount' => '<string>',
'fromAddress' => '<string>',
'toAddress' => '<string>',
'fromAmountForGas' => '<string>',
'options' => [
'integrator' => '<string>',
'fee' => 123,
'maxPriceImpact' => 123,
'slippage' => 123,
'referrer' => '<string>',
'allowSwitchChain' => true,
'allowDestinationCall' => true,
'bridges' => [
'allow' => [
'<string>'
],
'deny' => [
'<string>'
],
'prefer' => [
'<string>'
]
],
'exchanges' => [
'allow' => [
'<string>'
],
'deny' => [
'<string>'
],
'prefer' => [
'<string>'
]
],
'svmSponsor' => '<string>'
]
]),
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.portalhq.io/api/v3/clients/me/integrations/lifi/routes"
payload := strings.NewReader("{\n \"fromChainId\": \"<string>\",\n \"toChainId\": \"<string>\",\n \"fromTokenAddress\": \"<string>\",\n \"toTokenAddress\": \"<string>\",\n \"fromAmount\": \"<string>\",\n \"fromAddress\": \"<string>\",\n \"toAddress\": \"<string>\",\n \"fromAmountForGas\": \"<string>\",\n \"options\": {\n \"integrator\": \"<string>\",\n \"fee\": 123,\n \"maxPriceImpact\": 123,\n \"slippage\": 123,\n \"referrer\": \"<string>\",\n \"allowSwitchChain\": true,\n \"allowDestinationCall\": true,\n \"bridges\": {\n \"allow\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ],\n \"prefer\": [\n \"<string>\"\n ]\n },\n \"exchanges\": {\n \"allow\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ],\n \"prefer\": [\n \"<string>\"\n ]\n },\n \"svmSponsor\": \"<string>\"\n }\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.portalhq.io/api/v3/clients/me/integrations/lifi/routes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fromChainId\": \"<string>\",\n \"toChainId\": \"<string>\",\n \"fromTokenAddress\": \"<string>\",\n \"toTokenAddress\": \"<string>\",\n \"fromAmount\": \"<string>\",\n \"fromAddress\": \"<string>\",\n \"toAddress\": \"<string>\",\n \"fromAmountForGas\": \"<string>\",\n \"options\": {\n \"integrator\": \"<string>\",\n \"fee\": 123,\n \"maxPriceImpact\": 123,\n \"slippage\": 123,\n \"referrer\": \"<string>\",\n \"allowSwitchChain\": true,\n \"allowDestinationCall\": true,\n \"bridges\": {\n \"allow\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ],\n \"prefer\": [\n \"<string>\"\n ]\n },\n \"exchanges\": {\n \"allow\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ],\n \"prefer\": [\n \"<string>\"\n ]\n },\n \"svmSponsor\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.portalhq.io/api/v3/clients/me/integrations/lifi/routes")
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 \"fromChainId\": \"<string>\",\n \"toChainId\": \"<string>\",\n \"fromTokenAddress\": \"<string>\",\n \"toTokenAddress\": \"<string>\",\n \"fromAmount\": \"<string>\",\n \"fromAddress\": \"<string>\",\n \"toAddress\": \"<string>\",\n \"fromAmountForGas\": \"<string>\",\n \"options\": {\n \"integrator\": \"<string>\",\n \"fee\": 123,\n \"maxPriceImpact\": 123,\n \"slippage\": 123,\n \"referrer\": \"<string>\",\n \"allowSwitchChain\": true,\n \"allowDestinationCall\": true,\n \"bridges\": {\n \"allow\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ],\n \"prefer\": [\n \"<string>\"\n ]\n },\n \"exchanges\": {\n \"allow\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ],\n \"prefer\": [\n \"<string>\"\n ]\n },\n \"svmSponsor\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"rawResponse": {
"routes": [
{}
]
}
}
}{
"error": "<string>"
}{
"error": "<string>"
}Li.Fi
Get Li.Fi swap/bridge routes
Retrieves multiple possible routes for a cross-chain or same-chain swap, each with different trade-offs (speed, cost, safety).
POST
/
clients
/
me
/
integrations
/
lifi
/
routes
Get Li.Fi swap/bridge routes
curl --request POST \
--url https://api.portalhq.io/api/v3/clients/me/integrations/lifi/routes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fromChainId": "<string>",
"toChainId": "<string>",
"fromTokenAddress": "<string>",
"toTokenAddress": "<string>",
"fromAmount": "<string>",
"fromAddress": "<string>",
"toAddress": "<string>",
"fromAmountForGas": "<string>",
"options": {
"integrator": "<string>",
"fee": 123,
"maxPriceImpact": 123,
"slippage": 123,
"referrer": "<string>",
"allowSwitchChain": true,
"allowDestinationCall": true,
"bridges": {
"allow": [
"<string>"
],
"deny": [
"<string>"
],
"prefer": [
"<string>"
]
},
"exchanges": {
"allow": [
"<string>"
],
"deny": [
"<string>"
],
"prefer": [
"<string>"
]
},
"svmSponsor": "<string>"
}
}
'import requests
url = "https://api.portalhq.io/api/v3/clients/me/integrations/lifi/routes"
payload = {
"fromChainId": "<string>",
"toChainId": "<string>",
"fromTokenAddress": "<string>",
"toTokenAddress": "<string>",
"fromAmount": "<string>",
"fromAddress": "<string>",
"toAddress": "<string>",
"fromAmountForGas": "<string>",
"options": {
"integrator": "<string>",
"fee": 123,
"maxPriceImpact": 123,
"slippage": 123,
"referrer": "<string>",
"allowSwitchChain": True,
"allowDestinationCall": True,
"bridges": {
"allow": ["<string>"],
"deny": ["<string>"],
"prefer": ["<string>"]
},
"exchanges": {
"allow": ["<string>"],
"deny": ["<string>"],
"prefer": ["<string>"]
},
"svmSponsor": "<string>"
}
}
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({
fromChainId: '<string>',
toChainId: '<string>',
fromTokenAddress: '<string>',
toTokenAddress: '<string>',
fromAmount: '<string>',
fromAddress: '<string>',
toAddress: '<string>',
fromAmountForGas: '<string>',
options: {
integrator: '<string>',
fee: 123,
maxPriceImpact: 123,
slippage: 123,
referrer: '<string>',
allowSwitchChain: true,
allowDestinationCall: true,
bridges: {allow: ['<string>'], deny: ['<string>'], prefer: ['<string>']},
exchanges: {allow: ['<string>'], deny: ['<string>'], prefer: ['<string>']},
svmSponsor: '<string>'
}
})
};
fetch('https://api.portalhq.io/api/v3/clients/me/integrations/lifi/routes', 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.portalhq.io/api/v3/clients/me/integrations/lifi/routes",
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([
'fromChainId' => '<string>',
'toChainId' => '<string>',
'fromTokenAddress' => '<string>',
'toTokenAddress' => '<string>',
'fromAmount' => '<string>',
'fromAddress' => '<string>',
'toAddress' => '<string>',
'fromAmountForGas' => '<string>',
'options' => [
'integrator' => '<string>',
'fee' => 123,
'maxPriceImpact' => 123,
'slippage' => 123,
'referrer' => '<string>',
'allowSwitchChain' => true,
'allowDestinationCall' => true,
'bridges' => [
'allow' => [
'<string>'
],
'deny' => [
'<string>'
],
'prefer' => [
'<string>'
]
],
'exchanges' => [
'allow' => [
'<string>'
],
'deny' => [
'<string>'
],
'prefer' => [
'<string>'
]
],
'svmSponsor' => '<string>'
]
]),
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.portalhq.io/api/v3/clients/me/integrations/lifi/routes"
payload := strings.NewReader("{\n \"fromChainId\": \"<string>\",\n \"toChainId\": \"<string>\",\n \"fromTokenAddress\": \"<string>\",\n \"toTokenAddress\": \"<string>\",\n \"fromAmount\": \"<string>\",\n \"fromAddress\": \"<string>\",\n \"toAddress\": \"<string>\",\n \"fromAmountForGas\": \"<string>\",\n \"options\": {\n \"integrator\": \"<string>\",\n \"fee\": 123,\n \"maxPriceImpact\": 123,\n \"slippage\": 123,\n \"referrer\": \"<string>\",\n \"allowSwitchChain\": true,\n \"allowDestinationCall\": true,\n \"bridges\": {\n \"allow\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ],\n \"prefer\": [\n \"<string>\"\n ]\n },\n \"exchanges\": {\n \"allow\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ],\n \"prefer\": [\n \"<string>\"\n ]\n },\n \"svmSponsor\": \"<string>\"\n }\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.portalhq.io/api/v3/clients/me/integrations/lifi/routes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fromChainId\": \"<string>\",\n \"toChainId\": \"<string>\",\n \"fromTokenAddress\": \"<string>\",\n \"toTokenAddress\": \"<string>\",\n \"fromAmount\": \"<string>\",\n \"fromAddress\": \"<string>\",\n \"toAddress\": \"<string>\",\n \"fromAmountForGas\": \"<string>\",\n \"options\": {\n \"integrator\": \"<string>\",\n \"fee\": 123,\n \"maxPriceImpact\": 123,\n \"slippage\": 123,\n \"referrer\": \"<string>\",\n \"allowSwitchChain\": true,\n \"allowDestinationCall\": true,\n \"bridges\": {\n \"allow\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ],\n \"prefer\": [\n \"<string>\"\n ]\n },\n \"exchanges\": {\n \"allow\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ],\n \"prefer\": [\n \"<string>\"\n ]\n },\n \"svmSponsor\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.portalhq.io/api/v3/clients/me/integrations/lifi/routes")
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 \"fromChainId\": \"<string>\",\n \"toChainId\": \"<string>\",\n \"fromTokenAddress\": \"<string>\",\n \"toTokenAddress\": \"<string>\",\n \"fromAmount\": \"<string>\",\n \"fromAddress\": \"<string>\",\n \"toAddress\": \"<string>\",\n \"fromAmountForGas\": \"<string>\",\n \"options\": {\n \"integrator\": \"<string>\",\n \"fee\": 123,\n \"maxPriceImpact\": 123,\n \"slippage\": 123,\n \"referrer\": \"<string>\",\n \"allowSwitchChain\": true,\n \"allowDestinationCall\": true,\n \"bridges\": {\n \"allow\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ],\n \"prefer\": [\n \"<string>\"\n ]\n },\n \"exchanges\": {\n \"allow\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ],\n \"prefer\": [\n \"<string>\"\n ]\n },\n \"svmSponsor\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"rawResponse": {
"routes": [
{}
]
}
}
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Client API Key or Client Session Token (CST). Pass as a Bearer token in the Authorization header.
Body
application/json
Source chain ID in CAIP-2 format (e.g. eip155:1).
Destination chain ID in CAIP-2 format (e.g. eip155:137).
Source token contract address.
Destination token contract address.
Amount to swap in the smallest unit of the source token.
Sender address.
Recipient address.
Amount of the source token to swap into destination-chain gas before bridging.
Optional routing preferences.
Show child attributes
Show child attributes
Response
Routes retrieved successfully
Show child attributes
Show child attributes
Was this page helpful?
⌘I