Add an NFT Item to a Collection

After creating an NFT collection, you will add NFT items to the collection.

To add an NFT item to a collection, send a POST request to the /nft/nftitems endpoint.

Add an NFT item to an NFT collection.

POST https://api.playfix.io/nft/nftitems

Headers

Name
Type
Description

Authorization*

String

Bearer <your_access_token>

Request Body

Name
Type
Description

nft*

String

Name of the NFT collection the NFT item will be added to. This should be the value of name from a previously created NFT collection.

title*

String

The title of the NFT item.

description*

String

A short description of the NFT item.

imageCid*

String

IPFS CID for the NFT item's image.

attributes

Object

An array of objects. Each object is an attribute of the NFT item.

{
  "nft": "<nft_collection_name>",
  "title": "Fast Car",
  "number": "1",
  "description": "blazing fast car",
  "imageUrl": "https://ipfs-gateway.playfix.io/ipfs/QmbAVZQhTmRwy57pr4NWuDMhxAC9yzU21GtaGP1f6bay8W",
  "imageCid": "QmbAVZQhTmRwy57pr4NWuDMhxAC9yzU21GtaGP1f6bay8W",
  "attributes": [
    {
      "property": {
        "name": "eyes",
        "value": "brown"
      }
    }
  ],
  "mintingTransactionHash": ""
}

The following example creates an NFT item titled "Fast Car" with a brown eyes property.

Example Curl API Call

curl --request POST \
  --url https://api.playfix.io/nft/nftitems \
  --header 'Authorization: Bearer <your_access_token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "nft": "<nft_collection_name>",
  "title": "Fast Car",
  "number": "1",
  "description": "blazing fast car",
  "imageCid": "QmbAVZQhTmRwy57pr4NWuDMhxAC9yzU21GtaGP1f6bay8W",
  "attributes": [
    {
      "property": {
        "name": "eyes",
        "value": "brown"
      }
    }
  ]
  }'

Example Python API Call

import requests
import json

payload = {
    "nft": "<nft_collection_name>",
    "title": "Fast Car",
    "number": "1",
    "description": "blazing fast car",
    "imageCid": "QmbAVZQhTmRwy57pr4NWuDMhxAC9yzU21GtaGP1f6bay8W",
    "attributes": [
        {
          "property": {
            "name": "eyes",
            "value": "brown"
            }
        }
      ]
    }

r = requests.post(
    "https://api.playfix.io/nft/nftitems",
    headers = {
        "authorization": "Bearer <your_access_token>",
        "accept": "application/json",
        "Content-Type": "application/json"
        },
    data = json.dumps(payload)
    )

print(r.text)

Request Body

  • nft - Name of the NFT collection the NFT item will be added to. This should be the value of name from a previously created NFT collection.

  • title - The title of the NFT item.

  • number - The NFT item's number.

  • description - A short description of the NFT item.

  • imageCid - IPFS CID for the NFT item's image.

  • attributes - An array of objects. Each object is an attribute of the NFT item.

    • property - A property of the NFT item. You can add multiple property objects.

Response

{
  "name": "nftitems/01ggdqqd0mkkt7hz57a1g130yq"
  "nft": "<nft_collection_name>",
  "title": "Fast Car",
  "number": "1",
  "description": "blazing fast car",
  "imageUrl": "https://ipfs-gateway.playfix.io/ipfs/QmbAVZQhTmRwy57pr4NWuDMhxAC9yzU21GtaGP1f6bay8W",
  "imageCid": "QmbAVZQhTmRwy57pr4NWuDMhxAC9yzU21GtaGP1f6bay8W",
  "attributes": [
    {
      "property": {
        "name": "eyes",
        "value": "brown"
      }
    }
  ],
  "mintingTransactionHash": ""
}

Response Fields

  • name - An automatically generated unique name of the NFT item. It begins with nftitems/, followed by a ULID.

  • imageUrl - An automatically generated URL to an IPFS gateway that fetches the cover image.

  • mintingTransactionHash - Transaction hash of minting the NFT item minting transaction hash. This will be empty if the NFT is yet to be minted.

The Playfix NFT API allows you to add only one NFT item at a time. To add multiple items to a collection, repeat this process for each item.

Last updated