Requesting all known Tokens

Request all tokens known by the LI.FI services

The complete API documentation for our /tokens endpoint can be found here.

This endpoint gives a comprehensive list of all tokens that the LI.FI services are aware.

It is possible to filter them by chain to get a more concise and targeted result.

const getTokens = async () => {
    const optionalFilter = ['ETH', 137] // Both numeric and mnemonic can be used
    /// chainTypes can be of type SVM and EVM. By default, only EVM tokens will be returned
    const optionalChainTypes = "EVM"
    const result = await axios.get('https://li.quest/v1/tokens',
        {params: {
            chains: optionalFilter.join(','),
            chainTypes: optionalChainType 
        }});
    return result.data;
}

The response is an object with a tokens property. In turn this is an object with keys being ChainId and values being Token objects. The sample response for the sample request above is:

{
    "tokens": {
        "100": [
            {
                "address": "0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1",
                "decimals": 18,
                "symbol": "ETH",
                "chainId": 100,
                "coinKey": "ETH",
                "name": "ETH",
                "logoURI": "https://static.debank.com/image/xdai_token/logo_url/0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1/61844453e63cf81301f845d7864236f6.png",
                "priceUSD": "1740.38"
            }
        ],
        "137": [
            {
                "address": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
                "decimals": 18,
                "symbol": "ETH",
                "chainId": 137,
                "coinKey": "ETH",
                "name": "ETH",
                "logoURI": "https://static.debank.com/image/matic_token/logo_url/0x7ceb23fd6bc0add59e62ac25578270cff1b9f619/61844453e63cf81301f845d7864236f6.png",
                "priceUSD": "1740.38"
            }
        ]
    }
}

MATIC to POL migration: Please note that on the Polygon chain, the native token previously referred to as MATIC has been renamed to POL. Similarly, WMATIC is now referred to as WPOL. While the token symbols have changed, the underlying assets and their contract addresses remain the same unless token symbols are passed in the API.

On Ethereum, both POL and MATIC are available but with different contract addresses. Be sure to use the correct contract address when requesting token information for these assets on Ethereum

Last updated