These docs are for v1.0. Click to read the latest docs for v3.0.

How to store your NFT metadata on IPFS

This page describes how you can store your NFT metadata on InterPlanetary File System (IPFS).

Store NFT Metadata on IPFS

In this guide, we will look into how you can effortlessly store the metadata of an NFT on IPFS. Note that storing the metadata on IPFS will happen during the creation of the token-type (NFT tenplate).

📘

Storing the metadta on IPFS will not allow you to update it in the future.

Prerequisutes

  1. You already have an NFT collection (contract) created using the NFT-API. Click here to view the getting started guide if you haven't.
  2. Contract ID (Can be found in the response body of the create contract endpoint)

Request Endpoint: reference

POST /api/minter/contracts/{contractId}/token-types

{contractId}: This is the contract ID which can be found in the response body of the create contract endpoint.

Example Request

We will use the create token-type endpoint and within the request body, we will specify the storage type for the metadata.

POST /api/minter/contracts/57584/token-types

Request Body

📘

At the very end, in the storage object, we have defined the "type": "ipfs".

{
  "name" : "NFT with metadata on IPFS",
  "description" : "This NFTs metadata is stored on IPFS",
  "image": "https://static.wikia.nocookie.net/parody/images/4/42/74915084_10162764640400387_6139958579186106368_o.jpg",
  "backgroundColor" : "#eeeeee",
  "externalUrl" : "https://en.wikipedia.org/wiki/Space_Chickens_in_Space",
  "animationUrls" : [
      {"type": "video", "value" : "https://img.arkane.network/marketing/SpaceChickens/space_chickens_trailer.mp4"},
      {"type": "audio", "value" : "https://file-examples-com.github.io/uploads/2017/11/file_example_WAV_10MG.wav"}
  ],
  "maxSupply" : "25",
  "fungible" : true,
  "burnable": true,
  "attributes" : [
      {"type": "property", "name" : "Talent", "value": "Leadership"},
      {"type": "property", "name" : "Allergic", "value": "Monstonuts"},
      {"type": "property", "name" : "Hobby", "value": "Scouts"},
      {"type": "stat", "name" : "Cool", "value": "9", "maxValue": "10"},
      {"type": "stat", "name" : "Daring", "value": "8", "maxValue": "10"},
      {"type": "stat", "name" : "Noise", "value": "8", "maxValue": "10"},
      {"type": "stat", "name" : "Age", "value": "3"},
      {"type": "boost", "name" : "Crafting", "value": "+5"},
      {"type": "boost", "name" : "Leadership", "value": "+10"}
  ],
  "storage" : 
  {
     "type": "ipfs"
  }
}

Response Body

{
    "id": 166,
    "confirmed": false,
    "status": "PENDING",
    "name": "NFT with metadata on IPFS",
    "description": "This NFTs metadata is stored on IPFS",
    "fungible": true,
    "burnable": true,
    "externalUrl": "https://en.wikipedia.org/wiki/Space_Chickens_in_Space",
    "backgroundColor": "#eeeeee",
    "image": "https://static.wikia.nocookie.net/parody/images/4/42/74915084_10162764640400387_6139958579186106368_o.jpg",
    "imageThumbnail": "https://static.wikia.nocookie.net/parody/images/4/42/74915084_10162764640400387_6139958579186106368_o.jpg",
    "imagePreview": "https://static.wikia.nocookie.net/parody/images/4/42/74915084_10162764640400387_6139958579186106368_o.jpg",
    "maxSupply": 25,
    "currentSupply": 0,
    "pendingSupply": 0,
    "animationUrls": [
        {
            "type": "video",
            "value": "https://img.arkane.network/marketing/SpaceChickens/space_chickens_trailer.mp4"
        },
        {
            "type": "audio",
            "value": "https://file-examples-com.github.io/uploads/2017/11/file_example_WAV_10MG.wav"
        }
    ],
    "attributes": [
        {
            "type": "property",
            "name": "Talent",
            "value": "Leadership"
        },
        {
            "type": "property",
            "name": "Allergic",
            "value": "Monstonuts"
        },
        {
            "type": "property",
            "name": "Hobby",
            "value": "Scouts"
        },
        {
            "type": "stat",
            "name": "Cool",
            "value": "9",
            "maxValue": "10"
        },
        {
            "type": "stat",
            "name": "Daring",
            "value": "8",
            "maxValue": "10"
        },
        {
            "type": "stat",
            "name": "Noise",
            "value": "8",
            "maxValue": "10"
        },
        {
            "type": "stat",
            "name": "Age",
            "value": "3"
        },
        {
            "type": "boost",
            "name": "Crafting",
            "value": "+5"
        },
        {
            "type": "boost",
            "name": "Leadership",
            "value": "+10"
        }
    ],
    "transactionHash": "0x9de7653c16889abac32b2fa2bea33acf42e83f1d7cb080dc3b70c9d4a73938ec",
    "storage": {
        "type": "ipfs",
        "location": "ipfs://QmXQ7rQXBbEyNrZ6f5snEcU9jvANoJ9NpzACTWosvdfb9x"
    }
}