Upload File and Metadata

Upload a file to your project

With the following endpoint, you are able to upload a token and optional to also define placeholder values or also a complete metadata code for the metadata override.

Please keep in mind that if you upload the metadata in a payload, the metadata must be escaped. Online JSON Escape /Unescape Toolhttps://www.freeformatter.com/json-escape.html#before-output

Endpoint

/v2/UploadNft

Body

Define the body for the request fitting for your token upload. Please remove the fields that don't apply for your upload. You have the option of uploading the file as BASE64 Content, URL Link, or IPFS Hash. If you submit Metadata, it will be used instead of the project's Metadatatemplate. You may submit either Metadata or MetadataPlaceholder, but not both.

{
  "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
}

For this example, we specified the body like that:

{
  "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"
    }
  ]
}

Instead of giving the metadata via MetadataOverride, we used the metadataPlaceholder method to define custom fields. Please keep in mind that this placeholder method only works, if the custom fields are specified in the metadata template. If you want to use the Metadata Override, please read here.

Curl

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"
    }
  ]
}'

Response

{
  "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"
}

Using the Metadata Override instead of the Placeholder

In case you want to submit a complete 721 Metadata JSON, please keep in mint that you have to remove the MetadataPlaceholder fields in the request body and use the Metadata override field.

  "metadataOverride": "string",

Continue to send your Curl as you would with the placeholder method, adding the escaped metadata to the field:

  "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}",