Skip to content

NFT API

This page provides routes for managing NFTs. The following routes are available:

Get NFTs

This endpoint gets all NFTs

GET https://nft-platform.azurewebsites.net/api/v1/nfts/

Create NFTs

This endpoint creates new NFTs.

POST https://nft-platform.azurewebsites.net/api/v1/nfts/

INFO

Authentication: Requires ApiKey for authentication. Permissions: Requires CUSTOMER role with write permission.

Parameters

File upload required (single file)

Example

json
{
  "file": "multipart/form-data",
  "formData": {
    "name": "Example NFT",
    "collectionId": "123456789abcdef123456789",
    "file": "/path/to/example/image.jpg",
    "description": "This is an example NFT description"
  }
}
json
{
  "message": "NFT Created Successfully",
  "response": {
    "nft": {
      "collection": {
        "_id": "67a9a3898b4ab4ae22efcde8",
        "category": "Collectible",
        "contractAddress": "0x37baC36B2da283eA74D10669A7f87a51147126Cf",
        "createdBy": "67a98689bc4810c0e57b07d7",
        "description": "ewf erger",
        "image": "https://nftplatform.ipfs.storage/67a986897ab94fbb2eb0ce54/wp8450146.jpg",
        "name": "QUOTES",
        "network": "amoy",
        "createdAt": "2025-02-10T06:58:17.756Z",
        "__v": 0,
        "nfts": []
      },
      "created_by": "67a98689bc4810c0e57b07d7",
      "description": "Trial NFTT",
      "image": "https://nftplatform.ipfs.storage/67a986897ab94fbb2eb0ce54/logo-1933884_640.webp",
      "name": "vvv7",
      "owner": "67a986897ab94fbb2eb0ce54",
      "tokenId": 3,
      "txn_hash": "0xd69589b59fc097d5601310ac8407cef00e2fc40b54c3b59748899119de01b727"
    }
  },
  "status": "success"
}

HTTP Response Codes

Status CodeTextDescription
200OKWith an apikey object.
400Bad RequestThe request was invalid or cannot be processed.
401UnauthorizedAuthentication is required or has failed.
403ForbiddenThe authenticated user is not authorized to perform the requested action.
404Not FoundThe requested resource could not be found.
500Internal Server ErrorAn unexpected error occurred.

Claim NFT

This endpoint allows claiming an NFT.

PATCH https://nft-platform.azurewebsites.net/api/v1/nfts/

INFO

Authentication: Requires ApiKey for authentication. Permissions: Requires CUSTOMER role with update permission.

HTTP Response Codes

Status CodeTextDescription
200OKRequest successful
400Bad RequestThe request was invalid or cannot be processed
401UnauthorizedAuthentication is required or has failed
403ForbiddenThe authenticated user is not authorized to perform the requested action
404Not FoundThe requested resource could not be found
500Internal Server ErrorAn unexpected error occurred

Assign NFT

This endpoint allows assigning an NFT to a user.

PUT https://nft-platform.azurewebsites.net/api/v1/nfts/assign

INFO

Authentication: Requires ApiKey for authentication. Permissions: Requires USER role with read permission.

Request Body

FieldTypeDescription
emailstringEmail of the user to assign the NFT to
nftIdstringID of the NFT to assign

Example Request

json
{
  "email": "user@example.com",
  "nftId": "67b813e5a27f852b4de624ff"
}
json
{
  "message": "NFT assigned to user with email: user@example.com",
  "nft": {
    "assign": {
      "assignedBy": "example123",
      "assignedTo": "user@example.com",
      "claim_code": {
        "code": "example123456789"
      },
      "time": "2025-01-01T00:00:00.000Z"
    },
    "_id": "example123",
    "attributes": [],
    "created_by": "example123",
    "description": "Example NFT",
    "image": "https://example.com/example.jpg",
    "name": "Example NFT",
    "nftCollection": {
      "_id": "example123",
      "category": "Example",
      "contractAddress": "0x1234567890111222",
      "createdBy": "example123",
      "description": "Example Collection",
      "image": "https://example.com/example.jpg",
      "name": "EXAMPLE",
      "network": "example",
      "createdAt": "2025-01-01T00:00:00.000Z",
      "__v": 0,
      "id": "example123"
    },
    "owner": "example123",
    "tokenId": "1",
    "txn_hash": "0x1234567890111222",
    "createdAt": "2025-01-01T00:00:00.000Z",
    "updatedAt": "2025-01-01T00:00:00.000Z",
    "__v": 0,
    "id": "example123"
  },
  "status": "success"
}

HTTP Response Codes

Status CodeTextDescription
200OKWith an apikey object.
400Bad RequestThe request was invalid or cannot be processed.
401UnauthorizedAuthentication is required or has failed.
403ForbiddenThe authenticated user is not authorized to perform the requested action.
404Not FoundThe requested resource could not be found.
500Internal Server ErrorAn unexpected error occurred.

Get User NFT

This endpoint allows fetching NFTs assigned to a user.

GET https://nft-platform.azurewebsites.net/api/v1/nfts/user

Get NFTs assigned to the authenticated user.

INFO

Authentication: Requires ApiKey for authentication. Permissions: Requires USER role with read permission.

Example

json
{}
json
{
  "message": "Fetched nfts successfully.",
  "nfts": [
    {
      "collection": {
        "_id": "67a9a3898b4ab4ae22efcde8",
        "category": "Collectible",
        "contractAddress": "0x37baC36B2da283eA74D10669A7f87a51147126Cf",
        "createdBy": "67a98689bc4810c0e57b07d7",
        "description": "ewf erger",
        "image": "https://nftplatform.ipfs.storage/67a986897ab94fbb2eb0ce54/hhhh.jpg",
        "name": "EXAMPLE",
        "network": "amoy",
        "createdAt": "2025-02-10T06:58:17.756Z",
        "__v": 0,
        "nfts": []
      },
      "created_by": "67a98689bc4820c0e57b07d7",
      "description": "Trial NFT",
      "image": "https://nftplatform.ipfs.storage/67a986897ab94fbb2eb0ce54/image.webp",
      "name": "Trial NFT",
      "owner": "67a986897ab94fbb2eb0cr54",
      "tokenId": 3,
      "txn_hash": "0xd69589b59fc095d5601310ac5407cef00e2fc40b54c3b59748899119de01b727"
    }
  ],
  "status": "success"
}

HTTP Response Codes

Status CodeTextDescription
200OKWith an apikey object.
400Bad RequestThe request was invalid or cannot be processed.
401UnauthorizedAuthentication is required or has failed.
403ForbiddenThe authenticated user is not authorized to perform the requested action.
404Not FoundThe requested resource could not be found.
500Internal Server ErrorAn unexpected error occurred.

Transfer NFT

This endpoint allows transferring an NFT to another user.

PATCH https://nft-platform.azurewebsites.net/api/v1/nfts/collections/:collectionId/tokens/:tokenId/transfer

INFO

Authentication: Requires ApiKey for authentication. Permissions: Requires USER role with write and update permission.

Parameters

ParameterTypeDescription
collectionIdstringThe ID of the collection to which the NFT belongs.
tokenIdstringThe ID of the NFT to be transferred.
json
{
  "receiver": "example123@gmail.com" // receiver can be wallet address or email
}
json
{
  "message": "NFT transferred successfully",
  "status": "success",
  "transactionResponse": {
    "hash": "0x1234567890abcdef1234567890abcde...7890abcdef1234567890abcdef",
    "blockNumber": 12345678,
    "blockHash": "0x1234567890abcdef1234567890ab....def1234567890abcdef",
    "timestamp": 1645432198,
    "confirmations": 1,
    "from": "0x1234567890123456789012345678901234567890",
    "to": "0x0987654321098765432109876543210987654321",
    "tokenId": 123,
    "gasUsed": "21000",
    "effectiveGasPrice": "20000000000"
  },
  /* 
   The updated NFT data is only returned if the `receiver` field in the
   request body is a valid email address and the NFT is successfully
   transferred to the specified user.
   */
  "updatedNFT": {
    "_id": "123456789012345678901234",
    "name": "Example NFT",
    "description": "This is an example NFT",
    "image": "https://example.com/nft.jpg",
    "tokenId": 123,
    "nftCollection": "123456789012345678901234",
    "owner": "0x1234567890123456789012345678901234567890",
    "createdBy": "123456789012345678901234",
    "assign": null,
    "attributes": [],
    "txn_hash": "0x12345678901234567890123....34567890123456789012345678901234"
  }
}

HTTP Response Codes

Status CodeTextDescription
200OKWith an apikey object.
400Bad RequestThe request was invalid or cannot be processed.
401UnauthorizedAuthentication is required or has failed.
403ForbiddenThe authenticated user is not authorized to perform the requested action.
404Not FoundThe requested resource could not be found.
500Internal Server ErrorAn unexpected error occurred.

Create and Assign NFT

This endpoint allows creating and assigning an NFT to a user.

POST https://nft-platform.azurewebsites.net/api/v1/nfts/create-assign

INFO

Authentication: Requires ApiKey for authentication. Permissions: Requires USER role with write permission.

json
{
  "file": "multipart/form-data",
  "formData": {
    "name": "Example NFT",
    "collectionId": "123456789abcdef123456789",
    "file": "/path/to/example/image.jpg",
    "description": "This is an example NFT description",
    "email": "user@example.com"
  }
}
json
{
  "message": "NFT created and assigned to user with email: example123@gmail.com",
  "nft": {
    "assign": {
      "assignedBy": "67a98689bc4810c0e57b07d7",
      "assignedTo": "example123@gmail.com",
      "claim_code": {
        "code": "c4c2ca62a3f5a44b11a0"
      },
      "time": "2025-02-21T12:36:32.334Z"
    },
    "_id": "67b8734f98bdaaaeafda1bee",
    "attributes": [],
    "created_by": "67a98689bc4810c0e57b07d7",
    "description": "Trial NFT Creation",
    "image": "https://nftplatform.ipfs.storage/67a986897ab94fbb2eb0ce54/image.jpg",
    "name": "Example",
    "nftCollection": {
      "_id": "67a9a3898b4ab4ae22efcde8",
      "category": "Collectible",
      "contractAddress": "0x37baC36B2da283eA74D10669A7f87a51147126Cf",
      "createdBy": "67a98689bc4810c0e57b07d7",
      "description": "Description for the collection",
      "image": "https://nftplatform.ipfs.storage/67a986897ab94fbb2eb0ce54/image.jpg",
      "name": "EXAMPLE",
      "network": "amoy",
      "createdAt": "2025-02-10T06:58:17.756Z",
      "__v": 0,
      "id": "67a9a3898b4ab4ae22efcde8"
    },
    "owner": "67a98689bc4810c0e57b07d7",
    "tokenId": "4",
    "txn_hash": "0xcdd52200fa301548d73a1f4fd5a88283b639abd5fae939a660446a8b9f9be3e7",
    "createdAt": "2025-02-21T12:36:31.802Z",
    "updatedAt": "2025-02-21T12:36:32.333Z",
    "__v": 0,
    "id": "67b8734f98bdaaaeafda1bee"
  },
  "status": "success"
}

HTTP Response Codes

Status CodeTextDescription
200OKWith an apikey object.
400Bad RequestThe request was invalid or cannot be processed.
401UnauthorizedAuthentication is required or has failed.
403ForbiddenThe authenticated user is not authorized to perform the requested action.
404Not FoundThe requested resource could not be found.
500Internal Server ErrorAn unexpected error occurred.

Batch Mint NFT

This endpoint allows creating multiple NFTs in a single request.

POST https://nft-platform.azurewebsites.net/api/v1/nfts/batch-mint

INFO

Authentication: Requires ApiKey for authentication. Permissions: Requires USER role with write permission.

json
{
  "file": "multipart/form-data",
  "formData": {
    "nfts": "[{"name": "NFT 1", "description": "Description 1"}, {"name": "NFT 2", "description": "Description 2"}]",
    "collectionId": "123456789abcdef123456789"
    }
}
json
{
  "message": "NFTs minted successfully.",
  "status": "success",
  "nfts": [
    {
      "_id": "987654321abcdef987654321",
      "attributes": [],
      "description": "Example NFT Description 1",
      "image": "https://example.com/nft1.jpg",
      "name": "Example NFT 1",
      "nftCollection": {
        "_id": "collection123456789abc",
        "category": "Digital Art",
        "contractAddress": "0x1234567890abcdef1234567890abcdef12345678",
        "createdBy": "123456789abcdef123456789",
        "description": "Example Collection Description",
        "image": "https://example.com/collection.jpg",
        "name": "Example Collection",
        "network": "ethereum",
        "createdAt": "2024-01-01T00:00:00.000Z",
        "__v": 0,
        "id": "collection123456789abc"
      },
      "owner": "123456789abcdef123456789",
      "tokenId": "1",
      "txn_hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
      "__v": 0,
      "createdAt": "2024-01-01T10:00:00.000Z",
      "updatedAt": "2024-01-01T10:00:00.000Z",
      "id": "987654321abcdef987654321"
    },
    {
      "_id": "987654321abcdef987654322",
      "attributes": [],
      "description": "Example NFT Description 2",
      "image": "https://example.com/nft2.jpg",
      "name": "Example NFT 2",
      "nftCollection": {
        "_id": "collection123456789abc",
        "category": "Digital Art",
        "contractAddress": "0x1234567890abcdef1234567890abcdef12345678",
        "createdBy": "123456789abcdef123456789",
        "description": "Example Collection Description",
        "image": "https://example.com/collection.jpg",
        "name": "Example Collection",
        "network": "ethereum",
        "createdAt": "2024-01-01T00:00:00.000Z",
        "__v": 0,
        "id": "collection123456789abc"
      },
      "owner": "123456789abcdef123456789",
      "tokenId": "2",
      "txn_hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
      "__v": 0,
      "createdAt": "2024-01-01T10:00:00.000Z",
      "updatedAt": "2024-01-01T10:00:00.000Z",
      "id": "987654321abcdef987654322"
    }
  ]
}

HTTP Response Codes

Status CodeTextDescription
200OKWith an apikey object.
400Bad RequestThe request was invalid or cannot be processed.
401UnauthorizedAuthentication is required or has failed.
403ForbiddenThe authenticated user is not authorized to perform the requested action.
404Not FoundThe requested resource could not be found.
500Internal Server ErrorAn unexpected error occurred.

Batch Mint And Assign NFT

This endpoint allows minting and assigning multiple NFTs to users in a single request.

POST https://nft-platform.azurewebsites.net/api/v1/nfts/batch-mint-assign

INFO

Authentication: Requires ApiKey for authentication. Permissions: Requires USER role with write permission.

json
{
  "file": "multipart/form-data",
  "formData": {
    "nfts": "[{"name": "NFT 1", "description": "Description 1"}, {"name": "NFT 2", "description": "Description 2"}]",
    "collectionId": "123456789abcdef123456789",
    "email": "user@example.com"
    }
}
json
{
  "message": "NFTs created and assigned to users successfully",
  "nfts": [
    {
      "assign": {
        "assignedBy": "123456789abcdef123456789",
        "assignedTo": "user@example.com",
        "claim_code": {
          "code": "abc123def456ghi789xyz"
        },
        "time": "2024-01-01T10:00:00.000Z"
      },
      "_id": "987654321abcdef987654321",
      "attributes": [],
      "description": "Example NFT Description 1",
      "image": "https://example.com/nft1.jpg",
      "name": "Example NFT 1",
      "nftCollection": {
        "_id": "collection123456789abc",
        "category": "Digital Art",
        "contractAddress": "0x1234567890abcdef1234567890abcdef12345678",
        "createdBy": "123456789abcdef123456789",
        "description": "Example Collection Description",
        "image": "https://example.com/collection.jpg",
        "name": "Example Collection",
        "network": "ethereum",
        "createdAt": "2024-01-01T00:00:00.000Z",
        "__v": 0,
        "id": "collection123456789abc"
      },
      "owner": "123456789abcdef123456789",
      "tokenId": "1",
      "txn_hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
      "__v": 0,
      "createdAt": "2024-01-01T10:00:00.000Z",
      "updatedAt": "2024-01-01T10:00:00.000Z",
      "id": "987654321abcdef987654321"
    },
    {
      "assign": {
        "assignedBy": "123456789abcdef123456789",
        "assignedTo": "user@example.com",
        "claim_code": {
          "code": "xyz789def456abc123"
        },
        "time": "2024-01-01T10:00:00.000Z"
      },
      "_id": "987654321abcdef987654322",
      "attributes": [],
      "description": "Example NFT Description 2",
      "image": "https://example.com/nft2.jpg",
      "name": "Example NFT 2",
      "nftCollection": {
        "_id": "collection123456789abc",
        "category": "Digital Art",
        "contractAddress": "0x1234567890abcdef1234567890abcdef12345678",
        "createdBy": "123456789abcdef123456789",
        "description": "Example Collection Description",
        "image": "https://example.com/collection.jpg",
        "name": "Example Collection",
        "network": "ethereum",
        "createdAt": "2024-01-01T00:00:00.000Z",
        "__v": 0,
        "id": "collection123456789abc"
      },
      "owner": "123456789abcdef123456789",
      "tokenId": "2",
      "txn_hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
      "__v": 0,
      "createdAt": "2024-01-01T10:00:00.000Z",
      "updatedAt": "2024-01-01T10:00:00.000Z",
      "id": "987654321abcdef987654322"
    }
  ],
  "status": "success"
}

HTTP Response Codes

Status CodeTextDescription
200OKWith an apikey object.
400Bad RequestThe request was invalid or cannot be processed.
401UnauthorizedAuthentication is required or has failed.
403ForbiddenThe authenticated user is not authorized to perform the requested action.
404Not FoundThe requested resource could not be found.
500Internal Server ErrorAn unexpected error occurred.

Get NFT By Token ID

This endpoint allows fetching an NFT by its token ID.

GET https://nft-platform.azurewebsites.net/api/v1/nfts/nft/:collectionId/:tokenId

INFO

Authentication: Requires ApiKey for authentication. Permissions: Requires USER role with read permission.

Parameters

NameTypeDescription
collectionIdstringThe ID of the NFT collection
tokenIdstringThe token ID of the NFT
json
{
  "blockExplorerUrl": "https://amoy.polygonscan.com",
  "message": "Fetched nft successfully.",
  "nft": {
    "assign": {
      "assignedBy": "123456789abcdef123456789",
      "assignedTo": "user@example.com",
      "claim_code": {
        "code": "abc123def456xyz789"
      },
      "time": "2024-01-01T10:00:00.000Z"
    },
    "_id": "987654321abcdef987654321",
    "attributes": [],
    "description": "Example NFT Description",
    "image": "https://example.com/nft.jpg",
    "name": "Example NFT",
    "nftCollection": {
      "_id": "collection123456789abc",
      "category": "Digital Art",
      "contractAddress": "0x1234567890abcdef1234567890abcdef12345678",
      "createdBy": "123456789abcdef123456789",
      "description": "Example Collection Description",
      "image": "https://example.com/collection.jpg",
      "name": "Example Collection",
      "network": "ethereum",
      "createdAt": "2024-01-01T00:00:00.000Z",
      "__v": 0,
      "id": "collection123456789abc"
    },
    "owner": "123456789abcdef123456789",
    "tokenId": "1",
    "txn_hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
    "__v": 0,
    "createdAt": "2024-01-01T10:00:00.000Z"
  },
  "openseaUrl": "https://opensea.io",
  "owner": "0x1234567890abcdef1234567890abcdef12345678",
  "status": "success",
  "transactions": [
    {
      "blockNumber": "12345678",
      "from": "0x0000000000000000000000000000000000000000",
      "to": "0x1234567890abcdef1234567890abcdef12345678",
      "transactionHash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
      "timestamp": "2024-01-01T10:00:00.000Z"
    }
  ]
}

HTTP Response Codes

Status CodeTextDescription
200OKWith an apikey object.
400Bad RequestThe request was invalid or cannot be processed.
401UnauthorizedAuthentication is required or has failed.
403ForbiddenThe authenticated user is not authorized to perform the requested action.
404Not FoundThe requested resource could not be found.
500Internal Server ErrorAn unexpected error occurred.

API Documentation created with ❤️ by TrackGenesis