Tangocrypto
Search
⌃K

Tokens (NFTs)

Create the tokens

Once the collection is created you can start adding what will become an NFTs (technically speaking to be an NFT it needs to be minted in the blockchain). The next step is to upload the images and define the metadata for each NFT in the collection.

Parameters

  • tokens: array of tokens. You can upload a maximum of 25 tokens in a single request.
  • asset_name: (Mandatory) Take into consideration is the name is case sensitive and is between 2 and 32 characters (maximum 64 bytes for UTF-8 encoded).
  • asset_name: (Mandatory) Take into consideration is the name is case sensitive and is between 2 and 32 characters (maximum 64 bytes for UTF-8 encoded).
  • name: (Mandatory) Display name. Between 2 and 32 characters (maximum 64 bytes for UTF-8 encoded).
  • description: (Optional) Token description. Between 2 and 32 characters (maximum 64 bytes for UTF-8 encoded).
  • media_type: (Optional) Media type. It is common to have NFTs with MIME-type imag, audioand video. For example:
    • image/gif: Graphics Interchange Format (GIF).
    • image/jpeg: Joint Photographic Expert Group image (JPEG).
    • image/png: Portable Network Graphics (PNG).
    • audio/wav: Waveform audio file format (WAV).
    • video/mp4: MPEG-4 Part 14 (MP4).
  • image: (Mandatory) A base64 encoded image or an image that is already pinned in IPFS, for example, ipfs://QmP4sEnaYa1fhLTFVTUq5E8d8XvEtxBS7NE5M3TACUtSxh or through an IPFS gateway https://ipfs.io/ipfs/QmP4sEnaYa1fhLTFVTUq5E8d8XvEtxBS7NE5M3TACUtSxh. You can also add an image hosted in a webserver, for example, https://www.example.com/myimage.png
  • metadata_attributes: You have to specify the values for the tag attributes for every token as defined in the collection attribute tag definition. Notice that you have to define these values for every single NFT in the collection. For example, we set the colour, body, eyes, face and mime type for that particular NFT.
    • tag: Use the tag to match the placeholder defined in the collection.
    • value: Use the value to set a value for the placeholder tag.
  • custom_attributes: Here you can set any arbitrary attributes that you didn't include in the collection attributes tag definition. Use key-value pairs to define unique attributes for each NFT.
The resulting NFT metadata will contain attributes defined in both metadata_attibutes and custom_attributes.
Here you have to define the value for the variable attributes defined in the collection, and also, you can add custom attributes. In the following image, you can see how the metadata generation process works and how the tag values are replaced where you defined the variable attributes using the angle brackets.
Metadata generation process (click to enlarge)
Example
HTTP
cURL
NodeJs
POST /<app-id>/v1/nft/collections/<collection-id>/tokens HTTP/1.1
Host: cardano-testnet.tangocrypto.com
x-api-key: <your-api-key>
Content-Type: application/json
{
"tokens": [{
"name": "Tango 01",
"asset_name": "Tango01",
"description": "If you get all tangled up, just tango on.",
"media_type": "image/png",
"image": "iVBORw0KGgoAAAANSU.....hEUgAADQYAAA0HCAYAAACB0xAqAAAACXBIWXMA",
"metadata_attributes": [{
"tag": "<color>",
"value": "Blue"
},
{
"tag": "<body>",
"value": "Skinny"
},
{
"tag": "<eyes>",
"value": "Blue"
},
{
"tag": "<face>",
"value": "rounded"
},
{
"tag": "<accessory>",
"value": "keyboard"
}
],
"custom_attributes": {
"serial_no": "12345545",
"md5checksum": "bc527343c7ffc103111f3a694b004e2f"
}
}]
}
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/nft/collections/<collection-id>/tokens' \
--header 'x-api-key: <your-api-key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"tokens": [{
"name": "Tango 01",
"asset_name": "Tango01",
"description": "If you get all tangled up, just tango on.",
"media_type": "image/png",
"image": "iVBORw0KGgoAAAANSU.....hEUgAADQYAAA0HCAYAAACB0xAqAAAACXBIWXMA",
"metadata_attributes": [{
"tag": "<color>",
"value": "Blue"
},
{
"tag": "<body>",
"value": "Skinny"
},
{
"tag": "<eyes>",
"value": "Blue"
},
{
"tag": "<face>",
"value": "rounded"
},
{
"tag": "<accessory>",
"value": "keyboard"
}
],
"custom_attributes": {
"serial_no": "12345545",
"md5checksum": "bc527343c7ffc103111f3a694b004e2f"
}
}]
}'
var axios = require('axios');
var data = JSON.stringify({
"tokens": [{
"name": "Tango 01",
"asset_name": "Tango01",
"description": "If you get all tangled up, just tango on.",
"media_type": "image/png",
"image": "iVBORw0KGgoAAAANSU.....hEUgAADQYAAA0HCAYAAACB0xAqAAAACXBIWXMA",
"metadata_attributes": [{
"tag": "<color>",
"value": "Blue"
},
{
"tag": "<body>",
"value": "Skinny"
},
{
"tag": "<eyes>",
"value": "Blue"
},
{
"tag": "<face>",
"value": "rounded"
},
{
"tag": "<accessory>",
"value": "keyboard"
}
],
"custom_attributes": {
"serial_no": "12345545",
"md5checksum": "bc527343c7ffc103111f3a694b004e2f"
}
}]
});
var config = {
method: 'post',
url: 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/nft/collections/<collection-id>/tokens',
headers: {
'x-api-key': '<your-api-key>',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Notice: In these examples we are not showing the full string for the base64 encoded image, and that's why you see the dots in the middle.

Response

{
"data": [
{
"id": "e9e00b33e0a34edcaf4534a2f96a637d",
"asset_name": "Tango01",
"name": "Tango 01",
"fingerprint": "asset1hzh0uut85ypcueu88422pmgf6twzj2c52f73a5",
"status": "FOR_SALE",
"description": "If you get all tangled up, just tango on.",
"image": "ipfs://QmP8uBgxmTpduCUbasQRCEpiq1g9KEjxuRfR5VcvifWoNo",
"media_type": "image/png",
"metadata_attributes": [
{
"name": "Attribute color",
"value": "Blue",
"tag": "<color>"
},
{
"name": "Attribute body",
"value": "Skinny",
"tag": "<body>"
},
{
"name": "Attribute eyes",
"value": "Green",
"tag": "<eyes>"
},
{
"name": "Attribute face",
"value": "Rounded",
"tag": "<face>"
},
{
"name": "Attribute accessory",
"value": "Keyboard",
"tag": "<accessory>"
}
],
"custom_attributes": {
"serial_no": "12345545",
"md5checksum": "bc527343c7ffc103111f3a694b004e2f"
},
"policy": {
"lock": true,
"lock_time": "2022-01-03T15:35:10.000Z",
"policy_id": "1373bf16cdea380e6c9c716d0f56f021b9e9ddea90b248dae6310d95",
"script": {
"type": "all",
"scripts": [
{
"type": "sig",
"keyHash": "ac1746df0ba039de81274d472a477fced610f57cebc5c7841074f54c"
},
{
"type": "before",
"slot": "46854826"
}
]
}
},
"metadata": {
"721": {
"1373bf16cdea380e6c9c716d0f56f021b9e9ddea90b248dae6310d95": {
"Tango01": {
"name": "Tango 01",
"description": "If you get all tangled up, just tango on.",
"image": "ipfs://QmP8uBgxmTpduCUbasQRCEpiq1g9KEjxuRfR5VcvifWoNo",
"mediaType": "image/png",
"color": "Blue",
"body": "Skinny",
"eyes": "Green",
"face": "Rounded",
"accessory": "Keyboard",
"collection": "Tangocrypto Collection",
"artist": "Tangocrypto",
"twitter": "https://twitter.com/tango_crypto",
"website": "https://www.tangocrypto.com",
"copyright": "Tangocrypto 2022",
"serial_no": "12345545",
"md5checksum": "bc527343c7ffc103111f3a694b004e2f"
}
},
"version": "1.0"
}
},
"created_at": "2021-11-30T23:17:36.791Z",
"updated_at": "2021-11-30T23:17:36.791Z"
}
],
"status_code": 201
}