Skip to main content
Use these endpoints to discover what networks, tokens, and routes are available before building a quote. They are read-only and require no active intent. For authentication and base URL, see the API overview.

GetChains

List all supported networks. Endpoint: POST /GetChains No request parameters required.

Response fields

FieldDescription
chainsArray of supported network objects
chains[].chainIdNumeric chain ID
chains[].nameHuman-readable network name

Example

const { chains } = await trails.getChains({});

chains.forEach((chain) => {
  console.log(chain.chainId, chain.name);
});
// 1 Ethereum
// 137 Polygon
// 8453 Base
// 42161 Arbitrum One

GetTokenList

List supported tokens on a specific network. Endpoint: POST /GetTokenList

Request parameters

FieldTypeRequiredDescription
chainIdnumberYesThe network to list tokens for

Response fields

FieldDescription
tokensArray of token objects on the specified chain
tokens[].addressToken contract address
tokens[].symbolToken symbol (e.g. USDC)
tokens[].decimalsToken decimal precision

Example

const { tokens } = await trails.getTokenList({ chainId: 137 });

tokens.forEach((token) => {
  console.log(token.symbol, token.address, token.decimals);
});

GetExactInputRoutes

Get all available destination options for a given source token and amount. Use this to show customers what they can receive given what they have. Endpoint: POST /GetExactInputRoutes

Request parameters

FieldTypeRequiredDescription
originChainIdnumberYesSource network chain ID
originTokenAddressstringYesSource token contract address
originTokenAmountstringYesAmount to send, in the token’s smallest unit

Example

const routes = await trails.getExactInputRoutes({
  originChainId: 1,
  originTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  originTokenAmount: "1000000",
});

GetExactOutputRoutes

Get all available source options for a desired destination token and amount. Use this when the customer specifies how much they want to receive. Endpoint: POST /GetExactOutputRoutes

Request parameters

FieldTypeRequiredDescription
destinationChainIdnumberYesDestination network chain ID
destinationTokenAddressstringYesDestination token contract address
destinationTokenAmountstringYesDesired receive amount, in the token’s smallest unit

Example

const routes = await trails.getExactOutputRoutes({
  destinationChainId: 137,
  destinationTokenAddress: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
  destinationTokenAmount: "100000000", // 100 USDC
});

GetTokenPrices

Get current USD prices for one or more tokens. Endpoint: POST /GetTokenPrices

Request parameters

FieldTypeRequiredDescription
tokenAddressesstring[]YesArray of token contract addresses to price

Example

const prices = await trails.getTokenPrices({
  tokenAddresses: [
    "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC on Ethereum
    "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", // USDC on Polygon
  ],
});

prices.forEach((p) => {
  console.log(p.address, p.priceUsd);
});

GetExchangeRate

Get a fiat-to-fiat or fiat-to-crypto exchange rate for display and quoting purposes. Endpoint: POST /GetExchangeRate

Request parameters

FieldTypeRequiredDescription
fromCurrencystringYesSource currency code (ISO 4217, e.g. USD)
toCurrencystringYesTarget currency code (ISO 4217, e.g. EUR)
amountnumberYesAmount in the source currency

Example

const rate = await trails.getExchangeRate({
  fromCurrency: "USD",
  toCurrency: "EUR",
  amount: 100,
});

console.log(`100 USD = ${rate.convertedAmount} EUR`);

GetFiatCurrencyList

List all fiat currencies supported for on-ramp and off-ramp funding. Endpoint: POST /GetFiatCurrencyList No request parameters required.

Example

const { currencies } = await trails.getFiatCurrencyList({});

currencies.forEach((c) => {
  console.log(c.code, c.name); // USD United States Dollar
});