Creating NFTs

To create NFT content in a no-code manner, use the Niftory Admin Portal -- the same place you got your API keys from. Follow this guide for reference.

To create NFT content using the API, follow the steps below:

Create NFTSet

If not already done so, create an NFTSet using the createNFTSet API.

Try it out in Postman

mutation CreateSet($data: NFTSetCreateInput!) {
    createNFTSet(data: $data) {
        id
        title
        attributes
    }
}

Example args:

{
    "data": {
        "title": "My Set",
        "attributes": {
            "properties": {
                "that": "are private to your app",
                "and": "don't get added to the blockchain"
            }
        }
    }
}

Upload NFTContent

There are two ways to upload content for your NFT. In both cases, Niftory provides you with pre-signed URLs to upload NFT content to.

Once you upload content to the pre-signed URL, by default Niftory automatically schedules upload to IPFS asynchronously.

Try it out in Postman

This API creates an NFTContent object in the database, and sets the URL's to pre-signed URLs that you can upload a file and a corresponding poster to.

mutation UploadNFTContent($name: String!, $description: String) {
    uploadNFTContent(name: $name, description: $description) {
        id
        files {
            id
            state
            name
            url
        }
        poster {
            id
            state
            url
        }
    }
}
{
    "name": "Test file",
    "description": "This is a test file"
}

Try it out in Postman

This gives a bit more control on what to upload. For e.g, if you just want to upload a file, but no corresponding poster, then this API is a good way to do that.

You can also use this to just upload files without scheduling an IPFS upload. That can be achieved as follows:

mutation CreateFileUploadUrl($name: String!, $description: String, $options: CreateFileOptionsInput!) {
    createFileUploadUrl(name: $name, description: $description, options: $options) {
        id
        name
        url
        state
    }
}
{
    "name": "Test file",
    "description": "This is a test file",
    "options": {
        "uploadToIPFS": false
    }
}

You can upload the files asynchronously. That is, you can continue on to create an NFTModel before actually uploading the file.

Create NFTModel

Try it out in Postman

Finally, use the id of the NFTSet you created, as well as the id of the NFTContent to create an NFTModel:

mutation CreateModel($setId: ID!, $data: NFTModelCreateInput!) {
    createNFTModel(setId: $setId, data: $data) {
        id
        quantity
        title
        attributes
    }
}
{
    "setId": "f29f68ac-43a2-46da-b56b-01e3423719f5",
    "data": {
        "title": "My NFTModel",
        "description": "My NFT template",
        "quantity": 5,
        "contentId": "be040196-421c-48a8-8749-44edc7a92cdd",
        "metadata": {
            "this": "ends up on the blockchain"
        },
        "attributes": {
            "properties": {
                "that": "are private to your app",
                "and": "don't get added to the blockchain"
            }
        }
    }
}

And voila, you have your NFTModel!

Last updated