End-to-end Example

Programmatically minting an Ethereum ERC1155 NFT

1. Get your API keys

Create a 3mint account and find your API key on the Settings page.

Your API requests are authenticated using API keys. Any request that doesn't include an API key will return an error.

The key received should remain secret, which means it should only be accessed on the back end. Authorization to the API is performed via the X-API-KEY header.

2. Deploy a contract

The building block of any NFT is the contract that you first need to deploy to a blockchain. Think of this contract as public way to show who owns which NFT (i.e., it's a simple table that has the user’s wallet address in the left column and the NFT the user owns in the right column).

To deploy a contract, go to the Contracts page and click the "Create contract" button. From there, you need to choose the type of contract you want to deploy (A), input details regarding the contract you are deploying (B), and since we are launching an NFT, we'll also choose where our NFT data should be stored (C).

A. Choose "One or More Copies"

B. Input Collection Data

C. Choose Decentralized blockchain as you Data Location

Once everything you've chosen looks good, press "Deploy" at the bottom of the screen and the contract will be deployed to your blockchain and network of choice. No wallet, crypto, or private key needed! After a few seconds, you'll be directed back to the main page and you should see your contract included in the table.

3. Upload NFT Data

Now it's time to upload the digital content and metadata your NFTs will use when minted (i.e., created and sent to someone's wallet). To do this, click on the "info" button on the right-hand side of the contract row.

From there, you'll be taken to a page that shows you all the NFT data you have prepared (none so far, but we'll change that in a second!). Click on "Single Upload" and fill in your NFT details.

Once uploaded, this data will live on a decentralized blockchain forever, ensuring your holders truly own this data. If you want to upload more than 1 NFT at a time, just use the "Batch Upload" button instead.

Just like that, you now have a contract deployed and the NFT data needed to start sending your NFTs programmatically.

4. Mint with Code

Minting can be done directly through your codebase. If you have a POS system, you can deliver these NFTs for certain purchases that your customers make.

Every API request must include Content-Type and X-API-KEY headers.

curl -X POST https://api.3mint.io/api/v1/mint   
   -H "Content-Type: application/json"
   -H "X-API-KEY: [YOUR_API_KEY]"
   -d '{"to": ["[WALLET_OF_USER]"],
       "chain": "ethereum",
       "network": "mainnet",
       "type":"erc1155",
       "contractAddress": "[CONTRACT_ADDRESS]",
       "quantity": 1
       }'

Last updated