Introduction
In this tutorial, you’ll learn how to retrieve detailed metadata for any ERC20 token using the Moralis API. This includes the token name, symbol, decimals, logo, and more. This is useful for displaying token information in your application without needing to query the blockchain directly. We’ll use the following Moralis API endpoint:- Get Token Metadata - Fetch detailed metadata for ERC20 tokens
Prerequisites
- Node.js v18+ installed
- A Moralis API key (get one free)
Step 1: Set Up Your Project
Create a new directory for your project and initialize it:Step 2: Create the Script
Create a file calledindex.js and add the following code:
YOUR_API_KEY with your actual Moralis API key.
Step 3: Run the Script
Execute the script to fetch the token metadata:Example Response
Understanding the Response
| Field | Description |
|---|---|
address | The token’s contract address |
name | The full name of the token |
symbol | The token’s ticker symbol |
decimals | Number of decimal places the token uses |
logo | URL to the token’s logo image |
thumbnail | URL to a smaller version of the logo |
total_supply | Total supply in the smallest unit |
total_supply_formatted | Human-readable total supply |
possible_spam | Whether the token is flagged as potential spam |
verified_contract | Whether the contract source code is verified |
categories | Token categories (e.g., stablecoin, meme) |
links | Official links (website, Twitter, etc.) |
Next Steps
- Get Token Balances - Fetch wallet token balances
- Get Token Price - Get current token prices
- API Reference - Full API documentation

