> ## Documentation Index
> Fetch the complete documentation index at: https://docs.moralis.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Build a Token Approval & Revoke Dashboard (Revoke.cash-Style)

> Learn how to build a dashboard to view and revoke token approvals using the Moralis API.

## 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](/data-api/evm/wallet/approvals) - Fetch all token approvals granted by a wallet

## Prerequisites

* Node.js v18+ installed
* A Moralis API key ([get one free](https://admin.moralis.io))

## Step 1: Set Up Your Project

Create a new directory for your project and initialize it:

```bash theme={null}
mkdir revoke-dashboard && cd revoke-dashboard
npm init -y
```

## Step 2: Create the Script

Create a file called `index.js` and add the following code:

```javascript theme={null}
// index.js
const API_KEY = 'YOUR_API_KEY';
const WALLET_ADDRESS = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045';

async function getTokenApprovals() {
  const response = await fetch(
    `https://deep-index.moralis.io/api/v2.2/wallets/${WALLET_ADDRESS}/approvals?chain=eth`,
    {
      headers: {
        'X-API-Key': API_KEY,
      },
    }
  );

  const data = await response.json();
  console.log(JSON.stringify(data, null, 2));
}

getTokenApprovals();
```

Replace `YOUR_API_KEY` with your actual Moralis API key.

## Step 3: Run the Script

```bash theme={null}
node index.js
```

## Example Response

```json theme={null}
{
  "page": 1,
  "page_size": 100,
  "result": [
    {
      "block_number": "12526958",
      "block_timestamp": "2024-01-15T10:30:00.000Z",
      "transaction_hash": "0x...",
      "value": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
      "value_formatted": "unlimited",
      "token": {
        "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
        "name": "USD Coin",
        "symbol": "USDC",
        "logo": "https://cdn.moralis.io/eth/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.png",
        "decimals": 6,
        "current_balance": "1000000000",
        "current_balance_formatted": "1000",
        "usd_price": 0.9998,
        "usd_at_risk": 999.80
      },
      "spender": {
        "address": "0x7a250d5630b4cf539739df2c5dacb4c659f2488d",
        "address_label": "Uniswap V2: Router 2",
        "entity": "Uniswap",
        "entity_logo": "https://cdn.moralis.io/entities/uniswap.png"
      }
    }
  ]
}
```

## 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](/get-started/tutorials/data-api/tokens-and-markets/get-erc-20-token-balances-for-a-wallet) - See your token balances
* [Get Wallet History](/get-started/tutorials/data-api/wallets-and-accounts/get-full-wallet-transaction-history-eoa-and-smart-accounts) - View transaction history
* [API Reference](/data-api/evm/wallet/approvals) - Full API documentation
