Skip to main content
GET
/
router
/
optimal-route
Find optimal cross-chain transfer route
curl --request GET \
  --url https://api.chainrails.io/api/v1/router/optimal-route \
  --header 'Authorization: Bearer <token>'
{
  "sourceChain": "BASE_TESTNET",
  "destinationChain": "ARBITRUM_TESTNET",
  "tokenIn": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "tokenOut": "0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4",
  "originalAmount": "10000000",
  "totalFees": "18000",
  "bridgeToUse": "CCTP",
  "bridgeAddress": "0xa1c943058a631D5506eb7d96036eAbF6968e2338",
  "bridgeExtraData": "0x00000000000000000000000000000000000000000000000000000000000001f4",
  "supportedBridges": [
    "ACROSS",
    "CCTP"
  ],
  "bridgeFeeDetails": {
    "maxFee": "8000"
  }
}

Authorizations

Authorization
string
header
required

Enter your Chainrails API key as a Bearer token

Query Parameters

tokenIn
string
required

Input token address

Example:

"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"

tokenOut
string
required

Output token address

Example:

"0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4"

sourceChain
enum<string>
required

Source blockchain

Available options:
ARBITRUM_MAINNET,
ARBITRUM_TESTNET,
AVALANCHE_MAINNET,
AVALANCHE_TESTNET,
BASE_MAINNET,
BASE_TESTNET,
STARKNET_MAINNET,
STARKNET_TESTNET,
BSC_MAINNET,
ETHEREUM_MAINNET,
ETHEREUM_TESTNET
Example:

"BASE_TESTNET"

destinationChain
enum<string>
required

Destination blockchain

Available options:
ARBITRUM_MAINNET,
ARBITRUM_TESTNET,
AVALANCHE_MAINNET,
AVALANCHE_TESTNET,
BASE_MAINNET,
BASE_TESTNET,
STARKNET_MAINNET,
STARKNET_TESTNET,
BSC_MAINNET,
ETHEREUM_MAINNET,
ETHEREUM_TESTNET
Example:

"ARBITRUM_TESTNET"

amount
string
required

Amount in token units

Example:

"10000000"

recipient
string

Optional recipient address

Example:

"0x742d35Cc6635C0532925a3b8D62A7fe7B58123D1"

Response

Optimal route found successfully

sourceChain
string
Example:

"BASE_TESTNET"

destinationChain
string
Example:

"ARBITRUM_TESTNET"

tokenIn
string
Example:

"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"

tokenOut
string
Example:

"0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4"

originalAmount
string

Original transfer amount

Example:

"10000000"

totalFees
string

Total fees (bridge fee + ChainRails fee)

Example:

"18000"

bridgeToUse
enum<string> | null
Available options:
ACROSS,
CCTP,
GATEWAY,
RHINOFI
Example:

"CCTP"

bridgeAddress
string
Example:

"0xa1c943058a631D5506eb7d96036eAbF6968e2338"

bridgeExtraData
string
Example:

"0x00000000000000000000000000000000000000000000000000000000000001f4"

supportedBridges
enum<string>[]
Available options:
ACROSS,
CCTP,
GATEWAY,
RHINOFI
Example:
["ACROSS", "CCTP"]
bridgeFeeDetails
object

Bridge-specific fee details (structure varies by bridge)

Example:
{ "maxFee": "8000" }