Tangocrypto
Search
⌃K

Exporting and importing a Policy ID

To export policy id of an existing collection use the folloing enpoint:
Curl
Node JS
curl --location --request GET 'https://cardano-mainnet.tangocrypto.com/<app-id>/v1/nft/collections/<collection-id>/policy' \
--header 'x-api-key: <x-api-key>'
var axios = require('axios');
var config = {
method: 'get',
url: 'https://cardano-mainnet.tangocrypto.com/<app-id/v1/nft/collections/<collection-id>/policy',
headers: {
'x-api-key': '<x-api-key>'
}
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Returns the script and the signing keys:
{
"lock": true,
"lock_time": "2024-04-04T00:00:00.000Z",
"policy_id": "63b3f0373d86e589f306fdd23291404d38b9017c1732b801222366aa",
"script": {
"type": "all",
"scripts": [
{
"type": "sig",
"keyHash": "6g25613f365432c25faf49554ef24503670100d7ac90eb555b421b31"
},
{
"type": "before",
"slot": 86321622
}
]
},
"signing_keys": [
"xprv1spghf62e4tccgj27dygz47z5v4gpamvp9a7aqku4rqlsxptyypf05tygqz65fjf4n7a5tsrpntuganmst3gyyzssl7jhyfhnwzredx3uajehupy07k3knt3r7mssjcgnh7h0kct5wi098hcg7pmto2mkvcpi597j"
]
}
To create a collection with the previously exported policy id:
Curl
Node JS
curl --location --request POST 'https://cardano-mainnet.tangocrypto.com/<app-id>/v1/nft/collections' \
--header 'x-api-key: <x-api-key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "My Collection 2",
"url": "https://www.mycollection.io",
"description": "Importing a policy id",
"payout_address": "addr1q9upr5kgq3ygdm0utj7lw4s2fsxdpw3vz02slar7r2fqq5whlvxpm6427qy32exjxwpgjz80cv6cwxyxqfksa6ppuxyq7vpej1",
"policy": {
"lock": true,
"lock_time": "2024-04-04T00:00:00.000Z",
"policy_id": "63b3f0373d86e589f306fdd23291404d38b9017c1732b801222366aa",
"script": {
"type": "all",
"scripts": [
{
"type": "sig",
"keyHash": "6g25613f365432c25faf49554ef24503670100d7ac90eb555b421b31"
},
{
"type": "before",
"slot": 86321622
}
]
},
"signing_keys": [
"xprv1spghf62e4tccgj27dygz47z5v4gpamvp9a7aqku4rqlsxptyypf05tygqz65fjf4n7a5tsrpntuganmst3gyyzssl7jhyfhnwzredx3uajehupy07k3knt3r7mssjcgnh7h0kct5wi098hcg7pmto2mkvcpi597j"
]
},
"metadata": {
"asset_name": "<asset_name>",
"name": "<name>",
"image": "<image_link>",
"media_type": "<mime_type>",
"description": "<description>",
"attributes": {
"website": "https://www.mycollection.io",
"twitter": "@mycollection"
},
"version": "1.0"
},
"royalty": {
"address": [
"addr1q9upr5kgq3ygdm0utj7lw4s2fsxdpw3vz02slar7r2fqq5whlvxpm6427qy",
"32exjxwpgjz80cv6cwxyxqfksa6ppuxyq7vpej1"
],
"rate": 0.05
}
}'
var axios = require('axios');
var data = JSON.stringify({
"name": "My Collection 2",
"url": "https://www.mycollection.io",
"description": "Importing a policy id",
"payout_address": "addr1q9upr5kgq3ygdm0utj7lw4s2fsxdpw3vz02slar7r2fqq5whlvxpm6427qy32exjxwpgjz80cv6cwxyxqfksa6ppuxyq7vpej1",
"policy": {
"lock": true,
"lock_time": "2024-04-04T00:00:00.000Z",
"policy_id": "63b3f0373d86e589f306fdd23291404d38b9017c1732b801222366aa",
"script": {
"type": "all",
"scripts": [
{
"type": "sig",
"keyHash": "6g25613f365432c25faf49554ef24503670100d7ac90eb555b421b31"
},
{
"type": "before",
"slot": 86321622
}
]
},
"signing_keys": [
"xprv1spghf62e4tccgj27dygz47z5v4gpamvp9a7aqku4rqlsxptyypf05tygqz65fjf4n7a5tsrpntuganmst3gyyzssl7jhyfhnwzredx3uajehupy07k3knt3r7mssjcgnh7h0kct5wi098hcg7pmto2mkvcpi597j"
]
},
"metadata": {
"asset_name": "<asset_name>",
"name": "<name>",
"image": "<image_link>",
"media_type": "<mime_type>",
"description": "<description>",
"attributes": {
"website": "https://www.mycollection.io",
"twitter": "@mycollection"
},
"version": "1.0"
},
"royalty": {
"address": [
"addr1q9upr5kgq3ygdm0utj7lw4s2fsxdpw3vz02slar7r2fqq5whlvxpm6427qy",
"32exjxwpgjz80cv6cwxyxqfksa6ppuxyq7vpej1"
],
"rate": 0.05
}
});
var config = {
method: 'post',
url: 'https://cardano-mainnet.tangocrypto.com/<app-id>/v1/nft/collections',
headers: {
'x-api-key': '<x-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);
});
It will return the newly created collection with the imported policy id:
{
"id": "01uufmjp4b2jqzb73ceeww75uy",
"name": "My Collection 2",
"url": "https://www.mycollection.io",
"description": "Importing a policy id",
"network": "mainnet",
"payout_address": "addr1q9upr5kgq3ygdm0utj7lw4s2fsxdpw3vz02slar7r2fqq5whlvxpm6427qy32exjxwpgjz80cv6cwxyxqfksa6ppuxyq7vpej1",
"token_count": 0,
"token_for_sale_count": 0,
"token_sold_count": 0,
"sales_count": 0,
"revenue": 0,
"income": 0,
"service_fee": 0,
"affiliate_commission": 0,
"nft_fee": 0,
"tx_fee": 0,
"total_fees": 0,
"policy": {
"lock": true,
"lock_time": "2024-04-04T00:00:00.000Z",
"policy_id": "63b3f0373d86e589f306fdd23291404d38b9017c1732b801222366aa",
"script": {
"type": "all",
"scripts": [
{
"type": "sig",
"keyHash": "6g25613f365432c25faf49554ef24503670100d7ac90eb555b421b31"
},
{
"type": "before",
"slot": 86321622
}
]
}
},
"metadata": {
"label": "721",
"asset_name": "<asset_name>",
"name": "<name>",
"image": "<image_link>",
"media_type": "<mime_type>",
"description": "<description>",
"attributes": {
"website": "https://www.mycollection.io",
"twitter": "@mycollection"
},
"version": "1.0"
},
"royalty": {
"price": 1996877,
"metadata": {
"777": {
"addr": [
"addr1q9upr5kgq3ygdm0utj7lw4s2fsxdpw3vz02slar7r2fqq5whlvxpm6427qy",
"32exjxwpgjz80cv6cwxyxqfksa6ppuxyq7vpej1"
],
"rate": "0.05"
}
}
},
"payment_link": "https://buy.tangocrypto.com?q=uiJjb2xsZWN0aW9uX2lkIjoiMDFnZ2ZtanA0YjJqcXpiNzNjZWV3dzc1enkiLCJ0eXBlIjoiUm95YWx0eVNhbGUiLCJpc19yYW5kb20iOmZhbHNlLCJ0Y2MiOiJxWCtwZ0lSbTRCbmJVVHZScXN4a2VyMmxBNmttQmlsTW1qQ2oxN0hSMzV1VUx3UGRyVHRpNU9jblYzZzZPdmpRSlFQR3pIVVV2b0F0R09tTW5MVVJJSENaTkJMdWhrVS9ieFdydWN6NFY1TXMzdXdkeDMxeXdSNkhVRmZWQWc9PSY4",
"created_at": "2022-10-28T15:50:11.339Z",
"updated_at": "2022-10-28T15:50:11.339Z"
}
Last modified 6mo ago