GetTokenList will return a list of tokens based on the provided filters.
curl --request POST \
--url https://api.example.com/rpc/Trails/GetTokenList \
--header 'Content-Type: application/json' \
--data '
{
"chainIds": [
123
],
"searchQuery": "<string>",
"limit": 123,
"tokenAddress": "<string>",
"includeAllListed": true,
"includeExternal": true,
"excludeTokens": [
"<string>"
]
}
'import requests
url = "https://api.example.com/rpc/Trails/GetTokenList"
payload = {
"chainIds": [123],
"searchQuery": "<string>",
"limit": 123,
"tokenAddress": "<string>",
"includeAllListed": True,
"includeExternal": True,
"excludeTokens": ["<string>"]
}
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({
chainIds: [123],
searchQuery: '<string>',
limit: 123,
tokenAddress: '<string>',
includeAllListed: true,
includeExternal: true,
excludeTokens: ['<string>']
})
};
fetch('https://api.example.com/rpc/Trails/GetTokenList', 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.example.com/rpc/Trails/GetTokenList",
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([
'chainIds' => [
123
],
'searchQuery' => '<string>',
'limit' => 123,
'tokenAddress' => '<string>',
'includeAllListed' => true,
'includeExternal' => true,
'excludeTokens' => [
'<string>'
]
]),
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://api.example.com/rpc/Trails/GetTokenList"
payload := strings.NewReader("{\n \"chainIds\": [\n 123\n ],\n \"searchQuery\": \"<string>\",\n \"limit\": 123,\n \"tokenAddress\": \"<string>\",\n \"includeAllListed\": true,\n \"includeExternal\": true,\n \"excludeTokens\": [\n \"<string>\"\n ]\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://api.example.com/rpc/Trails/GetTokenList")
.header("Content-Type", "application/json")
.body("{\n \"chainIds\": [\n 123\n ],\n \"searchQuery\": \"<string>\",\n \"limit\": 123,\n \"tokenAddress\": \"<string>\",\n \"includeAllListed\": true,\n \"includeExternal\": true,\n \"excludeTokens\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/rpc/Trails/GetTokenList")
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 \"chainIds\": [\n 123\n ],\n \"searchQuery\": \"<string>\",\n \"limit\": 123,\n \"tokenAddress\": \"<string>\",\n \"includeAllListed\": true,\n \"includeExternal\": true,\n \"excludeTokens\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"tokens": [
{
"chainId": 123,
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"featured": true,
"featureIndex": 123,
"supportsBridging": true,
"logoUri": "<string>"
}
]
}{
"error": "WebrpcEndpoint",
"code": 0,
"msg": "endpoint error",
"status": 400,
"cause": "<string>"
}{
"error": "WebrpcBadResponse",
"code": -5,
"msg": "bad response",
"status": 500,
"cause": "<string>"
}Routes & Tokens
GetTokenList
POST
/
rpc
/
Trails
/
GetTokenList
GetTokenList will return a list of tokens based on the provided filters.
curl --request POST \
--url https://api.example.com/rpc/Trails/GetTokenList \
--header 'Content-Type: application/json' \
--data '
{
"chainIds": [
123
],
"searchQuery": "<string>",
"limit": 123,
"tokenAddress": "<string>",
"includeAllListed": true,
"includeExternal": true,
"excludeTokens": [
"<string>"
]
}
'import requests
url = "https://api.example.com/rpc/Trails/GetTokenList"
payload = {
"chainIds": [123],
"searchQuery": "<string>",
"limit": 123,
"tokenAddress": "<string>",
"includeAllListed": True,
"includeExternal": True,
"excludeTokens": ["<string>"]
}
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({
chainIds: [123],
searchQuery: '<string>',
limit: 123,
tokenAddress: '<string>',
includeAllListed: true,
includeExternal: true,
excludeTokens: ['<string>']
})
};
fetch('https://api.example.com/rpc/Trails/GetTokenList', 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.example.com/rpc/Trails/GetTokenList",
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([
'chainIds' => [
123
],
'searchQuery' => '<string>',
'limit' => 123,
'tokenAddress' => '<string>',
'includeAllListed' => true,
'includeExternal' => true,
'excludeTokens' => [
'<string>'
]
]),
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://api.example.com/rpc/Trails/GetTokenList"
payload := strings.NewReader("{\n \"chainIds\": [\n 123\n ],\n \"searchQuery\": \"<string>\",\n \"limit\": 123,\n \"tokenAddress\": \"<string>\",\n \"includeAllListed\": true,\n \"includeExternal\": true,\n \"excludeTokens\": [\n \"<string>\"\n ]\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://api.example.com/rpc/Trails/GetTokenList")
.header("Content-Type", "application/json")
.body("{\n \"chainIds\": [\n 123\n ],\n \"searchQuery\": \"<string>\",\n \"limit\": 123,\n \"tokenAddress\": \"<string>\",\n \"includeAllListed\": true,\n \"includeExternal\": true,\n \"excludeTokens\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/rpc/Trails/GetTokenList")
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 \"chainIds\": [\n 123\n ],\n \"searchQuery\": \"<string>\",\n \"limit\": 123,\n \"tokenAddress\": \"<string>\",\n \"includeAllListed\": true,\n \"includeExternal\": true,\n \"excludeTokens\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"tokens": [
{
"chainId": 123,
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"decimals": 123,
"featured": true,
"featureIndex": 123,
"supportsBridging": true,
"logoUri": "<string>"
}
]
}{
"error": "WebrpcEndpoint",
"code": 0,
"msg": "endpoint error",
"status": 400,
"cause": "<string>"
}{
"error": "WebrpcBadResponse",
"code": -5,
"msg": "bad response",
"status": 500,
"cause": "<string>"
}Overview
TheGetTokenList endpoint retrieves a list of tokens available on specified chains. This is useful for building token selection UIs, searching for tokens, and discovering available assets for swaps and transfers.
Use Cases
- Build token selector dropdowns
- Implement token search functionality
- Display featured/popular tokens
- Filter tokens by chain
- Look up specific token addresses
- Exclude certain tokens from selection
Request Parameters
Required Fields
- chainIds (number[]): Array of chain IDs to get tokens for
Optional Fields
- searchQuery (string): Search tokens by name, symbol, or address
- limit (number): Maximum number of tokens to return
- tokenAddress (string): Filter to a specific token address
- includeAllListed (boolean): Include all listed tokens, not just featured
- includeExternal (boolean): Include external/non-native tokens
- excludeTokens (string[]): Array of token addresses to exclude
Response
The response includes:- tokens (TokenInfo[]): Array of token information
TokenInfo Object Structure
Each token object contains:- chainId (number): Chain where the token exists
- address (string): Token contract address
- name (string): Token name
- symbol (string): Token symbol
- decimals (number): Token decimals
- supportsBridging (boolean, optional): Whether the token supports bridging
- logoUri (string, optional): URL to token logo
- featured (boolean): Whether this is a featured/popular token
- featureIndex (number): Sort order for featured tokens
Examples
Get Featured Tokens for Multiple Chains
const response = await fetch('https://trails-api.sequence.app/rpc/Trails/GetTokenList', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Access-Key': 'YOUR_ACCESS_KEY'
},
body: JSON.stringify({
chainIds: [1, 8453, 42161], // Ethereum, Base, Arbitrum
limit: 20
})
});
const { tokens } = await response.json();
console.log('Featured tokens:');
tokens.forEach(token => {
console.log(`${token.symbol} on chain ${token.chainId}: ${token.address}`);
});
Search for a Token
const response = await fetch('https://trails-api.sequence.app/rpc/Trails/GetTokenList', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Access-Key': 'YOUR_ACCESS_KEY'
},
body: JSON.stringify({
chainIds: [1, 8453, 42161, 137, 10],
searchQuery: 'USDC',
includeAllListed: true
})
});
const { tokens } = await response.json();
console.log('USDC tokens found:');
tokens.forEach(token => {
console.log(`Chain ${token.chainId}: ${token.address}`);
});
Look Up Specific Token
const response = await fetch('https://trails-api.sequence.app/rpc/Trails/GetTokenList', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Access-Key': 'YOUR_ACCESS_KEY'
},
body: JSON.stringify({
chainIds: [8453], // Base
tokenAddress: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' // USDC
})
});
const { tokens } = await response.json();
if (tokens.length > 0) {
const token = tokens[0];
console.log(`Found: ${token.name} (${token.symbol})`);
console.log(`Decimals: ${token.decimals}`);
console.log(`Supports bridging: ${token.supportsBridging}`);
}
Build Token Selector with Search
import { useEffect, useState, useCallback } from 'react';
import { debounce } from 'lodash';
interface TokenInfo {
chainId: number;
address: string;
name: string;
symbol: string;
decimals: number;
logoUri?: string;
featured: boolean;
}
interface TokenSelectorProps {
chainIds: number[];
onSelect: (token: TokenInfo) => void;
excludeAddresses?: string[];
}
export const TokenSelector = ({
chainIds,
onSelect,
excludeAddresses = []
}: TokenSelectorProps) => {
const [tokens, setTokens] = useState<TokenInfo[]>([]);
const [searchQuery, setSearchQuery] = useState('');
const [loading, setLoading] = useState(true);
const fetchTokens = useCallback(async (query: string) => {
setLoading(true);
const response = await fetch('https://trails-api.sequence.app/rpc/Trails/GetTokenList', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Access-Key': 'YOUR_ACCESS_KEY'
},
body: JSON.stringify({
chainIds,
searchQuery: query || undefined,
includeAllListed: !!query,
excludeTokens: excludeAddresses,
limit: 50
})
});
const { tokens } = await response.json();
setTokens(tokens);
setLoading(false);
}, [chainIds, excludeAddresses]);
// Debounced search
const debouncedSearch = useCallback(
debounce((query: string) => fetchTokens(query), 300),
[fetchTokens]
);
useEffect(() => {
fetchTokens('');
}, [fetchTokens]);
useEffect(() => {
if (searchQuery) {
debouncedSearch(searchQuery);
}
}, [searchQuery, debouncedSearch]);
return (
<div>
<input
type="text"
placeholder="Search tokens..."
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
/>
{loading ? (
<div>Loading...</div>
) : (
<ul>
{tokens.map(token => (
<li
key={`${token.chainId}-${token.address}`}
onClick={() => onSelect(token)}
>
{token.logoUri && (
<img src={token.logoUri} alt={token.symbol} width={24} />
)}
<span>{token.symbol}</span>
<span>{token.name}</span>
<span>Chain {token.chainId}</span>
</li>
))}
</ul>
)}
</div>
);
};
Get All Tokens Including External
const response = await fetch('https://trails-api.sequence.app/rpc/Trails/GetTokenList', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Access-Key': 'YOUR_ACCESS_KEY'
},
body: JSON.stringify({
chainIds: [8453], // Base
includeAllListed: true,
includeExternal: true,
limit: 100
})
});
const { tokens } = await response.json();
console.log(`Found ${tokens.length} tokens on Base`);
Exclude Specific Tokens
// Exclude native tokens from the list
const response = await fetch('https://trails-api.sequence.app/rpc/Trails/GetTokenList', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Access-Key': 'YOUR_ACCESS_KEY'
},
body: JSON.stringify({
chainIds: [1],
excludeTokens: [
'0x0000000000000000000000000000000000000000', // Native ETH
'0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' // WETH
],
limit: 20
})
});
const { tokens } = await response.json();
Filtering Tips
| Use Case | Parameters |
|---|---|
| Featured tokens only | Default (no extra params) |
| All tokens | includeAllListed: true |
| Search by name/symbol | searchQuery: "USDC" |
| Specific token lookup | tokenAddress: "0x..." |
| Exclude tokens | excludeTokens: ["0x...", "0x..."] |
Featured tokens are curated for popularity and liquidity. Use
includeAllListed for comprehensive token lists.Next Steps
GetChains
Get supported chains for token selection
GetTokenPrices
Get USD prices for selected tokens
Was this page helpful?