Prerequisites
API Key with correct scope
Refer to the Create an API Key
Guide and the API
Keys page for more information.Ensure your API Key has the
nfts.create
scope enabled.Complete API Reference Introduction
Follow the API Playground
Guide to setup
authentication, create a user wallet, and mint an NFT to it using the API Playground.
Mint an NFT
If you followed the API Playground Guide in the prerequisites you already minted an NFT right here in the browser. This next section will show you how to mint an NFT using the API directly with javascript.1
Copy the javascript code below:
Save to a file on your local machine named:
mint-nft.js
.mint-nft.js
2
Edit file to include your API key:
Change the
YOUR_API_KEY
value to your API key.You should also adjust the YOUR_EMAIL_ADDRESS
value to your email address so you can login to see the NFT at https://staging.crossmint.com/user/collection when completed.3
Run the file from your terminal
id
returned as it is used in the next step to retrieve the status of the minting.4
Get mint status
Create another file in the same directory as above named Once again, ensure you replace the
get-mint-status.js
and copy the following code into it:get-mint-status.js
YOUR_API_KEY
value with your API key.5
Run the file from your terminal
6
View the NFT
Visit https://staging.crossmint.com/user/collection and login with the email address you used in the first step.You should see your NFT in the collection.You can also take the
txId
returned in the response and find your transaction on the block explorer. This example uses Polygon’s Amoy testnet. Simply enter the transaction id in the search bar and you should see your NFT transaction.Ready for More?
Explore the API reference to learn more about the NFT minting APIs. Be sure to checkout the API Playground Guide to get comfortable testing the APIs out right in your browser.Collections APIs
The first step to minting NFTs is to create a collection
Templates APIs
Templates represent the structure of your NFTs, create and edit them with APIs
Minting APIs
With your collection and template configured you can mint NFTs with APIs
Edit APIs
Fix mistakes or evolve the metadata of your NFTs with APIs