Skip to main content

Collection - Metadata

Learn how to create a Myria collection.

info

Please note, in the Staging environment you can create five collections and 50,000 mint transactions per collection per month. If you want to create collections for your project in the Production environment, or you need to increase those limits, please contact our team. Be sure to include your project id in the request message.

Prerequisites

2. Create the Metadata API URL

Each collection requires a metadataApiUrl that defines the metadata schema for containing assets. The URL should return a JSON object and have a predefined structure. There are three ways to create your metadataApiUrl. The below steps show Pinata as an example.

2.1 Create a Pinata account

You can create an account through the official Pinata website.

2.2 Upload media files

After you create the account, upload your media files to Pinata. When preparing media files for your collection, consider these rules:

  1. If you have all the media files ready, upload the entire folder with your files. Pinata will generate a link containing those files for you. Note that you won't be able to add or remove items from that folder so use this option only if your collection will remain the same. Here's an example:

pinata-folder

  1. If you don't have all your media files ready or you plan to expand your collection gradually, then upload individual files to the root Pinata folder as follows:

pinata-media-files

Files or folders in Pinata are identified by a unique CID and have the following URL structure:

https://gateway.pinata.cloud/ipfs/CID

For example, https://gateway.pinata.cloud/ipfs/Qmae3dbyXos21g7oSeK3g4C7GyhSV8pxXrkWFmekgaMLPt.

2.3 Create metadata files

Next, create metadata files for all assets within a collection. Each file represents a JSON object that defines the asset's metadata schema. Those files will give a unique identifier to each of the assets, also known as Token ID. You can create files in any IDE as follows:

vs-code-metadata

Make sure to follow these rules for creating the metadata files:

  • File names should not have any extension and should have plain numbers as their names
  • All files should follow the same metadata schema
  • The name property should be unique for each file
  • The image property should point to the corresponding image on Pinata
  • The external_url property should point to the corresponding image URL of the collection's website

2.4 Upload metadata folder to Pinata

Once you have your metadata files ready, upload the entire folder to your Pinata account:

pinata-upload-metadata-1

The contents of the metadata folder should have all of the files created earlier in VS Code:

pinata-upload-metadata-2

As a result, your Pinata account will have a structure that looks as follows:

pinata-structure

2.5 Get your Metadata API URL

Finally, click the 👁 icon on your newly uploaded folder and copy the URL.

pinata-metadata-url

The copied link will be your metadataApiUrl. To verify that you set up everything correctly, open your browser at metadataApiUrl followed by a TOKEN_ID as a number. It should return a JSON object that represents the metadata of that particular asset. The example below returns metadata of the first asset in a given collection:

pinata-test

Warning

Make sure there is no trailing / at the end of the metadataApiUrl or you won't be able to mint assets.