Create a collection of assets under the same policy.

POST https://bakrypt.io/v1/assets/ || https://testnet.bakrypt.io/v1/assets/;

To create a collection of assets, you need to send a request to the Assets API that includes a list of assets. In response, you'll get a list of assets that are linked by a collection instance as a foreign key. All of the assets in the list will be minted in a single transaction, and they'll all be under the same policy.

The first asset in the list is considered the primary asset, and it will determine the minting methodology for the entire collection. As a result, the primary asset sets the rules for royalties, names, and automatic processing of the transaction. In short, the primary asset is the one that rules them all.

List[asset] -> List[asset]: Collection

Request

e.g.,

/* Vanilla Javascript example using fetch */
let accessToken = "<access_token>";
(async () => {
  let auth_url =
    `https://bakrypt.io/v1/assets/` || `https://testnet.bakrypt.io/v1/assets/`;
  const createCollectiontRequest = await fetch(auth_url, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      Authorization: `Bearer ${accessToken}`,
    },
    body: JSON.stringify([{
            blockchain: "ada",
            amount: 1,
            name: "Test Name I 1",
            asset_name: "Only4cceptsLetters4ndNumb3rsI",
            image: "ipfs://QmbZxCkD1bniE21CPudEwRP6HVJfiSopL6DJPK8QrWiSjn",
            is_auto: true,
            royalties_rate: 3,
            royalties: "addr_test1qzr84dy9syhkdy3ffn8c3mn8n2zh0wzhgwltz2dle5phaaky56y0ulyxyrz2mra05y8xsnxcgphrleag8mxs0llszrkjah"
        },        {
            blockchain: "ada",
            amount: 1,
            name: "Test Name II 2",
            asset_name: "Only4cceptsLetters4ndNumb3rsII",
            image: "ipfs://QmbZxCkD1bniE21CPudEwRP6HVJfiSopL6DJPK8QrWiSjn",
        },        {
            blockchain: "ada",
            amount: 1000,
            name: "Test Name III 3",
            asset_name: "Only4cceptsLetters4ndNumb3rsIII",
            image: "ipfs://QmbZxCkD1bniE21CPudEwRP6HVJfiSopL6DJPK8QrWiSjn",
        }])
  });
    
  const collectionResponse = await createCollectionRequest.json()
  
  console.log(collectionResponse);
})();

Response

application/json

[
  {
    "uuid": "69527681-38a2-42a8-918d-449e61f4c1a7",
    "status": "preauth",
    "blockchain": "ADA",
    "amount": 1,
    "image": "ipfs://QmbZxCkD1bniE21CPudEwRP6HVJfiSopL6DJPK8QrWiSjn",
    "mediaType": null,
    "name": "Test Name I 1",
    "asset_name": "Only4cceptsLetters4ndNumb3rsI",
    "description": null,
    "size": "126",
    "collection": "7c4dcc1b-73db-4e74-90c8-a0e2b23a0bb1",
    "files": [],
    "attrs": {},
    "is_deleted": false,
    "created_on": "2022-04-30 16:12:13.969758+00:00",
    "updated_on": "2022-04-30 16:12:13.969778+00:00",
    "is_auto": true,
    "has_royalties": true,
    "royalties": "addr_test1qzr84dy9syhkdy3ffn8c3mn8n2zh0wzhgwltz2dle5phaaky56y0ulyxyrz2mra05y8xsnxcgphrleag8mxs0llszrkjah",
    "royalties_rate": "3.00",
    "royalties_minted": false,
    "royalties_minted_on": null,
    "royalties_burned": false,
    "royalties_burned_on": null,
    "transaction": "20baaf19-7cd6-4723-95c6-b1f554a27bbb"
  },
  {
    "uuid": "08f125cf-3544-4b9c-8a15-a330042f284b",
    "status": "preauth",
    "blockchain": "ADA",
    "amount": 1,
    "image": "ipfs://QmbZxCkD1bniE21CPudEwRP6HVJfiSopL6DJPK8QrWiSjn",
    "mediaType": null,
    "name": "Test Name II 2",
    "asset_name": "Only4cceptsLetters4ndNumb3rsII",
    "description": null,
    "size": "128",
    "collection": "7c4dcc1b-73db-4e74-90c8-a0e2b23a0bb1",
    "files": [],
    "attrs": {},
    "is_deleted": false,
    "created_on": "2022-04-30 16:12:13.969835+00:00",
    "updated_on": "2022-04-30 16:12:13.969839+00:00",
    "is_auto": true,
    "has_royalties": false,
    "royalties": "",
    "royalties_rate": "0.00",
    "royalties_minted": false,
    "royalties_minted_on": null,
    "royalties_burned": false,
    "royalties_burned_on": null,
    "transaction": "20baaf19-7cd6-4723-95c6-b1f554a27bbb"
  },
  {
    "uuid": "538ca642-0061-4b30-9b23-6c1cfc366e13",
    "status": "preauth",
    "blockchain": "ADA",
    "amount": 1000,
    "image": "ipfs://QmbZxCkD1bniE21CPudEwRP6HVJfiSopL6DJPK8QrWiSjn",
    "mediaType": null,
    "name": "Test Name III 3",
    "asset_name": "Only4cceptsLetters4ndNumb3rsIII",
    "description": null,
    "size": "130",
    "collection": "7c4dcc1b-73db-4e74-90c8-a0e2b23a0bb1",
    "files": [],
    "attrs": {},
    "is_deleted": false,
    "created_on": "2022-04-30 16:12:13.969883+00:00",
    "updated_on": "2022-04-30 16:12:13.969887+00:00",
    "is_auto": true,
    "has_royalties": false,
    "royalties": "",
    "royalties_rate": "0.00",
    "royalties_minted": false,
    "royalties_minted_on": null,
    "royalties_burned": false,
    "royalties_burned_on": null,
    "transaction": "20baaf19-7cd6-4723-95c6-b1f554a27bbb"
  }
]