Introduction
In this tutorial, you’ll learn how to build a token approval dashboard similar to Revoke.cash using the Moralis API. Users can view all their ERC20 token approvals and identify potentially risky unlimited approvals. This is an important security tool for managing DeFi permissions. We’ll use the following Moralis API endpoint:- Get Token Approvals - Fetch all token approvals granted by a wallet
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
Example Response
Understanding the Response
| Field | Description |
|---|---|
value | Approved amount in smallest unit |
value_formatted | Human-readable approval (may be “unlimited”) |
token | Token details including current balance and USD at risk |
token.usd_at_risk | USD value of tokens that could be taken |
spender | Contract with permission to spend tokens |
spender.address_label | Known label for the spender |
spender.entity | Entity name (e.g., Uniswap, OpenSea) |
Next Steps
- Get Token Balances - See your token balances
- Get Wallet History - View transaction history
- API Reference - Full API documentation

