Get the metadata of a specific NFT
Pass an NFT's contract address and token ID to the Tatum Data API to get its metadata: name, description, image, token URI and token type.
As non-fungible tokens (NFTs) gain popularity in the digital asset space, it becomes increasingly important for creators, collectors, and traders to have access to detailed information about individual NFTs. This guide introduces you to the operation of retrieving the metadata of a specific NFT, providing valuable insights into the unique properties, characteristics, and history of the digital asset. By leveraging this functionality, you can better understand the provenance, rarity, and artistic attributes of the NFT, make well-informed decisions about buying, selling, or holding it, and navigate the dynamic NFT market with greater confidence. Ultimately, this operation allows you to manage your digital assets more effectively and fosters a deeper appreciation for the unique qualities of each NFT.
How to get the metadata of the NFT on the Ethereum network
Use the TatumSDK (@tatumio/tatum) to get the metadata of the specific NFT.
// yarn add @tatumio/tatum
import {TatumSDK, Network, Ethereum, ResponseDto, NftTokenDetail} from '@tatumio/tatum'
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM, apiKey: '{YOUR_API_KEY}'})
const metadata: ResponseDto<NftTokenDetail|null> = await tatum.nft.getNftMetadata({
tokenAddress: '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d', // replace with your collection
tokenId: '1'
})
console.log(metadata.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 metadata = await tatum.nft.getNftMetadata({
tokenAddress: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", // replace with your collection
tokenId: "1"
});
console.log(metadata.data);
await tatum.destroy();
} catch (error) {
console.error("Error getting NFT metadata:", error);
}
})();curl --request GET \
--url 'https://api.tatum.io/v4/data/metadata?chain=ethereum-mainnet&tokenAddress=0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d&tokenIds=1' \
--header 'accept: application/json' \
--header 'x-api-key: {YOUR_API_KEY}'Request interface
interface GetNftMetadata {
/**
* Token ID
*/
tokenId: string
/**
* Token contract address
*/
tokenAddress: string
}Response interface
interface NftTokenDetail {
/**
* 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
}
}Updated 3 days ago