NFT Minting and Delivery

NFT Minting and Delivery

⁠This feature requires an enterprise agreement

Contact Sales

With Magic’s NFT Minting and Delivery API, you can easily mint and airdrop NFTs on-demand via a single API call. Our service handles NFT minting at scale, and takes care of all end-user gas fees.

#Benefits

  1. Scalable: Our patented aggregator contract and scalable infrastructure allow us to efficiently bundle multiple transactions together, making it possible to handle large user loads with ease
  2. Gasless: It's not necessary for either customers or end users to have any crypto in order to get a NFT and use this service. Magic automatically handles all gas fees required for minting and is designed for efficient and cost-effective high throughput.

#Use Cases

Airdrops: Easily let your users claim, mint or directly receive free NFTs, like on our home page demo.

Delivery for fiat NFT purchases: Our minter tool can be easily integrated with any payment provider you prefer. It allows you to collect payments off-chain in fiat and securely deliver the NFT once the payment is confirmed.

If you would like a fully managed NFT Checkout solution using our payment provider partnerships, take a look at this guide.

#Usage

Prerequisites

To use the Minting and Delivery API, you will need a smart contract deployed on-chain and registered with Magic. You can check out Smart Contracts for more information, but your Magic Customer Success representative should provide you with a contract ID to identify the contract on Magic's API.

Create a Magic App

To get started with NFT Minting and Delivery, you must first sign in or sign up and create a application (Magic Connect or Magic Auth) through Magic's dashboard. Once you’ve submitted the information above and Magic has configured your contract, you are ready to start minting!

Look for your secret key from your app and save this to use in your API calls. (you can find on the homepage of any app on your dashboard as shown in the image below).

#Endpoints

Depending on your contract type you can hit one of two endpoints:

Javascript Example

Replace <sk_live_xxxxxxx> with your secret key and contract_id with the one provided by your Magic Customer Success representative.

#Minting

ERC721

Web
Curl
01const magic_resp = await fetch("<https://nft-api.magic.link/v1/nft/721/start_mint>", {
02  method: "POST",
03  headers: {
04    "Content-Type": "application/json",
05    "X-Magic-Secret-Key": <sk_live_xxxxxxx>,
06  },
07  body: JSON.stringify({
08    contract_id: <contract_id>,
09    quantity: int,
10    destination_address: str,
11  })
12})
13
14const magic_json = await magic_resp.json()
15const request_id = magic_json.data['request_id']

ERC1155

Web
Curl
01const magic_resp = await fetch("<https://nft-api.magic.link/v1/nft/1155/start_mint>", {
02  method: "POST",
03  headers: {
04    "Content-Type": "application/json",
05    "X-Magic-Secret-Key": <sk_live_xxxxxxx>,
06  },
07  body: JSON.stringify({
08    contract_id: <contract_id>,
09    token_id: int,
10    quantity: int,
11    destination_address: str,
12  })
13})
14
15const magic_json = await magic_resp.json()
16const request_id = magic_json.data['request_id']

Once the NFT Minting Request has been submitted, these requests will return. However, it may take a few minutes to process them. When a minting request succeeds or fails, Magic will call the webhook that you provided during setup.

#Next Steps

Once your minting request has been accepted, you can set up Webhooks to receive events in real-time.

In specific cases we offer an endpoint to poll our backend for the status of minting requests -- reach out to your Magic Customer Success representative for more information.