Niftory Docs
  • What is Niftory?
  • Get your API Keys
  • 👩‍💻API
    • Niftory Web3 API
    • SDK QuickStart
      • Using the SDK in React
      • Using the SDK from the Server
    • API Quickstart
      • Create your first Wallet
      • API calls with Sample Content
      • Mint your first NFT
    • API Cheat Sheet
    • Niftory Sample App
      • Explore the Sample App
      • Anatomy of a Niftory App
        • Getting Authenticated
        • GraphQL Client Setup
        • API Usage
        • Transfer an NFT
    • 💡Core Concepts
      • Niftory Data Model
      • Authentication
        • Using Your API Key
        • Configuring Your App
        • Privileged Authentication
      • App and AppUser
      • NFTs
        • Creating NFTs
        • Querying NFTs
        • Transferring NFTs
        • Minting NFTs
      • Wallets
        • Create a Niftory Wallet
        • Register External Wallets
        • Query Wallets
      • Contract
      • User Auth (Client-Side)
    • Your Niftory Account
  • 🧑‍💼Admin Portal
    • Niftory Admin Portal
    • 🚀Guides
      • Setting Up Your Org
      • Create Your First NFT
    • 🗺️Explore
      • Org and Apps
      • NFT Collection
        • Sets
        • Collectibles
        • NFTs
    • 💼Use Cases
      • For Engineers
      • For Designers
      • For Business Users
  • 📖Reference
    • GraphQL & Auth Endpoints
    • API Reference
    • SDK API Reference
Powered by GitBook
On this page
  • Option 1 - Design in Admin Portal, mint using API
  • Design your NFT
  • Query
  • Mint
  • Option 2 - Create everything with API
  • Bonus - Transfer NFT to your Wallet

Was this helpful?

  1. API
  2. API Quickstart

Mint your first NFT

PreviousAPI calls with Sample ContentNextAPI Cheat Sheet

Last updated 1 year ago

Was this helpful?

Go through before starting this section.

There are a couple of ways you can design and mint an NFT.

Option 1 - Design in Admin Portal, mint using API

Design your NFT

  1. Log into the , and open Collectibles

  2. Create a Set

  3. Create a Collectible inside the Set.

    • Specify the total supply of the Collectible (i.e. how many NFTs of this shape can be created) as quantity

    • Upload media content, which automatically gets uploaded to the InterPlanetary File System (IPFS).

    • Add any custom metadata you would like to be part of your NFT.

Follow for more information on navigating the Admin Portal.

Query

Let's query what we just created. At this point it's just a blueprint of what an NFT would look like when minted; it doesn't exist on the blockchain yet. This "NFT blueprint" is called an NFTModel in the API.

The following query returns a paginated list of all the NFTModels you've created for your app so far. Since we just created one, we should get a single item back.

query NFTModels($appId: ID) {
  nftModels(appId: $appId, maxResults: 1) {
    items {
      id
      title
      quantity
      status
      set {
        id
      }
      content {
        files {
          url
          contentType
        }
        poster {
          url
        }
      }
    }
    cursor
  }
}

For appId, pass in your app's client ID (available from the Your App page in Admin Portal).

You can find other ways of querying for NFTs belonging to an app, a user or a wallet in the following guide:

Mint

It's time to mint! Take the id of the NFTModelreturned by the query above, and execute the following mutation:

mutation Mint(
  $id: ID!,
  $quantity: PositiveInt
) {
  mintNFTModel(id: $id, quantity: $quantity) {
    id
    blockchainId
    metadata
    state
  }
}

This kicks off minting asynchronously, which can be tracked by checking the value of state on NFTModel.

Now you can query NFTModel to see when minting is completed.

query NFTModel($id: ID!) {
  nftModel(id: $id) {
    id
    state
    nfts {
      id
      blockchainState
      blockchainId
      serialNumber
      metadata
    }
  }
}

Congratulations on making it this far! Don't worry if some of this still doesn't make sense. The next sections will go over the API in more detail. You already have enough context to start adding NFTs to your application.

Option 2 - Create everything with API

This section details how to create an NFT entirely using the API - uploading files, setting metadata, and minting:

Bonus - Transfer NFT to your Wallet

mutation Transfer($address: String, $nftModelId: ID) {
  transfer(address: $address, nftModelId: $nftModelId) {
    id
    blockchainState
    saleState
    serialNumber
    blockchainId
    model {
      id
      title
    }
  }
}

Pass in the address of your Wallet, and the ID of the NFTModel from the previous section.

This API showcases the benefits of the web2 + web3 approach of the Niftory API: while minting and transfer can be time-consuming operations on the blockchain, you get an NFT object back instantly, whose state gets updated asynchronously. This allows you as an app developer to build very responsive web3 apps with eventual consistency with the blockchain.

If you created a wallet in the , you can use the transfer API to mint and transfer an NFT to your wallet in one go!

👩‍💻
API Quickstart
Admin Portal
this guide
Querying NFTs
Creating NFTs
previous guide