# Mint NFT

NFT  can be Minted using this method. The weightage for this API is 5.

## API Specification

## Mint NFT

<mark style="color:green;">`POST`</mark> `https://api.krypcore.com/api/v0/easy-nft/createNFT`

Create NFT under the given instance.&#x20;

#### Headers

| Name                                            | Type   | Description                      |
| ----------------------------------------------- | ------ | -------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | User Auth Key obtained from Dash |
| DappId<mark style="color:red;">\*</mark>        | String | DappId                           |

#### Request Body

| Name                                                         | Type   | Description                                          |
| ------------------------------------------------------------ | ------ | ---------------------------------------------------- |
| name<mark style="color:red;">\*</mark>                       | String | Name of the NFT                                      |
| file<mark style="color:red;">\*</mark>                       | file   | File to be used as NFT                               |
| description<mark style="color:red;">\*</mark>                | String | Description of the NFT                               |
| erc<mark style="color:red;">\*</mark>                        | String | Either ERC721 or ERC1155                             |
| quantity<mark style="color:red;">\*</mark>                   | Number | No of NFT to be minted                               |
| recepientAddress<mark style="color:red;">\*</mark>           | String | Owner of the NFT                                     |
| attributes                                                   | String | attibutes of the NFT                                 |
| walletType<mark style="color:red;">\*</mark>                 | String | Wallet type can be either Custodial or non-custodial |
| contractAddress<mark style="color:red;">\*</mark>            | String | Smart contract address in which NFT is minted        |
| chainId<mark style="color:red;">\*</mark>                    | String | Chain Id of the Blockchain Protocol                  |
| custodialWalletAccessToken<mark style="color:red;">\*</mark> | String | Wallet Access token of custodial wallet              |

{% tabs %}
{% tab title="200: OK NFT minted successfully" %}

```javascript
{
    "Data": {
        "NFTMetadata": {
            "description": "this is krypc logo",
            "image": "https://ipfs-gateway.node.krypcore.io/api/v0/ipfs/ipfs/QmbVnEgY9K1Qypb6Rqf81U8SfmoUfYNgTdsJm3JtvSTYKZ?apiKey=ac2d904a-cad4-425b-a2d7-3a4a8d2b64c6&token=34bc1382-33aa-4306-a331-db5029e8dcee",
            "name": "krypc123"
        },
        "referenceId": "d1b96b38-d0d1-4cf3-898e-62e2babfdd5c",
        "tokenURI": "https://ipfs-gateway.node.krypcore.io/api/v0/ipfs/ipfs/QmPherocXDSKLms1tz1Un6qcyyJ56TyKRkhDKjHjEHiAsP?apiKey=ac2d904a-cad4-425b-a2d7-3a4a8d2b64c6&token=34bc1382-33aa-4306-a331-db5029e8dcee",
        "txnHash": ""
    },
    "Message": "NFT got minted successfully",
    "Status": "SUCCESS"
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid ERC standard is provided" %}

```javascript
{
    "Data": null,
    "Message": "Invalid ERC Standard Passed - ERC7211",
    "Status": "Failure"
}
```

{% endtab %}

{% tab title="401: Unauthorized No Authorization key is provided in the header" %}

```javascript
{
    "message": "Missing API key found in request"
}
```

{% endtab %}

{% tab title="400: Bad Request Insufficient Balance" %}

```javascript
{ Status: 'FAILURE', Code: 400, Message: 'insufficient balance' }
```

{% endtab %}

{% tab title="500: Internal Server Error Wallet API key is not present" %}

```javascript
{
    "Data": null,
    "Message": "Custodial wallet service api token is missing",
    "Status": "FAILURE"
}
```

{% endtab %}
{% endtabs %}

Take a look at how you might call this method using our official libraries, or via `curl`:

{% tabs %}
{% tab title="curl" %}

```bash
curl --location 'https://api.krypcore.com/api/v0/easy-nft/createNFT' \
--header 'Authorization: xxxxxxxxxxxxxxxxxx' \
--header 'DappId: xxxxxxxxxxxxxxxxxx' \
--form 'file=@./Downloads/1622711604-nfts21examples.png' \
--form 'name="krypc55"' \
--form 'description="this is krypc logo"' \
--form 'recepientAddress="0x313bA6399d60ff7c2ee8bCxxxxxxxxxxxxxxxxxx"' \
--form 'attributes=""' \
--form 'quantity=""' \
--form 'erc="ERC721"' \
--form 'contractAddress="0x5D7276C99CE49e90B3eDxxxxxxxxxxxxxxxxxx"' \
--form 'chainId="80001"' \
--form 'walletType="non-custodial"' \
--form 'custodialWalletAccessToken="33e3183c-8356-xxxxxxxxxxxxxxxxxx"'
```

{% endtab %}

{% tab title="Node.js (Fetch)" %}

```javascript
var axios = require('axios');
var FormData = require('form-data');
var fs = require('fs');
var data = new FormData();
data.append('file', fs.createReadStream('/home/rajdeep/Downloads/download.png'));
data.append('name', 'krypc123');
data.append('description', 'this is krypc logo');
data.append('recepientAddress', '0x588BeE528b93357B4d731CE817C47F4BFbc81B22');
data.append('attributes', '');
data.append('quantity', '1');
data.append('erc', 'ERC721');
data.append('contractAddress', '0x06Da2002a7E29fDd0cef326BC0febd36f48962aA');
data.append('chainId', '80001');
data.append('walletType', 'non-custodial');
data.append('custodialWalletAccessToken', 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx');
 

var config = {
  method: 'post',
  url: 'https://api.krypcore.com/api/v0/easy-nft/createNFT',
  headers: { 
    'Authorization': 'xxxxxxxxxxxxxxxxxx', 
    'DappId': 'xxxxxxxxxxxxxxxxxx', 
    ...data.getHeaders()
  },
  data : data
};

 

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
```

{% endtab %}

{% tab title="Python " %}

```python
import requests

 

url = "https://api.krypcore.com/api/v0/easy-nft/createNFT"

 

payload={'name': 'krypc123',
'description': 'this is krypc logo',
'recepientAddress': '0x588BeE528b93357B4d731CE817C47F4BFbc81B22',
'attributes': '',
'quantity': '1',
'erc': 'ERC721',
'contractAddress': '0x06Da2002a7E29fDd0cef326BC0febd36f48962aA',
'chainId': '80001',
'walletType': 'non-custodial'
'custodialWalletAccessToken', 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx'
}
files=[
  ('file',('download.png',open('/home/rajdeep/Downloads/download.png','rb'),'image/png'))
]
headers = {
  'Authorization': 'xxxxxxxxxxxxxxxxxxxx',
  'DappId': 'xxxxxxxxxxxxxxxxxxxx'
}

 

response = requests.request("POST", url, headers=headers, data=payload, files=files)

 

print(response.text)
```

{% endtab %}

{% tab title="Golang" %}

```go
package main

 

import (
  "fmt"
  "bytes"
  "mime/multipart"
  "os"
  "path/filepath"
  "io"
  "net/http"
  "io/ioutil"
)

 

func main() {

 

  url := "https://api.krypcore.com/api/v0/easy-nft/createNFT"
  method := "POST"

 

  payload := &bytes.Buffer{}
  writer := multipart.NewWriter(payload)
  file, errFile1 := os.Open("/home/rajdeep/Downloads/download.png")
  defer file.Close()
  part1,
         errFile1 := writer.CreateFormFile("file",filepath.Base("/home/rajdeep/Downloads/download.png"))
  _, errFile1 = io.Copy(part1, file)
  if errFile1 != nil {
    fmt.Println(errFile1)
    return
  }
  _ = writer.WriteField("name", "krypc123")
  _ = writer.WriteField("description", "this is krypc logo")
  _ = writer.WriteField("recepientAddress", "0x588BeE528b93357B4d731CE817C47F4BFbc81B22")
  _ = writer.WriteField("attributes", "")
  _ = writer.WriteField("quantity", "1")
  _ = writer.WriteField("erc", "ERC721")
  _ = writer.WriteField("contractAddress", "0x06Da2002a7E29fDd0cef326BC0febd36f48962aA")
  _ = writer.WriteField("chainId", "80001")
  _ = writer.WriteField("walletType", "non-custodial")
  _ = writer.WriteField("custodialWalletAccessToken", "xxxxxx-xxxx-xxxx-xxxx-xxxxxx")
  err := writer.Close()
  if err != nil {
    fmt.Println(err)
    return
  }

 

 

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

 

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "xxxxxxxxxxxxxxxxx")
  req.Header.Add("DappId", "xxxxxxxxxxxxxxxxx")

 

  req.Header.Set("Content-Type", writer.FormDataContentType())
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

 

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.krypcore.com/dev-docs/api-reference/core-service-apis/nft-studio-apis/mint-nft.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
