Retrieve ERC20 tokens

How to retrieve the token balances for a wallet (ERC20 standard).

Retrieve ERC20 token balances by:

  1. Wallet id
  2. Blockchain and wallet address
  3. Wallet id and token address
  4. Blockchain, wallet address, and token address

📘

Optionally, you can filter the results using the includePossibleSpam boolean param in the query.

1. Get all token balances by wallet id

Request Endpoint: reference

GET /api/wallets/{walletId}/balance/tokens
ParameterParam TypeDescriptionData TypeMandatory
{walletId}PathThe ID of the walletString
includePossibleSpamQueryIndication to include possible spam tokens in the response body or not.Boolean

Request Example

GET /api/wallets/f21dc1e5-4253-487e-8927-3b5247437f99/balance/tokens

Response Body

{
    "success": true,
    "result": [
        {
            "tokenAddress": "0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0",
            "rawBalance": "32876284951737501699",
            "balance": 32.8762849517375,
            "decimals": 18,
            "symbol": "UNI",
            "logo": "https://logo.moralis.io/0xa4b1_0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0_53b65838dbb44ea0bf1ef10445f4da21",
            "type": "ERC20",
            "transferable": true,
            "name": "Uniswap",
            "exchange": {
                "usdPrice": 8.056647793652566,
                "usdBalanceValue": 264.872648619909
            },
            "categories": [
                "Automated Market Maker (AMM)",
                "Decentralized Exchange (DEX)",
                "Decentralized Finance (DeFi)"
            ],
            "links": {
                "twitter": "https://twitter.com/Uniswap",
                "website": "https://uniswap.org/",
                "reddit": "https://www.reddit.com/r/Uniswap",
                "discord": "https://discord.gg/FCfyBSbCU5"
            },
            "thumbnail": "https://logo.moralis.io/0xa4b1_0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0_53b65838dbb44ea0bf1ef10445f4da21",
            "portfolioPercentage": "100"
        }
    ]
}

2. Get all token balances by blockchain and wallet address

Request Endpoint: reference

GET /api/wallets/{secretType}/{walletAddress}/balance/tokens
ParameterParam TypeDescriptionData TypeMandatory
{secretType}PathIndication on which chain the balance should be fetchedString
{walletAddress}PathThe address of the walletString
includePossibleSpamQueryIndication to include possible spam tokens in the response body or not.Boolean

Request Example

GET /api/wallets/ARBITRUM/0x9f0847430a41ff52573857b49A87076e1748ed6A/balance/tokens

Response Body

{
    "success": true,
    "result": [
        {
            "tokenAddress": "0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0",
            "rawBalance": "32876284951737501699",
            "balance": 32.8762849517375,
            "decimals": 18,
            "symbol": "UNI",
            "logo": "https://logo.moralis.io/0xa4b1_0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0_53b65838dbb44ea0bf1ef10445f4da21",
            "type": "ERC20",
            "transferable": true,
            "name": "Uniswap",
            "exchange": {
                "usdPrice": 8.056647793652566,
                "usdBalanceValue": 264.872648619909
            },
            "categories": [
                "Automated Market Maker (AMM)",
                "Decentralized Exchange (DEX)",
                "Decentralized Finance (DeFi)"
            ],
            "links": {
                "twitter": "https://twitter.com/Uniswap",
                "website": "https://uniswap.org/",
                "reddit": "https://www.reddit.com/r/Uniswap",
                "discord": "https://discord.gg/FCfyBSbCU5"
            },
            "thumbnail": "https://logo.moralis.io/0xa4b1_0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0_53b65838dbb44ea0bf1ef10445f4da21",
            "portfolioPercentage": "100"
        }
    ]
}

3. Get a specific token balance by wallet id and token address

Request Endpoint: reference

GET /api/wallets/{walletId}/balance/tokens/{token}
ParameterParam TypeDescriptionData TypeMandatory
{walletId}PathThe ID of the walletString
{token}PathAddress of the token (contract) to fetch the balance forString
includePossibleSpamQueryIndication to include possible spam tokens in the response body or not.Boolean

Request Example

GET /api/wallets/f21dc1e5-4253-487e-8927-3b5247437f99/balance/tokens/0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0

Response Body

{
    "success": true,
    "result": [
        {
            "tokenAddress": "0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0",
            "rawBalance": "32876284951737501699",
            "balance": 32.8762849517375,
            "decimals": 18,
            "symbol": "UNI",
            "logo": "https://logo.moralis.io/0xa4b1_0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0_53b65838dbb44ea0bf1ef10445f4da21",
            "type": "ERC20",
            "transferable": true,
            "name": "Uniswap",
            "exchange": {
                "usdPrice": 8.056647793652566,
                "usdBalanceValue": 264.872648619909
            },
            "categories": [
                "Automated Market Maker (AMM)",
                "Decentralized Exchange (DEX)",
                "Decentralized Finance (DeFi)"
            ],
            "links": {
                "twitter": "https://twitter.com/Uniswap",
                "website": "https://uniswap.org/",
                "reddit": "https://www.reddit.com/r/Uniswap",
                "discord": "https://discord.gg/FCfyBSbCU5"
            },
            "thumbnail": "https://logo.moralis.io/0xa4b1_0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0_53b65838dbb44ea0bf1ef10445f4da21",
            "portfolioPercentage": "100"
        }
    ]
}

4. Get a specific token balance by blockchain, wallet address, and token address

Request Endpoint: reference

GET /api/wallets/{secretType}/{walletAddress}/balance/tokens/{token}
ParameterParam TypeDescriptionData TypeMandatory
{secretType}PathIndication on which chain the balance should be fetchedString
{walletAddress}PathThe address of the walletString
{token}PathAddress of the token (contract) to fetch the balance forString
includePossibleSpamQueryIndication to include possible spam tokens in the response body or not.Boolean

Request Example

GET /api/wallets/ARBITRUM/0x9f0847430a41ff52573857b49A87076e1748ed6A/balance/tokens/0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0

Response Body

{
    "success": true,
    "result": [
        {
            "tokenAddress": "0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0",
            "rawBalance": "32876284951737501699",
            "balance": 32.8762849517375,
            "decimals": 18,
            "symbol": "UNI",
            "logo": "https://logo.moralis.io/0xa4b1_0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0_53b65838dbb44ea0bf1ef10445f4da21",
            "type": "ERC20",
            "transferable": true,
            "name": "Uniswap",
            "exchange": {
                "usdPrice": 8.056647793652566,
                "usdBalanceValue": 264.872648619909
            },
            "categories": [
                "Automated Market Maker (AMM)",
                "Decentralized Exchange (DEX)",
                "Decentralized Finance (DeFi)"
            ],
            "links": {
                "twitter": "https://twitter.com/Uniswap",
                "website": "https://uniswap.org/",
                "reddit": "https://www.reddit.com/r/Uniswap",
                "discord": "https://discord.gg/FCfyBSbCU5"
            },
            "thumbnail": "https://logo.moralis.io/0xa4b1_0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0_53b65838dbb44ea0bf1ef10445f4da21",
            "portfolioPercentage": "100"
        }
    ]
}