- Fetch a wallet’s total NFT value broken down by chain
- List NFT collections sorted by floor value
- Drill into individual NFT positions with metadata
- Filter by specific collections
Prerequisites
- A Zerion API key (get one here)
- A wallet address to query
Steps
1
Get the NFT portfolio overview
Start by fetching the wallet’s NFT portfolio to get total NFT value broken down by chain.The response includes
positions_distribution_by_chain, a map of chain IDs to their total NFT floor value (e.g., ethereum: 1820.50, polygon: 37.56).The API may return a
202 status if the wallet’s NFT data is still being indexed. Poll the endpoint until you receive a 200 response.2
Fetch NFT collections
Get the wallet’s NFT collections grouped by collection, sorted by total floor price.Each collection entry includes:
collection_info.name- the collection namenfts_count- how many NFTs from this collection the wallet holdstotal_floor_price- combined floor value of the wallet’s positions in this collectionmin_changed_at/max_changed_at- acquisition timestamps
3
Fetch individual NFT positions
Drill into the specific NFT positions held by the wallet, sorted by floor price.Using
sort=-floor_price orders NFTs by their floor price (highest first). Each position includes:nft_info.name- the NFT’s name or token IDcollection_info.name- the collection it belongs tovalue- estimated USD value based on the collection’s floor price
4
Filter by collection (optional)
To show NFTs from a specific collection, use the
filter[collection_ids] parameter. Collection IDs are UUIDs found in the relationships.collection.data.id field of each NFT position returned by the endpoints above.5
Full working example
Save as
nft-portfolio.mjs and run with node nft-portfolio.mjs:Next steps
- Use pagination to handle wallets with large NFT collections
- Include the
nft_collectionsrelationship in theincludeparameter to get full collection metadata in one request - Combine with the transactions endpoint to track NFT purchase and sale history