Minting Operations API
Overview
Endpoints for minting NFTs within collections. These endpoints enable you to create new tokens, batch mint, and manage minting operations.
Mint NFT
Create a new NFT within an existing collection.
POST api.bloclabs.com/v1/nfts/mint
Request
{
"collection_address": "0x789...def",
"recipient_address": "0x123...abc",
"token_uri": "ipfs://Qm...",
"metadata": {
"name": "Artwork #1",
"description": "Description of the artwork",
"image": "ipfs://Qm...",
"attributes": [
{
"trait_type": "Background",
"value": "Blue"
}
]
},
"amount": 1 // For ERC1155 tokens
}
Response
{
"status": "success",
"data": {
"token_id": "1234",
"collection_address": "0x789...def",
"owner_address": "0x123...abc",
"transaction_hash": "0xdef...456",
"token_uri": "ipfs://Qm...",
"metadata": {
"name": "Artwork #1",
"description": "Description of the artwork",
"image": "ipfs://Qm...",
"attributes": [
{
"trait_type": "Background",
"value": "Blue"
}
]
}
}
}
Batch Mint
Mint multiple NFTs in a single transaction.
POST api.bloclabs.com/v1/nfts/batch-mint
Request
{
"collection_address": "0x789...def",
"tokens": [
{
"recipient_address": "0x123...abc",
"token_uri": "ipfs://Qm...",
"metadata": {
"name": "Artwork #1",
"description": "Description of the artwork",
"image": "ipfs://Qm...",
"attributes": [
{
"trait_type": "Background",
"value": "Blue"
}
]
},
"amount": 1
}
]
}
Response
{
"status": "success",
"data": {
"transaction_hash": "0xghi...789",
"tokens": [
{
"token_id": "1234",
"collection_address": "0x789...def",
"owner_address": "0x123...abc",
"token_uri": "ipfs://Qm..."
}
],
"gas_used": "150000",
"total_minted": 1
}
}
Get Mint Status
Check the status of a minting operation.
GET api.bloclabs.com/v1/nfts/mint/{mint_id}/status
Response
{
"status": "success",
"data": {
"mint_id": "mint_xyz789",
"status": "COMPLETED", // PENDING, COMPLETED, FAILED
"transaction_hash": "0xdef...456",
"token_id": "1234",
"collection_address": "0x789...def",
"owner_address": "0x123...abc",
"created_at": "2024-03-15T10:00:00Z",
"completed_at": "2024-03-15T10:01:00Z"
}
}
Error Responses
Minting Failed
{
"status": "error",
"message": "Failed to mint NFT",
"code": "MINT_FAILED",
"data": {
"reason": "Insufficient funds for gas",
"transaction_hash": "0xdef...456"
}
}
Invalid Collection
{
"status": "error",
"message": "Invalid collection address",
"code": "INVALID_COLLECTION",
"data": {
"collection_address": "0x789...def"
}
}
Batch Limit Exceeded
{
"status": "error",
"message": "Batch size limit exceeded",
"code": "BATCH_LIMIT_EXCEEDED",
"data": {
"max_batch_size": 50,
"requested_size": 75
}
}
Notes
Minting requires gas fees
Token URIs should be permanent and immutable
Metadata should follow OpenSea metadata standards
Batch minting has a maximum limit of 50 tokens
Gas costs increase with batch size
Token IDs are assigned sequentially
Consider using IPFS for metadata storage
Last updated