In this quickstart you will learn how to create an NFT and deliver it to a wallet or email address.

Integration steps

1. Create a Developer Account

To get started, create a developer account in the Crossmint Staging Console. Open that link, sign in, and accept the dialog to continue.

Crossmint offers two consoles: staging, for development and testing, and www, for production. This quickstart uses staging, and contains instructions at the end for switching to production.

2. Get an API Key

Once you log in to the console, the next step is to create an .

Go to the API Keys tab, “Server-side keys”, and click on “New API Key”. Then, check the scopes nfts.create and nfts.read under the “Minting API” category and create your key. Save this key for the next step.

3. Mint an NFT

We’re almost there! With our key created, we’re now going to write a small function that creates an NFT and delivers it to a user.

Create a file (e.g. mintNFT.js) and enter this code into it:

mintNFT.js
const apiKey = "<YOUR_API_KEY>";
const chain = "solana"; // or "polygon-amoy", "ethereum-sepolia", ...
const env = "staging"; // or "www"
const recipientEmail = "<TEST_EMAIL_ADDRESS>";
const recipientAddress = `email:${recipientEmail}:${chain}`;

const url = `https://${env}.crossmint.com/api/2022-06-09/collections/default/nfts`;
const options = {
    method: "POST",
    headers: {
        accept: "application/json",
        "content-type": "application/json",
        "x-api-key": apiKey,
    },
    body: JSON.stringify({
        recipient: recipientAddress,
        metadata: {
            name: "Crossmint Test NFT",
            image: "https://picsum.photos/400",
            description: "My first NFT using Crossmint",
        },
    }),
};

fetch(url, options)
    .then((res) => res.json())
    .then((json) => console.log(json))
    .catch((err) => console.error("error:" + err));

This code creates an NFT, uploads it to the blockchain, and delivers it to a

, attached to the email address provided. Before running it, be sure to fill in values for:

  • YOUR_API_KEY with the key obtained in the prior step.
  • TEST_EMAIL_ADDRESS with a wallet address you control, for testing.

Now, run the mintNFT.js script.

node mintNFT.js

After a few seconds, it should return a response indicating the mint has started processing. Check the full response and save its , as you’ll use it later.

More info

4. Confirm Delivery of the NFT

The mint has started processing. However, blockchains can take a few seconds (or, at times of extreme network congestion, even minutes) to confirm the operation.

Before showing the user a success screen, the next step is checking the status of the mint.

To do this, grab the actionId received at the end of step 3 and use it alongside your API key in one of the snippets below.

# Replace "staging" with "www" for production, and fill in your api key and mint action id
ENV="staging" 
API_KEY="<YOUR_API_KEY>" 
MINT_ACTION_ID="<MINT_ACTION_ID>"
curl --header "x-api-key: $API_KEY" \
  -X GET \
  https://${ENV}.crossmint.com/api/2022-06-09/actions/${MINT_ACTION_ID}

Pay attention to the “status” field. Once it says “success”:

Congratulations. You have minted your first NFT 🥷 🎉

For scalable production applications, consider using webhooks to determine when your NFT has been minted, instead of periodically polling for its status via the API.

Crossmint will not send an email to the user to notify them an NFT has been airdropped. You must implement this behavior yourself, if desired.

5. View your NFTs

  1. If the NFTs were delivered to an , the recipient can see them by:

  2. If the NFTs were delivered to a wallet address, the user will be able to see them there directly, connecting to testnet if needed, or on the testnet blockchain explorer.

And voilá, there’s your NFT! Now think of all the cool things you can build with this, at scale :)


Launching in Production

For production, the steps are almost identical, but some changes are required:

  1. Create a developer account on the production console.
  2. Add credits to your account from Billing & Usage.
  3. Then, create a production key on the API Keys page with the same API scopes.
  4. Modify all code snippets with const env = "www", so they use the production APIs. You may also need to change the chain variable to match your production blockchain.
  5. Check the guide with best practices

Learn More

Dive into Advanced Topics