> For the complete documentation index, see [llms.txt](https://docs.nmkr.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nmkr.io/jp/nmkr-studio-api/apino/purojekuto/fairutometadtanoappurdo.md).

# ファイルとメタデータのアップロード

以下のエンドポイントを使用すると、トークンをアップロードし、オプションでプレースホルダ値を定義したり、メタデータをオーバーライドするための完全なメタデータコードを定義したりすることができます。

{% hint style="info" %}
ペイロードにメタデータをアップロードする場合は、メタデータをエスケープする必要があることに注意してください。

[オンラインJSONエスケープ/Unescapeツール\
https://www.freeformatter.com/json-escape.html#before-output](https://www.freeformatter.com/json-escape.html#before-output)
{% endhint %}

#### エンドポイント

```
/v2/UploadNft
```

**ボディ**

トークンをアップロードするためのリクエストフィッティングのボディを定義します。アップロードに該当しないフィールドは削除してください。BASE64コンテンツ、URLリンク、またはIPFSハッシュとしてファイルをアップロードするオプションがあります。Metadataを送信した場合、プロジェクトのMetadatatemplateの代わりに使用されます。MetadataまたはMetadataPlaceholderのどちらかを送信できますが、両方を送信することはできません。

```json
{
  "tokenname": "string",
  "displayname": "string",
  "description": "string",
  "previewImageNft": {
    "mimetype": "string",
    "fileFromBase64": "string",
    "fileFromsUrl": "string",
    "fileFromIPFS": "string"
  },
  "subfiles": [
    {
      "subfile": {
        "mimetype": "string",
        "fileFromBase64": "string",
        "fileFromsUrl": "string",
        "fileFromIPFS": "string"
      },
      "description": "string",
      "metadataPlaceholder": [
        {
          "name": "string",
          "value": "string"
        }
      ]
    }
  ],
  "metadataPlaceholder": [
    {
      "name": "string",
      "value": "string"
    }
  ],
  "metadataOverride": "string",
  "priceInLovelace": 0
}
```

この例では、ボディをこのように指定しました：

```json
{
  "tokenname": "thetoken1",
  "displayname": "The Token 1",
  "description": "This is a test",
  "previewImageNft": {
    "mimetype": "image/png",
    "fileFromIPFS": "QmfA66piVcujJoSmL1fu1beJS2agvadXbzwv4hX4dnzqWY"
  },
  "subfiles": [
    {
      "subfile": {
        "mimetype": "image/png",
        "fileFromIPFS": "QmPep292dYH9CXH9AcMgbcEohXUc3P8ERbAfw7r9HM3AdY"
      }
    }
  ],
  "metadataPlaceholder": [
    {
      "name": "background",
      "value": "green"
    }
  ]
}
```

MetadataOverrideでメタデータを与える代わりに、metadataPlaceholderメソッドを使ってカスタムフィールドを定義しました。このプレースホルダ・メソッドは、カスタム・フィールドが[ メタデータ・テンプレートで](https://docs.nmkr.io/nmkr-studio/project/metadata-template)指定されている場合にのみ機能することに留意してください。

MetadataOverrideを使用したい場合は、[ こちらをお読み](https://docs.nmkr.io/nmkr-studio-api/api-examples/project/upload-file-and-metadata#using-the-metadata-override-instead-of-the-placeholder)ください。

**Curl**

```json
curl -X 'POST' \
  'https://studio-api.nmkr.io/v2/UploadNft/1420d55a-e194-4aa6-b57d-6d0f0d3b0738' \
  -H 'accept: text/plain' \
  -H 'Authorization: Bearer 1ac2cb0abea146f7bb8a90701dad311c' \
  -H 'Content-Type: application/json' \
  -d '{
  "tokenname": "thetoken1",
  "displayname": "The Token 1",
  "description": "This is a test",
  "previewImageNft": {
    "mimetype": "image/png",
    "fileFromIPFS": "QmfA66piVcujJoSmL1fu1beJS2agvadXbzwv4hX4dnzqWY"
  },
  "subfiles": [
    {
      "subfile": {
        "mimetype": "image/png",
        "fileFromIPFS": "QmPep292dYH9CXH9AcMgbcEohXUc3P8ERbAfw7r9HM3AdY"
      }
    }
  ],
  "metadataPlaceholder": [
    {
      "name": "background",
      "value": "green"
    }
  ]
}'
```

#### &#x20;応答

```json
{
  "nftId": 13174329,
  "nftUid": "8deedfd7-6aa4-45df-be6b-27efa51b8ec3",
  "ipfsHashMainnft": "QmfA66piVcujJoSmL1fu1beJS2agvadXbzwv4hX4dnzqWY",
  "ipfsHashSubfiles": [
    "QmPep292dYH9CXH9AcMgbcEohXUc3P8ERbAfw7r9HM3AdY"
  ],
  "metadata": "{\n  \"721\": {\n    \"63cb7af8c980f0867940e765f36fa53ac948d9af51179742291a553e\": {\n      \"thetoken1\": {\n        \"name\": \"The Token 1\",\n        \"image\": \"ipfs://QmfA66piVcujJoSmL1fu1beJS2agvadXbzwv4hX4dnzqWY\",\n        \"mediaType\": \"image/png\",\n        \"description\": \"This is a test\",\n        \"files\": [\n          {\n            \"name\": \"The Token 1\",\n            \"mediaType\": \"image/png\",\n            \"src\": \"ipfs://QmPep292dYH9CXH9AcMgbcEohXUc3P8ERbAfw7r9HM3AdY\"\n          }\n        ]\n      }\n    },\n    \"version\": \"1.0\"\n  }\n}",
  "assetId": "63cb7af8c980f0867940e765f36fa53ac948d9af51179742291a553e746865746f6b656e31"
}
```

**プレースホルダーの代わりにメタデータ・オーバーライドを使う**

完全な721メタデータJSONを提出したい場合、リクエストボディのMetadataPlaceholderフィールドを削除し、Metadata overrideフィールドを使用しなければならないことに留意してください。

```json
  "metadataOverride": "string",
```

プレースホルダ・メソッドを使用する場合と同じように Curl を送信し続け、エスケープされたメタデータをフィールドに追加します：

```json
  "metadataOverride": "{\r\n  \"721\": {\r\n    \"63cb7af8c980f0867940e765f36fa53ac948d9af51179742291a553e\": {\r\n      \"thetoken1\": {\r\n        \"name\": \"The Token 1\",\r\n        \"image\": \"ipfs:\/\/QmfA66piVcujJoSmL1fu1beJS2agvadXbzwv4hX4dnzqWY\",\r\n        \"mediaType\": \"image\/png\",\r\n        \"background\": \"green\",\r\n        \"description\": \"This is a test\",\r\n        \"files\": [\r\n          {\r\n            \"name\": \"The Token 1\",\r\n            \"mediaType\": \"image\/png\",\r\n            \"src\": \"ipfs:\/\/QmPep292dYH9CXH9AcMgbcEohXUc3P8ERbAfw7r9HM3AdY\"\r\n          }\r\n        ]\r\n      }\r\n    },\r\n    \"version\": \"1.0\"\r\n  }\r\n}",
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.nmkr.io/jp/nmkr-studio-api/apino/purojekuto/fairutometadtanoappurdo.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
