Get all NFTs the wallet holds
Get every NFT and multitoken a wallet holds by passing its address to the wallet portfolio endpoint or the Tatum SDK's nft.getBalance().
This guide introduces you to the operation of obtaining all NFTs associated with a particular address, offering you a comprehensive snapshot of your NFT holdings.
By leveraging this functionality, you can effectively monitor your NFT collection, verify NFT ownership, and assess the value of your digital assets. Ultimately, this operation empowers you to manage assets with ease and efficiency.
How to get NFTs on a wallet in the Ethereum network
- v4 REST API endpoint: Get wallet portfolio
- TatumSDK (
@tatumio/tatum) to get a balance of the wallet.
curl --request GET \
--url 'https://api.tatum.io/v4/data/wallet/portfolio?chain=ethereum-mainnet&addresses=0x727EA45B2EB6abb2badD3dC7106d146E0Dc0450d&tokenTypes=nft,multitoken&pageSize=50&offset=0' \
--header 'accept: application/json' \
--header 'x-api-key: {YOUR_API_KEY}'// yarn add @tatumio/tatum
import {TatumSDK, Network, Ethereum, ResponseDto, NftAddressBalance} from '@tatumio/tatum'
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM, apiKey: '{YOUR_API_KEY}'})
const balance: ResponseDto<NftAddressBalance[]> = await tatum.nft.getBalance({
addresses: ['0x727EA45B2EB6abb2badD3dC7106d146E0Dc0450d'], // replace with your address
})
console.log(balance.data)
await tatum.destroy()// Install with: npm install @tatumio/tatum
const { TatumSDK, Network } = require("@tatumio/tatum");
(async () => {
try {
const tatum = await TatumSDK.init({ network: Network.ETHEREUM, apiKey: '{YOUR_API_KEY}' });
const balance = await tatum.nft.getBalance({
addresses: ['0x727EA45B2EB6abb2badD3dC7106d146E0Dc0450d'], // replace with your address
});
console.log(balance.data);
await tatum.destroy();
} catch (error) {
console.error("Error fetching NFT balance:", error);
}
})();Expected Response
The SDK returns the list of NFTs in balance.data. The REST endpoint returns them in a result array.
[
{
"address": "0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d",
"balance": "2",
"chain": "ethereum-mainnet",
"lastUpdatedBlockNumber": 14086122,
"metadata": {
"description": "# ***\"Sometimes I swear I can see .... | Joey Camacho ]*",
"external_url": "https://punkscomic.com",
"image": "ipfs://QmS21WhH94jBnYompXHD1SxS6Gw2bY8E81sTYRktWrYa7a/JUPITER.mp4",
"name": "MetaHero Universe: Jupiter DAO Token"
},
"metadataURI": "ipfs://QmR9PokA9rnKKUF1uLtZyHYEhExqQU1Z7t8AbovMBxND4U/5",
"tokenAddress": "0x7deb7bce4d360ebe68278dee6054b882aa62d19c",
"tokenId": "5",
"type": "multitoken"
}
]Request interface
interface AddressBalanceFilters {
/**
* List of addresses to check.
*/
addresses: string[]
/**
* Optional page size. If not specified, the default page size is used, which is 50.
*/
pageSize?: number
/**
* Optional page number. If not specified, the first page is returned.
*/
page?: number
}Response interface
interface ResponseDto<T> {
/**
* Actual payload of the response
*/
data: T
/**
* Status of the response
*/
status: Status
/**
* In case of ERROR status, this field contains the error message and detailed description
*/
error?: ErrorWithMessage
}
interface NftAddressBalance {
/**
* Balance of the address.
*/
balance: string
/**
* Blockchain network
*/
chain: string
/**
* Token ID
*/
tokenId: string
/**
* Token contract address
*/
tokenAddress: string
/**
* Token type. Either 'nft' (ERC-721) or 'multitoken' (ERC-1155)
*/
type: 'nft' | 'multitoken'
/**
* Token URI
*/
metadataURI: string
/**
* Token metadata
*/
metadata?: {
name: string
description: string
image: string
[metadataKey: string]: unknown
}
/**
* Block number of the last balance update.
*/
lastUpdatedBlockNumber: number
}Updated 8 days ago
Did this page help you?