curl --request POST \
--url https://router-api.initia.xyz/v2/fungible/route \
--header 'Content-Type: application/json' \
--data '
{
"amount_in": "1000000",
"source_asset_chain_id": "interwoven-1",
"source_asset_denom": "uinit",
"dest_asset_chain_id": "8453",
"dest_asset_denom": "0x...",
"allow_unsafe": true
}
'import requests
url = "https://router-api.initia.xyz/v2/fungible/route"
payload = {
"amount_in": "1000000",
"source_asset_chain_id": "interwoven-1",
"source_asset_denom": "uinit",
"dest_asset_chain_id": "8453",
"dest_asset_denom": "0x...",
"allow_unsafe": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount_in: '1000000',
source_asset_chain_id: 'interwoven-1',
source_asset_denom: 'uinit',
dest_asset_chain_id: '8453',
dest_asset_denom: '0x...',
allow_unsafe: true
})
};
fetch('https://router-api.initia.xyz/v2/fungible/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://router-api.initia.xyz/v2/fungible/route",
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([
'amount_in' => '1000000',
'source_asset_chain_id' => 'interwoven-1',
'source_asset_denom' => 'uinit',
'dest_asset_chain_id' => '8453',
'dest_asset_denom' => '0x...',
'allow_unsafe' => true
]),
CURLOPT_HTTPHEADER => [
"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://router-api.initia.xyz/v2/fungible/route"
payload := strings.NewReader("{\n \"amount_in\": \"1000000\",\n \"source_asset_chain_id\": \"interwoven-1\",\n \"source_asset_denom\": \"uinit\",\n \"dest_asset_chain_id\": \"8453\",\n \"dest_asset_denom\": \"0x...\",\n \"allow_unsafe\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
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://router-api.initia.xyz/v2/fungible/route")
.header("Content-Type", "application/json")
.body("{\n \"amount_in\": \"1000000\",\n \"source_asset_chain_id\": \"interwoven-1\",\n \"source_asset_denom\": \"uinit\",\n \"dest_asset_chain_id\": \"8453\",\n \"dest_asset_denom\": \"0x...\",\n \"allow_unsafe\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://router-api.initia.xyz/v2/fungible/route")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount_in\": \"1000000\",\n \"source_asset_chain_id\": \"interwoven-1\",\n \"source_asset_denom\": \"uinit\",\n \"dest_asset_chain_id\": \"8453\",\n \"dest_asset_denom\": \"0x...\",\n \"allow_unsafe\": true\n}"
response = http.request(request)
puts response.read_body{
"amount_in": "1000000",
"amount_out": "999000",
"source_asset_chain_id": "interwoven-1",
"source_asset_denom": "uinit",
"dest_asset_chain_id": "8453",
"dest_asset_denom": "0x...",
"operations": [],
"required_chain_addresses": [
"interwoven-1",
"8453"
],
"chain_ids": [
"interwoven-1",
"8453"
],
"does_swap": false,
"estimated_amount_out": "999000",
"estimated_fees": [],
"estimated_route_duration_seconds": 60,
"txs_required": 1,
"swap_venues": [],
"usd_amount_in": "1.50",
"usd_amount_out": "1.49",
"warning": null,
"extra_warnings": null,
"required_op_hook": false
}Compute Route
This is the first step when bridging tokens between chains. Call this endpoint with your source and destination assets to find the optimal transfer route. The response includes the expected output amount, USD value estimates, and an ordered list of operations.
After receiving a route, pass the full response (including operations) to the Generate Transaction endpoint (POST /v2/fungible/msgs) to get signable transaction messages you can broadcast.
curl --request POST \
--url https://router-api.initia.xyz/v2/fungible/route \
--header 'Content-Type: application/json' \
--data '
{
"amount_in": "1000000",
"source_asset_chain_id": "interwoven-1",
"source_asset_denom": "uinit",
"dest_asset_chain_id": "8453",
"dest_asset_denom": "0x...",
"allow_unsafe": true
}
'import requests
url = "https://router-api.initia.xyz/v2/fungible/route"
payload = {
"amount_in": "1000000",
"source_asset_chain_id": "interwoven-1",
"source_asset_denom": "uinit",
"dest_asset_chain_id": "8453",
"dest_asset_denom": "0x...",
"allow_unsafe": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount_in: '1000000',
source_asset_chain_id: 'interwoven-1',
source_asset_denom: 'uinit',
dest_asset_chain_id: '8453',
dest_asset_denom: '0x...',
allow_unsafe: true
})
};
fetch('https://router-api.initia.xyz/v2/fungible/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://router-api.initia.xyz/v2/fungible/route",
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([
'amount_in' => '1000000',
'source_asset_chain_id' => 'interwoven-1',
'source_asset_denom' => 'uinit',
'dest_asset_chain_id' => '8453',
'dest_asset_denom' => '0x...',
'allow_unsafe' => true
]),
CURLOPT_HTTPHEADER => [
"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://router-api.initia.xyz/v2/fungible/route"
payload := strings.NewReader("{\n \"amount_in\": \"1000000\",\n \"source_asset_chain_id\": \"interwoven-1\",\n \"source_asset_denom\": \"uinit\",\n \"dest_asset_chain_id\": \"8453\",\n \"dest_asset_denom\": \"0x...\",\n \"allow_unsafe\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
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://router-api.initia.xyz/v2/fungible/route")
.header("Content-Type", "application/json")
.body("{\n \"amount_in\": \"1000000\",\n \"source_asset_chain_id\": \"interwoven-1\",\n \"source_asset_denom\": \"uinit\",\n \"dest_asset_chain_id\": \"8453\",\n \"dest_asset_denom\": \"0x...\",\n \"allow_unsafe\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://router-api.initia.xyz/v2/fungible/route")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount_in\": \"1000000\",\n \"source_asset_chain_id\": \"interwoven-1\",\n \"source_asset_denom\": \"uinit\",\n \"dest_asset_chain_id\": \"8453\",\n \"dest_asset_denom\": \"0x...\",\n \"allow_unsafe\": true\n}"
response = http.request(request)
puts response.read_body{
"amount_in": "1000000",
"amount_out": "999000",
"source_asset_chain_id": "interwoven-1",
"source_asset_denom": "uinit",
"dest_asset_chain_id": "8453",
"dest_asset_denom": "0x...",
"operations": [],
"required_chain_addresses": [
"interwoven-1",
"8453"
],
"chain_ids": [
"interwoven-1",
"8453"
],
"does_swap": false,
"estimated_amount_out": "999000",
"estimated_fees": [],
"estimated_route_duration_seconds": 60,
"txs_required": 1,
"swap_venues": [],
"usd_amount_in": "1.50",
"usd_amount_out": "1.49",
"warning": null,
"extra_warnings": null,
"required_op_hook": false
}Body
Amount to send in the smallest denomination (e.g. "1000000" for 1 INIT).
Source chain ID.
Source asset denomination.
Destination chain ID.
Destination asset denomination.
Allow routes that may have higher risk.
Use Go Fast bridging. Automatically determined if not set.
Force an Optimistic withdrawal route.
Response
Successful response
Input amount.
Expected output amount.
Source chain ID.
Source asset denom.
Destination chain ID.
Destination asset denom.
Ordered list of transfer operations to execute.
All chain IDs that require an address, in order of usage by operations in the route. Use this to populate the address_list parameter in the Generate Transaction request.
Ordered list of all chain IDs involved in the route.
Whether the route involves a token swap.
Estimated output amount before fees and slippage adjustments.
Estimated fees for the route. Each entry describes a fee with its amount, behavior, and the originating asset.
Show child attributes
Show child attributes
Estimated time in seconds for the route to complete.
Number of transactions required to execute the route.
DEX venues used for swaps in the route, if any.
Show child attributes
Show child attributes
Primary DEX venue used for the route's swap.
Show child attributes
Show child attributes
Estimated price impact percentage for the swap.
USD value of the input amount.
USD value of the output amount.
Price impact warning (present when impact exceeds 5%).
Show child attributes
Show child attributes
Additional warning messages for the route, such as withdrawal duration notices.
Whether an OP hook is required for this route.
Was this page helpful?