Mint an NFT

Minting an NFT publishes the NFT on the blockchain, allowing it to be tradable.

To mint an NFT, send a POST request to the /nft/<nft_collection_name> endpoint, calling the :markMinted method.

Mint an NFT from a collection.

GET https://api.playfix.io/nft/<nft_item_name>:markMinted

Path Parameters

Name
Type
Description

nft_item_name*

String

The name of the NFT. This will start with a prefix of "nftitems/", followed by a ULID.

Headers

Name
Type
Description

Authorization*

String

Bearer <your_access_token>

Request Body

Name
Type
Description

transactionHash*

String

The transaction hash of the minting transaction, automatically generated by MetaMask.

{
  "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": "0x7947446dcd2555b6c890634a2240659c8d1b5b7b76609b25d9c313bc6b0c2816"
}

Example cURL API Call

curl --request POST \
  --url https://api.playfix.io/nft/<nft_item_name>:markMinted \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <your_access_token>' \
  --header 'Content-Type: application/json' \
  --data '{
        "transactionHash": "0x8b7f9ef613ee8accb04824254029b43b9c88626f1e6c99a99900948455a8a5e9"
        }

Example Python API Call

import requests
import json

nft = "<nft_item_name>"
payload = {
        "transactionHash": "0x8b7f9ef613ee8accb04824254029b43b9c88626f1e6c99a99900948455a8a5e9"
    }

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

print(r.text)

You must connect to metamask to run this process.

Request Body

  • transactionHash - The transaction hash of the minting transaction. This is automatically generated by MetaMask.

Response

{
  "name": "nftitems/01ggdqqd0mkkt7hz57a1g130yq"
  "nft": "nfts/01gg72h0znfjggmnq7dyaek0r2",
  "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": "0x7947446dcd2555b6c890634a2240659c8d1b5b7b76609b25d9c313bc6b0c2816"
}

Last updated