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 properties

tokenTypestringThe type of the token in the contract. Available options are: ERC721 = "ERC721", ERC1155 = "ERC1155", UNKNOWN = "UNKNOWN"
addressstringThe address of the NFT contract.
namestringThe name of the contract.
symbolstringThe symbol of the contract.
totalSupplystringThe number of NFTs in the contract as an integer string. This field is only available on ERC-721 contracts.
openSeaMetadataobjectOpenSea's metadata for the contract. Parameters include:

1. floorPrice?: number: The floor price of the collection.
2. collectionName?: string: The name of the collection on OpenSea.
3. safelistRequestStatus?: string: The approval status of the collection on OpenSea.
4. imageUrl?: string: The image URL determined by OpenSea.
5. description?: string: The description of the collection on OpenSea.
6. externalUrl?: string: The homepage of the collection as determined by OpenSea.
7. twitterUsername?: string: The Twitter handle of the collection.
8. discordUrl?: string: The Discord URL of the collection.
9. lastIngestedAt: string: Timestamp of when Alchemy last ingested the OpenSea metadata.
contractDeployerstringThe address that deployed the NFT contract.
deployedBlockNumbernumberThe block number the NFT contract deployed in.

Example Request and Response

Prerequisite: You must 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@latest
yarn add alchemy-sdk@latest


// 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



    "address": "0x61fcE80D72363B731425c3A2A46a1A5fed9814B2",
    "name": "CyborgMercenariesCm",
    "symbol": "CYBORG",
    "totalSupply": "8039",
    "tokenType": "ERC1155",
    "contractDeployer": "0xd32bB311467060ceC58Cd6e9b37134CA6d81377F",
    "deployedBlockNumber": 13950908,
    "openSeaMetadata": {
        "floorPrice": 0.001,
        "collectionName": "Undead Warriors",
        "collectionSlug": "undeadwarriors",
        "safelistRequestStatus": "verified",
        "imageUrl": "",
        "description": "Core Team\n | |\nUndead 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\n",
        "externalUrl": "",
        "twitterUsername": "undead_warriors",
        "discordUrl": "",
        "bannerImageUrl": "",
        "lastIngestedAt": "2023-09-17T10:13:28.000Z"

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.