Quickstart

Create, upload and deliver an NFT to an email address in under 5 minutes ⏱️

In this quickstart, we will be minting an NFT from scratch, delivering it to an email address and visualizing it. All under 5 minutes.

1️⃣ Create a Crossmint developer account

To get started, the first thing you'll need to do is to register as a developer in the Crossmint developer console.

There are two consoles in Crossmint: one for production, at www.crossmint.com/console and one for testing and development, at staging.crossmint.com/console

In this guide we'll be developing a test integration, therefore we will use staging.crossmint.com/console. Open that link, sign in, and accept the dialog to continue.

2️⃣ Enable the NFT Minting API in the Crossmint console

Once you land on the dashboard, the next step is to create an API key: a secret credential that allows you to make calls against the minting API.

To do so, go to the "API Keys" page, and click on "New API Key". Then, on the dialog that opens, mark the checkbox for the scopes nfts.create, nfts.read, and then save it.

Finally, from back at the API Keys page, copy your Project ID and Client Secret. We will need them in the next step.

2372

screenshot from https://staging.crossmint.com/console/projects/apiKeys

3️⃣ Create and send your first NFT

We're almost there! Open your terminal and copy the following code:

CLIENT_SECRET=<fill_me>
PROJECT_ID=<fill_me>
MY_TEST_EMAIL=<fill_me>

curl --header "x-client-secret: $CLIENT_SECRET" \
  --header "x-project-id: $PROJECT_ID" \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
  	"metadata": {
      "name": "Crossmint Mint API Test",
      "image": "https://www.crossmint.com/assets/crossmint/logo.png",
      "description": "Test NFT created using the Crossmint Minting API"
     },
     "recipient": "email:'"$MY_TEST_EMAIL"':polygon"
    }' \
https://staging.crossmint.com/api/2022-06-09/collections/default-polygon/nfts
const fetch = require('node-fetch');

const CLIENT_SECRET = '<fill_me>';
const PROJECT_ID = '<fill_me>';
const MY_TEST_EMAIL = '<fill_me>';

const url = 'https://staging.crossmint.com/api/2022-06-09/collections/default-polygon/nfts';

const headers = {
  'Content-Type': 'application/json',
  'x-client-secret': CLIENT_SECRET,
  'x-project-id': PROJECT_ID
};

const data = JSON.stringify({
  metadata: {
    name: 'Crossmint Mint API Test',
    image: 'https://www.crossmint.com/assets/crossmint/logo.png',
    description: 'Test NFT created using the Crossmint Minting API'
  },
  recipient: `email:${MY_TEST_EMAIL}:polygon`
});

fetch(url, {
  method: 'POST',
  headers,
  body: data
})
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
import requests
import json

CLIENT_SECRET = '<fill_me>'
PROJECT_ID = '<fill_me>'
MY_TEST_EMAIL = '<fill_me>'

url = 'https://staging.crossmint.com/api/2022-06-09/collections/default-polygon/nfts'

headers = {
    'Content-Type': 'application/json',
    'x-client-secret': CLIENT_SECRET,
    'x-project-id': PROJECT_ID
}

data = {
    "metadata": {
        "name": "Crossmint Mint API Test",
        "image": "https://www.crossmint.com/assets/crossmint/logo.png",
        "description": "Test NFT created using the Crossmint Minting API"
    },
    "recipient": "email:" + MY_TEST_EMAIL + ":polygon"
}

response = requests.post(url, headers=headers, data=json.dumps(data))

if response.status_code == 200:
    result = response.json()
    print(result)
else:
    print("Error:", response.status_code)

Before pressing Enter, fill in:

  • CLIENT_SECRET and PROJECT_ID with the values obtained in the prior step
  • MY_TEST_EMAIL with an email address you own

What this API call does is:

  1. It ensures there's a smart contract deployed for your NFT
  2. It uploads your metadata into a file in IPFS (decentralized storage)
  3. It mints an NFT on a blockchain of your choice
  4. It creates a crypto wallet for the email you specify, if one didn't yet exist
  5. It sends the NFT to that wallet

With this in mind, you can now press Enter and run the command. After a few seconds, it should return an object containing an identifier for your NFT amongst other information. Save it for the next step.

📘

Want to send an NFT directly to a Solana or Polygon address?

Check out the recipients documentation for information on how to do so.

4️⃣ Confirm delivery of the NFT

NFTs may take a few seconds (on occasions, up to minutes) to get "minted" in the blockchain. For this reason, it is good practice to check if the NFT has been delivered before you update your UI or notify your users.

To do this, we will grab the id you will have received at the end of step 2, put it into NFT_ID (without the double quotes), and then run the following command:

CLIENT_SECRET=<fill_me>
PROJECT_ID=<fill_me>
NFT_ID=<fill_me>

curl --header "x-client-secret: $CLIENT_SECRET" \
  --header "x-project-id: $PROJECT_ID" \
  -X GET \
  https://staging.crossmint.com/api/2022-06-09/collections/default-polygon/nfts/$NFT_ID
const fetch = require('node-fetch');

const CLIENT_SECRET = '<fill_me>';
const PROJECT_ID = '<fill_me>';
const NFT_ID = '<fill_me>';

const url = `https://staging.crossmint.com/api/2022-06-09/collections/default-polygon/nfts/${NFT_ID}`;

const headers = {
  'x-client-secret': CLIENT_SECRET,
  'x-project-id': PROJECT_ID
};

fetch(url, {
  method: 'GET',
  headers
})
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
import requests

CLIENT_SECRET = '<fill_me>'
PROJECT_ID = '<fill_me>'
NFT_ID = '<fill_me>'

url = "https://staging.crossmint.com/api/2022-06-09/collections/default-polygon/nfts/" + NFT_ID

headers = {
    'x-client-secret': CLIENT_SECRET,
    'x-project-id': PROJECT_ID
}

response = requests.get(url, headers=headers)

if response.status_code == 200:
    result = response.json()
    print(result)
else:
    print("Error:", response.status_code)

If all went well, you should see an object with information about the NFT recipient, and amongst other things, it will contain the field onChain":{"status":"success" ..., which indicates the NFT got minted adequately. If this field is false, then wait a few seconds, and try again.

Congratulations! You have now minted your first NFT on the Polygon testnet 🚀🚀🚀

📘

Webhooks

For production applications, we recommend the usage of webhooks to determine when your NFT has been minted, as opposed to periodically polling for its status via the API.

5️⃣ Viewing your NFT

Now that our NFT has been delivered, all that's left is to admire it in all it's glory 😎

Go to the test version of the Crossmint wallet by navigating to staging.crossmint.com. From there, click on My Wallet on the top right, and sign in with the email you used as recipient.

And voilá, your NFT should be there! Congratulations on using the Crossmint minting API 🥳

🚧

Got stuck?

Don't fret, you can join our discord and get help from the community and our team members

Where to go from here

Check out the many other features that the Mint API has to offer, including:

  • Setting the metadata of your NFT to contain your own images, videos and other metadata
  • Creating different collections so not all your NFTs show in the same one in marketplaces like OpenSea
  • Deliver to email addresses, or existing web3 wallet addresses

Finally, learn all the possibilities by diving into the API Reference, and get inspiration by checking out our example projects!

🚧

Trying to mint in Production (Mainnet)?

To mint, you'll need to add credits to your production developer account first. After creating a developer account on production, please visit our self-service Billing & Usage to add a billing method and top up your account with credits. Then, create a production API key on our production API Keys page.