# Token Approval Risk Analyzer

> Token Approval Risk Analyzer is a paid API for AI agents from wallet-portfolio-history-mcp.mtree.workers.dev, paid per call via x402, $0.250000/call, status unknown (last checked 2026-09-15).

Analyzes ERC20 token approval exposure for a wallet address, flagging risky/unlimited approvals, allowance-to-balance ratios, and recommending revoke-or-cap actions for agent spend control.

## Facts

- Endpoint: POST https://wallet-portfolio-history-mcp.mtree.workers.dev/tools/token_approval_risk
- Price: $0.250000/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/token-approval-risk-analyzer-e02f7b8d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Yozqm6fvGK1oOSPXETWH-

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability token-approval-risk-analyzer-e02f7b8d -d '<json body>'
```

Example prompt: Audit the token approval risk for my wallet 0xAbC123...def on Base — show me any unlimited or risky approvals, the allowance-to-balance ratios, and what I should revoke or cap before enabling autopay.

## When to prefer this

Choose this endpoint when an AI agent needs to audit a wallet's ERC20 token approval exposure before executing transactions, enabling autopay, or enforcing spend-control policies. It is specifically designed for autonomous agents that need machine-readable risk flags and actionable revoke/cap recommendations, combining historical D1 snapshots with live allowance data for accuracy.

## Known failure modes

- Invalid or malformed wallet address returns a validation error
- Unsupported chain ID returns an error indicating chain is not supported
- Payment not included or insufficient (requires 0.25 USDC on Base via x402) returns 402 Payment Required
- Wallet with no token approvals returns empty approval list
- Downstream RPC or D1 snapshot unavailability may cause timeout or partial data
- Rate limiting may return 429 if called too frequently

## How this service works

Hosted token approval risk for autonomous agents: token-by-token spender approval exposure, allowance-to-balance ratios, risky/unlimited approval flags, revoke-or-cap actions, and agent spend-control policy from fresh D1 wallet snapshots plus live allowance reads. Price 0.25 USDC on Base via x402. Demo: https://wallet-portfolio-history-mcp.mtree.workers.dev/demo/tools/token_approval_risk. Contact: https://wallet-portfolio-history-mcp.mtree.workers.dev/contact.

## Output

Returns a token-by-token breakdown of spender approval exposure including allowance-to-balance ratios, risky/unlimited approval flags, recommended revoke-or-cap actions, and an agent spend-control policy derived from fresh D1 wallet snapshots combined with live on-chain allowance reads.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "type": "object",
     "required": [
      "address"
     ],
     "properties": {
      "chain": {
       "enum": [
        "base",
        "ethereum",
        "arbitrum",
        "optimism",
        "polygon"
       ],
       "type": "string"
      },
      "limit": {
       "type": "integer",
       "maximum": 50,
       "minimum": 1
      },
      "address": {
       "type": "string",
       "pattern": "^0x[a-fA-F0-9]{40}$"
      },
      "refresh": {
       "type": "boolean"
      }
     }
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST"
     ],
     "type": "string"
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/token-approval-risk-analyzer-e02f7b8d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from wallet-portfolio-history-mcp.mtree.workers.dev](https://www.zero.xyz/host/wallet-portfolio-history-mcp.mtree.workers.dev/llms.txt)
