getContractMetadata - SDK

Get the NFT collection metadata associated with the provided parameters.

Don’t have an API key?

Start using this method in your app today.


Get the NFT collection metadata associated with the provided parameters.


contractAddressstringThe contract address of the NFT.


Promise<NftContract>objectThe NFT collection metadata.

NftContract response object parameters

tokenTypestringThe type of the token in the contract. Available options are: ERC721 = "ERC721", ERC1155 = "ERC1155", UNKNOWN = "UNKNOWN"
namestringThe name of the contract.
symbolstringThe symbol of the contract.
openSeaobjectOpenSea's metadata for the contract.
contractDeployerstringThe address that deployed the NFT contract.
deployedBlockNumbernumberThe block number the NFT contract deployed in.

Example Request and Response

Prerequisite: You will need to install the Alchemy SDK before making requests with it.

The commands for installing it using npm or yarn are given below:

npm install alchemy-sdk
yarn add alchemy-sdk


// Imports the Alchemy SDK
const { Alchemy, Network } = require("alchemy-sdk");

// Configures the Alchemy SDK
const config = {
    apiKey: "alchemy-replit", // Replace with your API key
    network: Network.ETH_MAINNET, // Replace with your network

// Creates an Alchemy object instance with the config to use for making requests
const alchemy = new Alchemy(config);

const main = async () => {
    // define the address whose contract metadata you want to fetch
    const address = "0x61fce80d72363b731425c3a2a46a1a5fed9814b2";

    //Call the method to fetch metadata
    const response = await alchemy.nft.getContractMetadata(address)

    //Logging the response to the console



    contract: {
      address: '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d',
      name: 'BoredApeYachtClub',
      symbol: 'BAYC',
      totalSupply: '10000',
      tokenType: 'ERC721',
      openSea: [Object],
      contractDeployer: '0xaba7161a7fb69c88e16ed9f455ce62b791ee4d03',
      deployedBlockNumber: 12287507
    tokenId: '99',
    tokenType: 'ERC721',
    title: '',
    description: '',
    timeLastUpdated: '2023-03-02T17:33:56.457Z',
    metadataError: undefined,
    rawMetadata: {
      image: 'ipfs://QmWiXSKwbwHkobDdZbDc6t66kf192P33Ru5UJYhL5mPJTk',
      attributes: [Array]
    tokenUri: {
      gateway: '',
      raw: 'ipfs://QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/99'
    media: [ [Object] ],
    spamInfo: undefined
  ... 9900 more items
admin@Admins-MBP Alchem % node index.js
  address: '0x61fce80d72363b731425c3a2a46a1a5fed9814b2',
  name: 'CyborgMercenariesCm',
  symbol: 'CYBORG',
  totalSupply: '8039',
  tokenType: 'ERC1155',
  openSea: {
    floorPrice: 0.0015,
    collectionName: 'Undead Warriors',
    safelistRequestStatus: 'verified',
    imageUrl: '',
    description: 'Core Team\n' +
      ' | |\n' +
      'Undead Warriors are a collection of NFTs powered by the Undead Coin (UDC) battling the most difficult challenges in the E-Gaming and Web 3 space.\n' +
    externalUrl: '',
    twitterUsername: 'undead_warriors',
    discordUrl: '',
    lastIngestedAt: '2023-02-22T03:39:05.000Z'
  contractDeployer: '0xd32bb311467060cec58cd6e9b37134ca6d81377f',
  deployedBlockNumber: 13950908

Code Sandbox

You can test out the getContractMetadata method using the code sandbox below:

Use Cases

Here are some potential use cases for the getContractMetadata method:

  • Querying contract information: The getContractMetadata method can be used to retrieve general information about a smart contract, such as the contract's name, version, and author.

  • Verifying contract authenticity: The metadata of a smart contract can include a cryptographic hash of the source code used to compile the contract. By retrieving this hash through getContractMetadata, users can verify that the deployed contract matches the original source code.

  • Automating contract interactions: Some smart contracts may include metadata that provides additional information about the contract's functions and parameters. This information can be used to automatically generate code for interacting with the contract, which can save time and reduce errors.

Related Methods

  • getNftMetadata: Get the NFT metadata associated with the provided parameters.