getContractMetadata
Queries NFT high-level collection/contract level information
This endpoint is supported only on the following chains and networks:
  • Ethereum: Mainnet and Goerli (BETA)
  • Polygon: Mainnet (BETA) and Mumbai (BETA)
To see chain support across all features, check out the feature matrix.

Parameters

  • contractAddress: [string hexadecimal] - contract address for the NFT collection

Returns

  • address: [string hexadecimal] contract address for the queried NFT collection
  • contractMetadata: [object]
    • name: [string] NFT contract name
    • symbol: [string] NFT contract symbol abbreviation
    • totalSupply: [string] total number of NFTs in a given NFT collection
    • tokenType: [string] "erc721" or "erc1155" NFT token type
NOTE: The name, symbol, and totalSupplyfields will only be set in the response if the contract implements functions to return each field.

Example

Request

Node - Fetch
Node - Axios
Postman
CURL
1
import fetch from 'node-fetch';
2
3
var requestOptions = {
4
method: 'GET',
5
redirect: 'follow'
6
};
7
8
const apiKey = "demo"
9
const baseURL = `https://eth-mainnet.alchemyapi.io/nft/v2/${apiKey}/getContractMetadata`;
10
const contractAddr = "0x61fce80d72363b731425c3a2a46a1a5fed9814b2";
11
const fetchURL = `${baseURL}?contractAddress=${contractAddr}`
12
13
fetch(fetchURL, requestOptions)
14
.then(response => response.json())
15
.then(response => JSON.stringify(response, null, 2))
16
.then(result => console.log(result))
17
.catch(error => console.log('error', error));
Copied!
1
import axios from 'axios';
2
3
// replace with your Alchemy api key
4
const apiKey = "demo";
5
const baseURL = `https://eth-mainnet.alchemyapi.io/nft/v2/${apiKey}/getContractMetadata`;
6
const contractAddr = "0x004dd1904b75b7e8a46711dde8a0c608578e0302";
7
8
var config = {
9
method: 'get',
10
url: `${baseURL}?contractAddress=${contractAddr}`,
11
headers: { }
12
};
13
14
axios(config)
15
.then(response => console.log(JSON.stringify(response.data, null, 2)))
16
.catch(error => console.log(error));
Copied!
1
URL: https://eth-mainnet.g.alchemy.com/nft/v2/demo/getContractMetadata/?contractAddress=0x61fce80d72363b731425c3a2a46a1a5fed9814b2
2
RequestType: GET
Copied!
1
curl --location --request GET 'https://eth-mainnet.g.alchemy.com/nft/v2/demo/getContractMetadata/?contractAddress=0x61fce80d72363b731425c3a2a46a1a5fed9814b2'
Copied!

Response

1
{
2
"address": "0x004dd1904b75b7e8a46711dde8a0c608578e0302",
3
"contractMetadata": {
4
"name": "JetPack420",
5
"symbol": "DCL-JTPCK420",
6
"totalSupply": "307",
7
"tokenType": "erc721"
8
}
9
}
Copied!