Dynamic Metadata

Create Metadata

In order to get started with Dynamic Metadata, create the namespace that the metadata will be stored under. Namespaces are unique. Think of namespaces like a bucket where you can store metadata items into.

  • Namespaces may only consist of lower-case letters, numbers, and hyphens.

Creating metadata namespace

In the following example, we will create a "Heroes" namespace and add hero metadata under the namespace.


...const response = await fetch('https://api.utiliti.ai/metadata', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-key': '<YOUR_API_KEY_HERE>', }, body: JSON.stringify({ namespace: 'heroes', description: 'This is the heroes namespace', }), })

Add metadata to the namespace


...const response = await fetch('https://api.utiliti.ai/metadata/ + "heroes"', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-key': '<YOUR_API_KEY_HERE>', }, body: JSON.stringify({ id: '5226', name: 'Hero Galaxy #5226', image: 'https://herogalaxy.mypinata.cloud/ipfs/QmQq6ejvT6Ut3eBiGShxLuVG88a4EdsHuyesDBVeFT6ZwB/5226.png', description: 'Hero Galaxy Heroes', attributes: [ { trait_type: 'Background', value: 'Blue Sky', }, { trait_type: 'Aura', value: 'None', }, { trait_type: 'Skin', value: 'Silver', }, { trait_type: 'Mouth', value: 'Base mouth', }, { trait_type: 'Eyes', value: 'Pink Feline', }, { trait_type: 'Eyebrows', value: 'Quizzical', }, ], }), })

Update metadata


...const response = await fetch('https://api.utiliti.ai/metadata/ + "heroes"', { method: 'PUT', headers: { 'Content-Type': 'application/json', 'X-API-key': '<YOUR_API_KEY_HERE>', }, body: JSON.stringify({ id: '5226', name: 'Hero Galaxy Heroes #5226', }), })

Token URI with Dynamic Metadata

Most ERC-721 and ERC-1155 contracts implement the tokenURI(uint256 tokenId) method to vend metadata information about their NFT.

Your dynamic token metadata will be vended from: https://api.utiliti.ai/metadata/{namespace}/{metadata_id}

We recommend setting the base URI of the NFT contract to: https://api.utiliti.ai/metadata/{namespace}/


Previous
Overview