# NFT生成

## **createnft** <a href="#createnft" id="createnft"></a>

新規NFTを生成します。

## **基本情報** <a href="#basic-info" id="basic-info"></a>

<table><thead><tr><th width="134">プロパティ</th><th width="226">詳細</th></tr></thead><tbody><tr><td>URL</td><td><code>/api/v1/createnft</code></td></tr><tr><td>Method</td><td>POST</td></tr></tbody></table>

## **リクエストパラメータ** <a href="#request" id="request"></a>

<table><thead><tr><th width="231">パラメータ</th><th width="85">種類</th><th width="78">必須</th><th width="318">詳細</th></tr></thead><tbody><tr><td>contract_address</td><td>str</td><td>yes</td><td>コレクション(コントラクト)のアドレス</td></tr><tr><td>blockchain</td><td>str</td><td>yes</td><td>生成先のブロックチェーン</td></tr><tr><td>receiver_wallet_address</td><td>str</td><td>yes</td><td>生成するNFTの所有者</td></tr><tr><td>metadata</td><td>list</td><td>yes</td><td>NFTのメタデータ(下記参照)</td></tr></tbody></table>

## **`blockchain`パラメータに指定できるブロックチェーン** <a href="#parameter" id="parameter"></a>

[対応ブロックチェーン](/jp/blockchain.md)のページのネットワークの項目の名称をご指定ください。

{% hint style="info" %}
`blockchain`パラメータで指定するブロックチェーンとコントラクト(`contract_address`)のブロックチェーンが一致する必要があります。
{% endhint %}

## **metadata** <a href="#metadata" id="metadata"></a>

NFTのメタデータを定義します。ファイルアップロードが必要な項目は、`file_fields`に指定します。

<table><thead><tr><th width="149">パラメータ</th><th width="76">種類</th><th width="73">必須</th><th width="393">詳細</th></tr></thead><tbody><tr><td>title</td><td>str</td><td>Yes</td><td>NFTのタイトル</td></tr><tr><td>description</td><td>str</td><td>Yes</td><td>NFTの説明</td></tr><tr><td>file_fields</td><td>list</td><td>Yes</td><td>ファイルアップロードが必要なメタデータの項目。KeyとUrlのペアで登録（下記参考）。</td></tr><tr><td>attribute</td><td>list</td><td>No</td><td>NFTに追加するプロパティ</td></tr></tbody></table>

{% hint style="warning" %}
メタデータに設定できる項目の数は、`title`, `description`, 各`file_fields`を合計して10個まで。
{% endhint %}

## **file\_fields** <a href="#file-fields" id="file-fields"></a>

`file_fields`は`key`, `url`のペアの配列です。

<table><thead><tr><th width="139">パラメータ</th><th width="76">種類</th><th width="75">必須</th><th width="280">詳細</th></tr></thead><tbody><tr><td>key</td><td>str</td><td>Yes</td><td>メタデータのkey</td></tr><tr><td>url</td><td>str</td><td>Yes</td><td>アップロードするファイルのURL</td></tr></tbody></table>

## attribute <a href="#attribute" id="attribute"></a>

`attribute`は`tag`,`value`のペアの配列です。

<table><thead><tr><th width="139">パラメータ</th><th width="76">種類</th><th width="75">必須</th><th width="280">詳細</th></tr></thead><tbody><tr><td>tag</td><td>str</td><td>Yes</td><td>プロパティのタグ</td></tr><tr><td>value</td><td>str</td><td>Yes</td><td>プロパティの値</td></tr></tbody></table>

{% hint style="info" %}
URLに指定したファイルがIPFSなどのストレージにアップロードされます。
{% endhint %}

## **リクエストのサンプル** <a href="#sample" id="sample"></a>

```json
{
  "contract_address": "0x0000000000000000000000000000000000000000",
  "blockchain": "polygon",
  "receiver_wallet_address": "0x1111111111111111111111111111111111111111",
  "metadata": [
    {
      "title": "NFT Name1",
      "description": "Description of NFT1",
      "file_fields": [
        {
          "key": "image",
          "url": "https://my.nftgarden.app/image.png"
        }
      ],
      "attribute": [
        {
          "tag": "color",
          "value": "Red"
        }
      ]
    },
    {
      "title": "NFT Name2",
      "description": "Description of NFT2",
      "file_fields": [
        {
          "key": "image",
          "url": "https://my.nftgarden.app/image.png"
        }
      ],
      "attribute": [
        {
          "tag": "color",
          "value": "Blue"
        }
      ]
    }
  ]
}
```

## **成功した場合のレスポンス例** <a href="#response" id="response"></a>

<pre class="language-json"><code class="lang-json">{
  "message": "Create NFT request accepted",
  "requests": {
    "contract_address": "0x0000000000000000000000000000000000000000",
    "receiver_wallet_address": "0x1111111111111111111111111111111111111111",
<strong>    "metadata": [
</strong>      {
        "title": "NFT Name1",
        "description": "Description of NFT1",
        "file_fields": [
          {
            "key": "image",
            "url": "https://my.nftgarden.app/image.png"
          }
        ],
      "attribute": [
          {
            "tag": "color",
            "value": "Red"
          }
        ]
      },
      {
        "title": "NFT Name2",
        "description": "Description of NFT2",
        "file_fields": [
          {
            "key": "image",
            "url": "https://my.nftgarden.app/image.png"
          }
        ],
        "attribute": [
          {
            "tag": "color",
            "value": "Blue"
          }
        ]
      }
    ]
  },
  "nfts": [
    {
      "nft_gdn_ids": "cf7faf94-a5ec-462c-ad06-1bd772fefe21",
      "accepted_date": "2022-07-04 04:20:18"
    },
    {
      "nft_gdn_ids": "b27752b7-9803-4d28-b29f-9532ad0f0dbb",
      "accepted_date": "2022-07-04 04:20:18"
    }
  ]
}
</code></pre>

## **失敗した場合のレスポンス例(ステータスコード400)** <a href="#error" id="error"></a>

```json
{
  "error": {
    "title": "Bad Request",
    "message": "contract_address and blockchain are inconsistent"
  }
}
```


---

# 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.nftgarden.app/jp/api/nft-api/v1.2/minting.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.
