- Fetch a wallet’s total value, 24h change, and chain breakdown
- List token holdings with prices and handle pagination
- Aggregate portfolio value across multiple wallets
- Fetch balance charts to visualize value over time
Prerequisites
- A Zerion API key (get one here)
- One or more wallet addresses to track
- Node.js 18+ (for native
fetch)
Steps
1
Get a wallet's portfolio summary
A single call to the portfolio endpoint returns the wallet’s total value, chain distribution, and 24h change.The response includes:
2
List token holdings
Fetch individual positions sorted by value. Use Handling pagination: If a wallet holds many tokens, use
filter[trash]=only_non_trash to exclude spam tokens.links.next to fetch all pages:3
Aggregate multiple wallets
Fetch portfolio summaries for each wallet and combine them into a single view.The full working example below also merges the per-chain breakdowns from each wallet to compare value across chains.
4
Fetch balance charts
Use the balance chart endpoint to visualize how portfolio value has changed over time. The period is part of the URL path. Supported periods: The response contains
day, week, month, 3months, 6months, year, 5years, max.data.attributes.points, an array of [timestamp, value] pairs where:timestamp- Unix timestamp (seconds)value- portfolio value at that point in USD
5
Full working example
Save as
multi-wallet-tracker.mjs and run with node multi-wallet-tracker.mjs:Next steps
- Add DeFi positions to include staked and deposited assets in the totals
- Track PnL and cost basis per wallet for tax reporting
- Set up webhooks to update the dashboard in real time when any tracked wallet transacts