Dynamic NFTs

Intro

Dynamic NFTs API Flow
Dynamic NFTs API Flow

There are three basic things that you can change in an NFT.

  1. Attributes:

    1. Type of attribute

    2. Name of the attribute

    3. Attribute's value

    4. Attribute's maximum value

  2. Properties:

    1. Name

    2. Description

    3. External Url

    4. Image

    5. Background Color

  3. Animation URLs

📘

  • Changes made on the token-level will not affect anything on the token-type level. The token-type will have the same metadata as you defined when creating it.

  • If you change the metadata of the token-type, after minting an NFT, the changes will not reflect in the already minted NFT. The changes will reflect only on the new minted NFTs under that token-type.

Dynamic NFT Endpoints

Following is an example of an already-minted NFT. We will use this and update its properties, attributes, and animation URLs, all on the token level.

JSON

1. Attributes

Attributes on the token level can be updated, added, and deleted. Read more about attributes.

You can change (add, update, delete) attributes on the token-level without affecting the attributes defined on the token-type level. When you change an attribute, it is only for a specific NFT.

All NFTs minted from a token-type will include the original attribute values that were defined when you created the token-type. In short, the changes will not affect the token-type.

🚧

As there can be multiple attributes, the attributes defined on the token-type level will be merged together with attributes defined on the token level.

1.1 Update Attribute

You can update an attribute's data for a specific NFT using the following endpoint.

🚧

The attributes tokenTypeId, maxSupply, mintNumber cannot be updated.

Request Endpoint: reference

HTTP

Parameter
Param Type
Description
Type
Required

{secretType}

Path

The blockchain of the NFT collection

String

{contractAddress}

Path

The NFT contract address

String

{tokenId}

Path

The ID of the token you want to update

String

{attributeName}

Path

The name of the attribute you want to update (NOTE: This param is case sensitive.)

String

type

Body

Can be one of these: property|stat|boost

String

value

Body

Value of the attribute

String

maxValue

Body

Max value for the attribute

String

❗️

The attributeName in the path is case sensitive.

Example Request

📘

We are going to change the values of the Health attribute. In our original minted NFT, the Health attribute had the values:

JSON

HTTP

JSON

Response Body

👍

The values for the Health attribute have been changed successfully.

JSON

1.2 Add an Attribute

You can add attributes to a specific NFT using the following endpoint:

Request Endpoint: reference

HTTP

Parameter
Param Type
Description
Type
Required

{secretType}

Path

The blockchain of the NFT collection

String

{contractAddress}

Path

The NFT contract address

String

{tokenId}

Path

The ID of the token

String

type

Body

Can be one of these: property|stat|boost

String

name

Body

The name of the attribute

String

value

Body

Value of the attribute

String

maxValue

Body

Max value for the attribute

String

Example Request

📘

In this example, we are adding a new attribute called Power to the token.

HTTP

JSON

Response Body

👍

A new attribute called Power has been added successfully.

JSON

1.3 Delete an Attribute

You can delete an attribute for a specific NFT by using the following endpoint.

🚧

The attributes tokenTypeId, maxSupply, mintNumber cannot be deleted.

Request Endpoint: reference

HTTP

Parameter
Param Type
Description
Type
Required

{secretType}

Path

The blockchain of the NFT collection

String

{contractAddress}

Path

The NFT contract address

String

{tokenId}

Path

The ID of the token for which you want to delete the attribute

String

{attributeName}

Path

The name of the attribute you want to delete. (NOTE: This param is case sensitive.)

String

❗️

The attributeName in the path is case sensitive.

Example Request

📘

In this example, we are deleting the Power attribute.

HTTP

Response Body

👍

The Power attribute was deleted successfully.

JSON

2. Properties

The following properties on the token level can be updated, added, and deleted:

  • name (This property cannot be deleted)

  • description

  • externalUrl

  • image

  • backgroundColor

🚧

As all the properties can only have a single value, the changes made to properties on token level will overide the properties defined on the token-type level.

2.1 Update a Property

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

📘

You can also use this endpoint to add a property, such as name, description, externalUrl, image, backgroundColor.

Request Endpoint: reference

HTTP

Parameter
Param Type
Description
Type
Required

{secretType}

Path

The blockchain of the NFT collection

String

{contractAddress}

Path

The NFT contract address

String

{tokenId}

Path

The ID of the token you want to update

String

{propertyName}

Path

The name of the property you want to update (NOTE: This param is case sensitive.) This can be: name, description, externalUrl, image, backgroundColor

String

value

Body

Value of the property that you want to update

String

Example Request

📘

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

JSON

HTTP

JSON

Response Body

👍

The description has been updated successfully.

JSON

2.2 Delete a Property

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

🚧

Only the name property cannot be deleted.

Request Endpoint: reference

HTTP

Parameter
Param Type
Description
Type
Required

{secretType}

Path

The blockchain of the NFT collection

String

{contractAddress}

Path

The NFT contract address

String

{tokenId}

Path

The ID of the token you want to update

String

{propertyName}

Path

The name of the property you want to update (NOTE: This param is case sensitive.) This can be: description, externalUrl, image, backgroundColor

String

Example Request

HTTP

Response Body

👍

The description property has been deleted successfully.

JSON

3. Animation Url

The animation Urls on the token level can be updated, added, and deleted. Read about [animationUrls](https://docs.quantum.io/docs/animation-media#animationurls).

🚧

  • The animationUrls is a single array. The changes made to it on the token level will overide the animationUrls defined on the token-type level.

  • When you update the animationUrls, you will overwrite the whole array of URLs, thus you cannot update one specific URL from the array.

3.1 Update Animation URL

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

📘

  • This endpoint can also be used to add the animationUrls, in case you delete them.

  • Running this endpoint will overwrite the previous animationUrls array.

Request Endpoint: reference

HTTP

Parameter
Param Type
Description
Type
Required

{secretType}

Path

The blockchain of the NFT collection

String

{contractAddress}

Path

The NFT contract address

String

{tokenId}

Path

The ID of the token you want to update

String

type

Body

The type of the animation media. Allowed values: image | audio | video

String

value

Body

The URL of the animation media

String

Example Request

📘

We are going to update the animationUrls. In our original minted NFT, the animationUrls had the values:

JSON

HTTP

JSON

Response Body

👍

The values of the animationUrls array have been updated successfully.

JSON

3.2 Delete Animation Urls

You can delete the animationUrls for a specific NFT using the following endpoint.

Request Endpoint: reference

HTTP

Parameter
Param Type
Description
Type
Required

{secretType}

Path

The blockchain of the NFT collection

String

{contractAddress}

Path

The NFT contract address

String

{tokenId}

Path

The ID of the token you want to update

String

Example Request

HTTP

Response Body

👍

The animationUrls array has been deleted successfully.

JSON

Last updated