🔡Create NFTs

Generate multiple NFTs for an existing SmartContract.

Endpoint

POST /v1/nft/generate-nft/:smartContractId

Authentication

API key is required in the headers.

Path Parameters

Request Body

The request body should be an array of objects, each containing the following parameters: Note that at least one of those fields userWallet or email should be present in the request.

Email Options Object:

NFT Metadata Object:

Attribute Object:

Example

RAW

POST /v1/nft/generate-nft/12345

Headers:
API_KEY: YOUR_API_KEY
Content-Type: application/json

Body:
[
  {
    "userWallet": "0x11112222333344445555666677778888",
    "metadata": [
      {
        "image": "<SOME_IMAGE URL>",
        "name": "First NFT",
        "description": "This is the first NFT",
        "attributes": [
          {
            "key": "Characteristic 1",
            "value": "Characteristic Value 1"
          },
          {
            "key": "Characteristic 2",
            "value": "Characteristic Value 2"
          }
        ]
      }
    ]
  },
  {
    "userWallet": "0x88887777666655554444333322221111",
    "metadata": [
      {
        "image": "<SOME_IMAGE URL>",
        "name": "Second NFT",
        "description": "This is the second NFT",
        "attributes": [
          {
            "key": "Characteristic 1",
            "value": "Characteristic Value 1"
          },
          {
            "key": "Characteristic 2",
            "value": "Characteristic Value 2"
          }
        ]
      }
    ]
  }
]

Response

  • result: Response data

    • totalToMint: Total NFTs to mint at this moment

    • addresses: NFT sending address

    • amounts: Number of NFTs to mint for each address

    • uris: IPFS urls for each NFT

    • ids: ids NFT in Backend

    • smartContractAddress: Smart Contract Address

    • blockchain: Blockchain

    • blockchainId: Decimal chain id

  • error: Error data if request fail

Status: 200 OK
{
    "result": {
        "totalToMint": 6,
        "addresses": [
            "0x11112222333344445555666677778888",
            "0x88887777666655554444333322221111"
        ],
        "amounts": [
            1,
            1
        ],
        "uris": [
            "XXXX",
            "YYYY",
        ],
        "ids": [
            0,
            1,
        ],
        "smartContractAddress": "Ox...",
        "smartContractId": "<smartContract_id>",
        "typeBlockchain": 4,
        "blockchainId": "80001",
    },
    "error": null
}

CURL

curl --location --request POST 'https://api-testnet.minteando.me/v1/nft/generate-nft/62e6cb8cece6b853fb6db8b4' \
--header 'API_KEY: <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{{
  "userWallet": "0x11112222333344445555666677778888",
  "metadata": [
    {
      "image": "https://host.io/path/image.png",
      "name": "First NFT",
      "description": "This is first NFT",
      "attributes": [
        {
          "key": "Characteristic 1",
          "value": "Characteristic Value 1"
        },
        {
          "key": "Characteristic 2",
          "value": "Characteristic Value 2"
        }
      ]
    }
  ]
},
{
  "userWallet": "0x88887777666655554444333322221111",
  "metadata": [
    {
      "image": "https://host.io/path/image.png",
      "name": "Second NFT",
      "description": "This is second NFT",
      "attributes": [
        {
          "key": "Characteristic 1",
          "value": "Characteristic Value 1"
        },
        {
          "key": "Characteristic 2",
          "value": "Characteristic Value 2"
        }
      ]
    }
  ]
}]'

Example Typescript (axios)

import axios, { AxiosResponse } from 'axios';

interface Attribute {
  key: string;
  value: string;
}

interface NFTMetadata {
  image?: string;
  name: string;
  description: string;
  attributes?: Attribute[];
}

interface NFTGenerationRequest {
  userWallet?: string;
  email?: string;
  metadata: NFTMetadata[];
}

interface GeneratedNFT {
  tokenId: string;
  userWallet: string;
}

const API_KEY = 'YOUR_API_KEY';
const smartContractId = '12345';
const endpoint = `https://api-testnet.minteando.me/v1/nft/generate-nft/${smartContractId}`;

// Set request headers
const headers = {
  API_KEY,
  'Content-Type': 'application/json',
};

// Request body
const requestBody: NFTGenerationRequest[] = [
  {
    userWallet: '0x11112222333344445555666677778888',
    metadata: [
      {
        image: '<SOME_IMAGE>',
        name: 'First NFT',
        description: 'This is the first NFT',
        attributes: [
          { key: 'Characteristic 1', value: 'Characteristic Value 1' },
          { key: 'Characteristic 2', value: 'Characteristic Value 2' },
        ],
      },
    ],
  },
  {
    userWallet: '0x88887777666655554444333322221111',
    metadata: [
      {
        image: '<SOME_IMAGE>',
        name: 'Second NFT',
        description: 'This is the second NFT',
        attributes: [
          { key: 'Characteristic 1', value: 'Characteristic Value 1' },
          { key: 'Characteristic 2', value: 'Characteristic Value 2' },
        ],
      },
    ],
  },
];

// Make the request
axios
  .post(endpoint, requestBody, { headers })
  .then((response: AxiosResponse) => {
    const responseData = response.data;
    // Process the response data
    console.log(responseData);
  })
  .catch((error) => {
    console.error('Error:', error.message);
  });

Example PHP

<?php

$apiKey = 'YOUR_API_KEY';
$smartContractId = '12345';
$endpoint = "https://api-testnet.minteando.me/v1/nft/generate-nft/{$smartContractId}";

// Request data
$requestData = [
    [
        "userWallet" => "0x11112222333344445555666677778888",
        "metadata" => [
            [
                "image" => "<SOME_IMAGE>",
                "name" => "First NFT",
                "description" => "This is the first NFT",
                "attributes" => [
                    [
                        "key" => "Characteristic 1",
                        "value" => "Characteristic Value 1"
                    ],
                    [
                        "key" => "Characteristic 2",
                        "value" => "Characteristic Value 2"
                    ]
                ]
            ]
        ]
    ],
    [
        "userWallet" => "0x88887777666655554444333322221111",
        "metadata" => [
            [
                "image" => "<SOME_IMAGE>",
                "name" => "Second NFT",
                "description" => "This is the second NFT",
                "attributes" => [
                    [
                        "key" => "Characteristic 1",
                        "value" => "Characteristic Value 1"
                    ],
                    [
                        "key" => "Characteristic 2",
                        "value" => "Characteristic Value 2"
                    ]
                ]
            ]
        ]
    ]
];

// Create request headers
$headers = [
    'API_KEY: ' . $apiKey,
    'Content-Type: application/json'
];

// Initialize cURL
$ch = curl_init();

// Set cURL options
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestData));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute the request
$response = curl_exec($ch);

// Check for errors
if (curl_errno($ch)) {
    echo 'Error: ' . curl_error($ch);
} else {
    // Process the response
    $responseData = json_decode($response, true);
    // Do something with the response data
    var_dump($responseData);
}

// Close cURL
curl_close($ch);
?>

Last updated