What you’ll build
- A wallet’s total NFT value, broken down by chain
- A list of NFT collections sorted by floor value
- Individual NFT positions with metadata
- A filter for specific collections
Time
~10 minutes
You need
- A Zerion API key
- A wallet address to query
Steps
1
Get the NFT portfolio overview
The NFT portfolio endpoint returns the wallet’s total NFT value, broken down by chain.
positions_distribution_by_chain maps each chain ID to its total NFT floor value (for example, 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
NFT collections groups the wallet’s NFTs by collection, sorted by total floor price.Each collection entry includes:
collection_info.name- The collection name.nfts_count- How many NFTs from this collection the wallet holds.total_floor_price- Combined floor value of the wallet’s positions in this collection.min_changed_at/max_changed_at- Acquisition timestamps.
3
Fetch individual NFT positions
NFT positions lists each NFT the wallet holds.
sort=-floor_price orders NFTs by floor price, highest first. Each position includes:nft_info.name- The NFT’s name or token ID.collection_info.name- The collection it belongs to.value- Estimated USD value based on the collection’s floor price.
4
Filter by collection (optional)
To show NFTs from one collection, pass
filter[collection_ids]. Collection IDs are UUIDs, found in relationships.collection.data.id on each NFT position returned above.5
Full working example
Save as
nft-portfolio.mjs and run with node nft-portfolio.mjs. It retries while the API returns 202: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.