Get all NFTs in the NFT collection
As the non-fungible token (NFT) market continues to flourish, creators, collectors, and traders need efficient ways to manage and explore their digital collections. This guide introduces you to the operation of retrieving all NFTs in a specific collection, providing a comprehensive view of the unique digital assets grouped together. By leveraging this functionality, you can easily navigate and analyze your NFT collection, gain insights into the themes and trends within your portfolio, and make informed decisions about buying, selling, or holding specific NFTs. Ultimately, this operation enables you to better understand your digital assets, streamlines your NFT management, and empowers you to engage with the NFT market more effectively.
Use the TatumSDK (
@tatumio/tatum
) to get all NFTs of the collection.TypeScript
JavaScript
curl
1
// yarn add @tatumio/tatum
2
import {TatumSDK, Network, Ethereum, ResponseDto, NftTokenDetail} from '@tatumio/tatum'
3
4
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
5
6
const nfts: ResponseDto<NftTokenDetail[]> = await tatum.nft.getNftsInCollection({
7
collectionAddress: '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D', // replace with your collection
8
})
9
10
console.log(nfts.data)
1
// Install with: npm install @tatumio/tatum
2
const { TatumSDK, Network } = require("@tatumio/tatum");
3
4
(async () => {
5
try {
6
const tatum = await TatumSDK.init({ network: Network.ETHEREUM });
7
const nfts = await tatum.nft.getNftsInCollection({
8
collectionAddress: '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D', // replace with your collection
9
});
10
console.log(nfts.data);
11
} catch (error) {
12
console.error("Error fetching NFT collection:", error);
13
}
14
})();
1
curl --location --request GET 'https://api.tatum.io/v4/data/collections?collectionAddresses=0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D&chain=ethereum'
[
{
"address": "0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d",
"balance": "2",
"chain": "ethereum-mainnet",
"lastUpdatedBlockNumber": 14086122,
"metadata": {
"description": "# ***\"Sometimes I swear I can see a glimmer of the Sun through all the layers of chaos. It's probably just wishful thinking. There's a lot of that here.\" — Renn Dialos, Alexandria Research Node 557***\n### **1 / 71492 Jupiter DAO Tokens**\n\nThis token represents proportional ownership over Jupiter. Together with other Jupiter DAO Token holders, its owner is able to actively build and govern the planet into its own unique environment.\n\n*Jupiter represents 10.4% of the total voting power for MetaHero Universe's United Planets DAO.*\n\n*[ Token Design by: TheVirtunaut, Odious, Raw & Rendered | 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"
}
]
1
interface GetCollection {
2
/**
3
* Collection contract address
4
*/
5
collectionAddress: string
6
/**
7
* Optional flag to exclude metadata from the response. In this case, only token IDs are returned. Defaults to false.
8
*/
9
excludeMetadata?: boolean
10
/**
11
* Optional page size. If not specified, the default page size is used, which is 10.
12
*/
13
pageSize?: number
14
/**
15
* Optional page number. If not specified, the first page is returned.
16
*/
17
page?: number
18
}
1
interface ResponseDto<T> {
2
/**
3
* Actual payload of the response
4
*/
5
data: T
6
/**
7
* Status of the response
8
*/
9
status: Status
10
/**
11
* In case of ERROR status, this field contains the error message and detailed description
12
*/
13
error?: ErrorWithMessage
14
}
15
16
interface NftTokenDetail {
17
/**
18
* Blockchain network
19
*/
20
chain: string
21
/**
22
* Token ID
23
*/
24
tokenId: string
25
/**
26
* Token contract address
27
*/
28
tokenAddress: string
29
/**
30
* Token type. Either 'nft' (ERC-721) or 'multitoken' (ERC-1155)
31
*/
32
type: 'nft' | 'multitoken'
33
/**
34
* Token URI
35
*/
36
metadataURI: string
37
/**
38
* Token metadata
39
*/
40
metadata?: {
41
name: string
42
description: string
43
image: string
44
[metadataKey: string]: unknown
45
}
46
}
Network | Support |
---|---|
Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai | Multiple addresses per 1 invocation
NFTs (BAYC,...)
ERC-1155 Tokens |
Last modified 5d ago