Crossmint
Search…
Code samples
Questions? Contact us at www.crossmint.io/support

Mint an NFT

curl
JavaScript
curl --location --request POST
'https://www.crossmint.io/api/2022-06-09/collections/{collectionName}/nfts' \
--header 'x-client-secret: <API SECRET>' \
--header 'x-project-id: <PROJECT ID>' \
--header 'Content-Type: application/json' \
--data-raw '{
"metadata": {
"name": "Crossmint Mint API Test",
"image": "https://www.crossmint.io/assets/crossmint/logo.png",
"description": "Test NFT created by the Crossmint Minting API"
},
"recipient": "poly:0x12618f45ff6e841470bf71f428aae41ee5bc3c39"
}'
const reqHeader = new Headers();
reqHeader.append("x-client-secret", "<API SECRET>");
reqHeader.append("x-project-id", "<PROJECT ID>");
reqHeader.append("Content-Type", "application/json");
​
const collectionName = "default" // change if you've created a collection
const recipient = "poly:0x12618f45ff6e841470bf71f428aae41ee5bc3c39"
// Or with just an email:
// const recipient = "email:[email protected]:poly"
​
const reqBody = JSON.stringify({
"mainnet": false,
"metadata": {
"name": "Crossmint Mint API Test",
"image": "https://www.crossmint.io/assets/crossmint/logo.png",
"description": "Test NFT created by the Crossmint Minting API"
},
"recipient": recipient
});
​
var requestOptions = {
method: 'POST',
headers: reqHeader,
body: reqBody,
redirect: 'follow'
};
​
fetch(`https://www.crossmint.io/api/2022-06-09/collections/${collectionName}/nfts`, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Check the minting status

Minting an NFT may take a few seconds. You can check its status based on a request ID obtained during minting.
curl
JavaScript
curl --location --request GET 'https://www.crossmint.io/api/2022-06-09/collections/{collectionName}/nfts/{id}\
--header 'x-client-secret: <API SECRET>' \
--header 'x-project-id: <PROJECT ID>'
const reqHeader = new Headers();
reqHeader.append("x-client-secret", "<API SECRET>");
reqHeader.append("x-project-id", "<PROJECT ID>");
​
const collectionName = "default" // change if you've created a collection
const id = "" // id returned in response from previous mint step
​
const requestOptions = {
method: 'GET',
headers: reqHeader,
redirect: 'follow'
};
​
fetch(`https://www.crossmint.io/api/2022-06-09/collections/${collectionName}/nfts/${id}`, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
​
Copy link
Outline
Mint an NFT
Check the minting status