Update NFT Metadata

This guide explains how to update the metadata of an already minted NFT.

Dynamic NFTs

Dynamic NFTs allow you to update/change the metadata of an already minted NFT, such as its attributes, properties, and animationUrls. In this guide, we will be updating the attribute.

Minted NFT Metadata

Following is an example of an already-minted NFT. We will use this and update its description property on the token level.

{
  "success": true,
  "result": [
    {
      "id": 3,
      "typeId": 2,
      "metadata": {
        "name": "ATOM",
        "description": "Dynamic NFTs",
        "image": "https://media.istockphoto.com/id/531062677/photo/light-brown-cushion-isolated-on-white-background.jpg?s=1024x1024&w=is&k=20&c=1FVQPnm-VBLJAveaqRu4iNxpfvc1pXMUOQo5rzrzQrc=",
        "imagePreview": "https://media.istockphoto.com/id/531062677/photo/light-brown-cushion-isolated-on-white-background.jpg?s=1024x1024&w=is&k=20&c=1FVQPnm-VBLJAveaqRu4iNxpfvc1pXMUOQo5rzrzQrc=",
        "imageThumbnail": "https://media.istockphoto.com/id/531062677/photo/light-brown-cushion-isolated-on-white-background.jpg?s=1024x1024&w=is&k=20&c=1FVQPnm-VBLJAveaqRu4iNxpfvc1pXMUOQo5rzrzQrc=",
        "backgroundColor": "#800080",
        "background_color": "#800080",
        "animationUrl": "https://cdn.pixabay.com/vimeo/246463976/atoms-13232.mp4?width=640&hash=4c8703a3f34b289318ae2077bcae4008b1d886da",
        "animation_url": "https://cdn.pixabay.com/vimeo/246463976/atoms-13232.mp4?width=640&hash=4c8703a3f34b289318ae2077bcae4008b1d886da",
        "externalUrl": "www.venly.io",
        "external_url": "www.venly.io",
        "animationUrls": [
          {
            "type": "Video",
            "value": "https://cdn.pixabay.com/vimeo/246463976/atoms-13232.mp4?width=640&hash=4c8703a3f34b289318ae2077bcae4008b1d886da"
          }
        ],
        "attributes": [
          {
            "type": "stat",
            "name": "Health",
            "value": "90",
            "maxValue": "100",
            "displayType": "number",
            "display_type": "number",
            "traitType": "Health",
            "trait_type": "Health"
          },
          {
            "type": "system",
            "name": "tokenTypeId",
            "value": "2",
            "traitType": "Token Type ID",
            "trait_type": "Token Type ID"
          },
          {
            "type": "property",
            "name": "maxSupply",
            "value": "10",
            "traitType": "Max Supply",
            "trait_type": "Max Supply"
          },
          {
            "type": "property",
            "name": "mintNumber",
            "value": "1",
            "traitType": "Mint Number",
            "trait_type": "Mint Number"
          }
        ],
        "contract": {
          "address": "0x127653794299145470e973cf68da9983f576f266",
          "name": "Dynamic NFTs Collection",
          "symbol": "DYNFCO",
          "image": "https://pbs.twimg.com/profile_images/1669300450649157635/4xg-wsbK_400x400.jpg",
          "imageUrl": "https://pbs.twimg.com/profile_images/1669300450649157635/4xg-wsbK_400x400.jpg",
          "image_url": "https://pbs.twimg.com/profile_images/1669300450649157635/4xg-wsbK_400x400.jpg",
          "description": "Sample description",
          "externalLink": "www.venly.io",
          "external_link": "www.venly.io",
          "externalUrl": "www.venly.io",
          "external_url": "www.venly.io",
          "media": [],
          "type": "ERC_1155"
        },
        "fungible": false
      },
      "mineDate": "2023-12-01T11:15:27.000+00:00",
      "confirmed": true,
      "amount": 1,
      "transactionHash": "0x3b506c614eaf1d7617ac8ec87e730a88f5632f2f1698447e8bed261a46f4d981"
    }
  ]
}

You can update the property for a specific NFT using the following endpoint.

Request Endpoint: reference

PUT /api/v2/contracts/{secretType}/{contractAddress}/tokens/{tokenId}/metadata/{propertyName}
ParameterParam TypeDescriptionTypeRequired
{secretType}PathThe blockchain of the NFT collectionStringโœ…
{contractAddress}PathThe NFT contract addressStringโœ…
{tokenId}PathThe ID of the token you want to updateStringโœ…
{propertyName}PathThe name of the property you want to update (NOTE: This param is case sensitive.)
This can be: name, description, externalUrl, image, backgroundColor
Stringโœ…
valueBodyValue of the property that you want to updateStringโœ…

Example Request

๐Ÿ“˜

We are going to change the value of the description property. In our original minted NFT, the description property had the value:

    "description": "Dynamic NFTs"

PUT /api/v2/contracts/MATIC/0x127653794299145470e973cf68da9983f576f266/tokens/3/metadata/description
{
  "value": "The description of the NFT has been updated."
}

Response Body

๐Ÿ‘

The description has been updated successfully.

{
  "success": true,
  "result": {
    "name": "ATOM",
    "description": "The description of the NFT has been updated.",
    "image": "https://media.istockphoto.com/id/531062677/photo/light-brown-cushion-isolated-on-white-background.jpg?s=1024x1024&w=is&k=20&c=1FVQPnm-VBLJAveaqRu4iNxpfvc1pXMUOQo5rzrzQrc=",
    "imagePreview": "https://media.istockphoto.com/id/531062677/photo/light-brown-cushion-isolated-on-white-background.jpg?s=1024x1024&w=is&k=20&c=1FVQPnm-VBLJAveaqRu4iNxpfvc1pXMUOQo5rzrzQrc=",
    "imageThumbnail": "https://media.istockphoto.com/id/531062677/photo/light-brown-cushion-isolated-on-white-background.jpg?s=1024x1024&w=is&k=20&c=1FVQPnm-VBLJAveaqRu4iNxpfvc1pXMUOQo5rzrzQrc=",
    "backgroundColor": "#800080",
    "background_color": "#800080",
    "animationUrl": "https://cdn.pixabay.com/vimeo/246463976/atoms-13232.mp4?width=640&hash=4c8703a3f34b289318ae2077bcae4008b1d886da",
    "animation_url": "https://cdn.pixabay.com/vimeo/246463976/atoms-13232.mp4?width=640&hash=4c8703a3f34b289318ae2077bcae4008b1d886da",
    "externalUrl": "www.venly.io",
    "external_url": "www.venly.io",
    "animationUrls": [
      {
        "type": "Video",
        "value": "https://cdn.pixabay.com/vimeo/246463976/atoms-13232.mp4?width=640&hash=4c8703a3f34b289318ae2077bcae4008b1d886da"
      }
    ],
    "attributes": [
      {
        "type": "stat",
        "name": "Health",
        "value": "100",
        "maxValue": "100",
        "displayType": "number",
        "display_type": "number",
        "traitType": "Health",
        "trait_type": "Health"
      },
      {
        "type": "system",
        "name": "tokenTypeId",
        "value": "2",
        "traitType": "Token Type ID",
        "trait_type": "Token Type ID"
      },
      {
        "type": "property",
        "name": "maxSupply",
        "value": "10",
        "traitType": "Max Supply",
        "trait_type": "Max Supply"
      },
      {
        "type": "property",
        "name": "mintNumber",
        "value": "1",
        "traitType": "Mint Number",
        "trait_type": "Mint Number"
      }
    ],
    "contract": {
      "address": "0x127653794299145470e973cf68da9983f576f266",
      "name": "Dynamic NFTs Collection",
      "symbol": "DYNFCO",
      "image": "https://pbs.twimg.com/profile_images/1669300450649157635/4xg-wsbK_400x400.jpg",
      "imageUrl": "https://pbs.twimg.com/profile_images/1669300450649157635/4xg-wsbK_400x400.jpg",
      "image_url": "https://pbs.twimg.com/profile_images/1669300450649157635/4xg-wsbK_400x400.jpg",
      "description": "Sample description",
      "externalLink": "www.venly.io",
      "external_link": "www.venly.io",
      "externalUrl": "www.venly.io",
      "external_url": "www.venly.io",
      "media": [],
      "type": "ERC_1155"
    },
    "fungible": false
  }
}

๐Ÿ‘

Similarly you can update an NFTs: