Get Metadata

Endpoint to retrieve metadata for ERC721, ERC1155 or ERC20 tokens.

Get Metadata

POST https://api.withmystic.xyz/marketplace-api/get-metadata

Receives a chainId and a token's information and returns the metadata for the respective token. Can have multiple tokens.

Headers

Name
Type
Description

Bearer token*

String

Your API key

Request Body

Name
Type
Description

chainId*

Number

Id of the blockchain whose NFTs we want to get

metadataArray.type*

String

Asset type (NFT / TOKEN)

metadataArray.contractAddress*

String

Contract Address of the token

metadataArray.tokenId

String

Queried token's token ID

{
   "nftsMetadata":[
      {
         "contract":{
            "address":"0xe29f8038d1a3445ab22ad1373c65ec0a6e1161a4",
            "name":"BoredApeYachtClub",
            "symbol":"BAYC",
            "totalSupply":"10000",
            "tokenType":"ERC721",
            "openSea":{
               "lastIngestedAt":"2023-08-24T06:49:03.000Z"
            },
            "contractDeployer":"0x69f2301e037f1e35cc056a736758123460141d7a",
            "deployedBlockNumber":8121008
         },
         "tokenId":"9359",
         "tokenType":"ERC721",
         "title":"",
         "description":"",
         "timeLastUpdated":"2023-07-06T05:48:14.575Z",
         "rawMetadata":{
            "image":"ipfs://QmNQPhqyHFzoyWnpwJcyQSweZFkZZdPRD6EeMQMW7kw3Uv",
            "attributes":[
               {
                  "value":"Bored",
                  "trait_type":"Mouth"
               },
               {
                  "value":"Bored",
                  "trait_type":"Eyes"
               },
               {
                  "value":"Army Green",
                  "trait_type":"Background"
               },
               {
                  "value":"Sleeveless T",
                  "trait_type":"Clothes"
               },
               {
                  "value":"Beanie",
                  "trait_type":"Hat"
               },
               {
                  "value":"Black",
                  "trait_type":"Fur"
               }
            ]
         },
         "tokenUri":{
            "gateway":"https://alchemy.mypinata.cloud/ipfs/QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/9359",
            "raw":"ipfs://QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/9359"
         },
         "media":[
            {
               "gateway":"https://nft-cdn.alchemy.com/eth-goerli/aa1f9dfc3ae502938926578a05c600fc",
               "thumbnail":"https://res.cloudinary.com/alchemyapi/image/upload/thumbnailv2/eth-goerli/aa1f9dfc3ae502938926578a05c600fc",
               "raw":"ipfs://QmNQPhqyHFzoyWnpwJcyQSweZFkZZdPRD6EeMQMW7kw3Uv",
               "format":"png",
               "bytes":108126
            }
         ]
      }
   ]
}

Example

Let's simulate retrieving the metadata for the Ethereum NFT Mystical Wizard #633. In this case, what we'd query the API with would be:

{
  "chainId": 1,
  "metadataArray": [
    {
      "type": "NFT",
      "contractAddress": "0x74cb5611e89078b2e5cb638a873cf7bddc588659",
      "tokenId": "633"
    }
  ]
}

And here we can find the response we would get from making this call (mock values):

{
   "nftsMetadata":[
      {
         "contract":{
            "address":"0xe29f8038d1a3445ab22ad1373c65ec0a6e1161a4",
            "name":"BoredApeYachtClub",
            "symbol":"BAYC",
            "totalSupply":"10000",
            "tokenType":"ERC721",
            "openSea":{
               "lastIngestedAt":"2023-08-24T06:49:03.000Z"
            },
            "contractDeployer":"0x69f2301e037f1e35cc056a736758123460141d7a",
            "deployedBlockNumber":8121008
         },
         "tokenId":"9359",
         "tokenType":"ERC721",
         "title":"",
         "description":"",
         "timeLastUpdated":"2023-07-06T05:48:14.575Z",
         "rawMetadata":{
            "image":"ipfs://QmNQPhqyHFzoyWnpwJcyQSweZFkZZdPRD6EeMQMW7kw3Uv",
            "attributes":[
               {
                  "value":"Bored",
                  "trait_type":"Mouth"
               },
               {
                  "value":"Bored",
                  "trait_type":"Eyes"
               },
               {
                  "value":"Army Green",
                  "trait_type":"Background"
               },
               {
                  "value":"Sleeveless T",
                  "trait_type":"Clothes"
               },
               {
                  "value":"Beanie",
                  "trait_type":"Hat"
               },
               {
                  "value":"Black",
                  "trait_type":"Fur"
               }
            ]
         },
         "tokenUri":{
            "gateway":"https://alchemy.mypinata.cloud/ipfs/QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/9359",
            "raw":"ipfs://QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/9359"
         },
         "media":[
            {
               "gateway":"https://nft-cdn.alchemy.com/eth-goerli/aa1f9dfc3ae502938926578a05c600fc",
               "thumbnail":"https://res.cloudinary.com/alchemyapi/image/upload/thumbnailv2/eth-goerli/aa1f9dfc3ae502938926578a05c600fc",
               "raw":"ipfs://QmNQPhqyHFzoyWnpwJcyQSweZFkZZdPRD6EeMQMW7kw3Uv",
               "format":"png",
               "bytes":108126
            }
         ]
      }
   ]
}

Here is an example API call, for you to copy and modify:

{
  "chainId": number,
  "metadataArray": [
    {
      "type": "NFT",
      "contractAddress": "string",
      "tokenId": "string"
    }
  ]
}

Happy coding!

Last updated