Accessing NFT data

Non-fungible tokens, or NFTs, became one of the most popular use cases in the current blockchain world. CSPR.cloud keeps track of all NFT contracts compatible with the CEP-47arrow-up-right and CEP-78arrow-up-right NFT standards on the Casper Network. CSPR.cloud provides a possibility to:

Moreover, CSPR.cloud not only tracks on-chain NFT data but also fetches the off-chain metadata for you, which can be particularly slow when the metadata is stored on IPFSarrow-up-right. Below is an example that demonstrated fetching NFT tokens for the CasperPunksarrow-up-right contracts, which is a CEP-78arrow-up-right smart NFT contract that stores the token metadata on IPFS:

curl -X 'GET' \
  'https://api.cspr.cloud/contract-packages/ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495/nft-tokens' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
{
  "data": [
    {
      "contract_package_hash": "ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495",
      "is_burned": false,
      "offchain_metadata": {
        "attributes": [
          {
            "trait_type": "background",
            "value": "Red"
          },
          {
            "trait_type": "body",
            "value": "Grey"
          },
          {
            "trait_type": "eyes",
            "value": "Narrow"
          },
          {
            "trait_type": "hat",
            "value": "tophat"
          },
          {
            "trait_type": "mouth",
            "value": "StacheBrown"
          }
        ],
        "compiler": "HashLips Art Engine",
        "date": 1682468152509,
        "description": "The first generation of generative CasperPunks",
        "dna": "5dd6a50e43d44cda7af7d50c7d314af724c2851d",
        "edition": 1,
        "image": "https://api-box.casperpunks.io/metadata/images/1.png",
        "name": "Casper Punks Gen 1 #1"
      },
      "offchain_metadata_status": 2,
      "onchain_metadata": {
        "checksum": "",
        "name": "CasperPunks Gen1",
        "symbol": "CP-GEN1",
        "token_uri": "https://api-box.casperpunks.io/metadata/1"
      },
      "owner_hash": "909ce489ea31a76c8f3ca97364b209b942d023a1a0447dc63263444c1566338a",
      "owner_type": 0,
      "timestamp": "2023-05-23T06:38:53Z",
      "token_id": "1",
      "token_standard_id": 2,
      "tracking_id": 19236
    },
    {
      "contract_package_hash": "ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495",
      "is_burned": false,
      "offchain_metadata": {
        "attributes": [
          {
            "trait_type": "background",
            "value": "Purple"
          },
          {
            "trait_type": "body",
            "value": "Grey"
          },
          {
            "trait_type": "eyes",
            "value": "Bulging"
          },
          {
            "trait_type": "hat",
            "value": "PinkMohawk"
          },
          {
            "trait_type": "mouth",
            "value": "Patch"
          }
        ],
        "compiler": "HashLips Art Engine",
        "date": 1682468131158,
        "description": "The first generation of generative CasperPunks",
        "dna": "0de5f3c56c496630c56d0b78739c69a68cbe2824",
        "edition": 10,
        "image": "https://api-box.casperpunks.io/metadata/images/10.png",
        "name": "Casper Punks Gen 1 #10"
      },
      "offchain_metadata_status": 2,
      "onchain_metadata": {
        "checksum": "",
        "name": "CasperPunks Gen1",
        "symbol": "CP-GEN1",
        "token_uri": "https://api-box.casperpunks.io/metadata/10"
      },
      "owner_hash": "6d230cf0b8f2a1aae9b88108f483e66c83a301f59b2c8118e0c7765081e36fe9",
      "owner_type": 0,
      "timestamp": "2023-05-24T14:52:46Z",
      "token_id": "10",
      "token_standard_id": 2,
      "tracking_id": 19247
    },
    ...
    {
      "contract_package_hash": "ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495",
      "is_burned": false,
      "offchain_metadata": {
        "attributes": [
          {
            "trait_type": "background",
            "value": "Mint"
          },
          {
            "trait_type": "body",
            "value": "Grey"
          },
          {
            "trait_type": "eyes",
            "value": "Frown"
          },
          {
            "trait_type": "hat",
            "value": "beanie"
          },
          {
            "trait_type": "mouth",
            "value": "Laugh"
          }
        ],
        "compiler": "HashLips Art Engine",
        "date": 1682468103314,
        "description": "The first generation of generative CasperPunks",
        "dna": "1df66a2d43f0de7784136685eb8f85531e53d7d1",
        "edition": 1006,
        "image": "https://api-box.casperpunks.io/metadata/images/1006.png",
        "name": "Casper Punks Gen 1 #1006"
      },
      "offchain_metadata_status": 2,
      "onchain_metadata": {
        "checksum": "",
        "name": "CasperPunks Gen1",
        "symbol": "CP-GEN1",
        "token_uri": "https://api-box.casperpunks.io/metadata/1006"
      },
      "owner_hash": "96609d29c02388c81b6b1bd08feef31d3f3f1331ae39c0ad4f921e43c14d5393",
      "owner_type": 1,
      "timestamp": "2023-05-25T02:24:28Z",
      "token_id": "1006",
      "token_standard_id": 2,
      "tracking_id": 20245
    }
  ],
  "item_count": 2166,
  "page_count": 217
}

Note the offchain_metadata property, which contains the off-chain token metadata.

Last updated