NFT API
This is an introduction page for the NFT (Non-Fungible Token) API.
About NFT API
The NFT API of ChainZ API Service allows you to issue and manage collections and NFTs based on ERC721 tokens.
It provides functions for creating, Searching, uploading contents to NFT, and issuing NFT.
Using the NFT API
You can create a user address using the “API to create a new user account” provided by the NFT API, and issue NFTs to this address. Each NFT can be separated by a collection, and if there is no collection, a collection must be created first.
Common settings
ChainZ Account API URL: https://nft-api.chainz.biz
Common HTTP Request
In order to access the API, the access token and API key must always be included in the HTTP Header.
curl -X POST \
"https://{NFT API Url}" \
-H "accept: application/json" \
-H "Authorization: Bearer {access token}" \
-H "x-api-key: {API key}" \
-H 'Content-Type: application/json' \
-d '{Json Body}'
1. Creating Collection
Multiple collections can be created, and at least one collection must be created.
URL : https://nft-api.chainz.biz/api/v1/collections
Request
{
"chainId": <TestNet chain id:2021>,
"name": <Collection name>,
"symbol": <Collection symbol>,
"defaultMinteeAddr": <Address to which the tokens are issued>
"description": <Collection description>,
"callbackUrl": <Callback Url>
}
Response
{
"taskId": <ID to be passed along with the result passed to Callback>
}
Callback
{
"result" : {
"state" : "SUCCESS" // result
},
"taskId" : <TASK ID>,
"collectionId" : <Created Collection ID>,
"contractAddr" : <SmartContract address of created collection>,
"adminAddr" : <The Admin Address where Collection is created>
}
2. User Registration:
Register the user to issue an NFT to the user.
URL : https://nft-api.chainz.biz/api/v1/accounts
Request
{
"extUserId": <User-identifiable ID>,
"chainId": <TestNet chain id:2021>
}
Response
{
"extUserId": <User-identifiable ID>,
"chainId": <TestNet chain id:2021>,
"address": <created address>
}
3. Uploading Digital Contents
First, upload the digital contents you want to include in the NFT. If the data is converted to a NFT or has been created for a long time, it will be automatically deleted.
URL : https://nft-api.chainz.biz/api/v1/content
Content-Type : multipart/form-data;
Request Parameter
File: Digital contents file
Response
{
"id": <Contents ID>,
"fileName": <File name>,
"contentType": <Type of File>,
"url": <Temporary URL, if it is converted to a NFT, or has been created for a long time, it will be deleted>,
"storageType": "S3"
}
4. Creating NFTs
Issue NFTs to registered users. Use the Content ID that is created in the previous step.
NFTs are named as ASSET inside the NFT API.
URL : https://nft-api.chainz.biz/api/v1/collections/{collection ID}/assets
Request
{
"title": <NFT' s name>,
"author": <author’s name>,
"contentId": <Content ID created in the previous step>,
"descr": <NFT description>,
"minteeAddr": <Address to which the tokens are issued>,
"callbackUrl": <Callback Url>
}
Response
{
"taskId": <ID to be passed along with the result passed to Callback>
}
Callback
{
"result" : {
"state" : "SUCCESS" // result
},
"taskId" : <TASK ID>,
"collectionId" : <Collection ID>,
"assetId" : <Asset ID, Internal ID>,
"tokenId" : <NFT Token ID>,
"contentUrl" : <Contents File Download Link>,
"tokenUrl" : <Link to meta data about the token>
}
5. NFT ownership can be transferred to the user for whom NFT ownership transfer is registered.
The NFT is specified based on the collection ID and asset ID, and the address of the current owner and the address of the user to whom the ownership is to be transferred are required.
URL : https://nft-api.chainz.biz/api/v1/collections/{collection Id}/assets/{asset Id}/transfers
Request
{
"senderAddr": <Address of the current owner>,
"recipientAddr": <Address of the recipient>,
"callbackUrl": <Callback Url>
}
Response
{
"taskId": <ID to be passed along with the result passed to Callback>
}
Callback
{
"result" : {
"state" : "SUCCESS" // result
},
"taskId" : <TASK ID>,
"assetId" : <Assect ID, Internal ID>
}
6. Mirror Collection Registration
NFTs created on the ChainZ network can be exported to the Ethereum network. To do this, you must first register the collection on the Ethereum network. If you specify the Collection ID that was previously created on the ChainZ network, the collection will also be created on the Ethereum network.
URL : https://nft-api.chainz.biz/api/v1/collections/{collectionId}/mirrors
Request
{
"callbackUrl": <Callback Url>
}
Response
{
"taskId": <ID to be passed along with the result passed to Callback>
}
Callback
{
"result" : {
"state" : "SUCCESS" // result
},
"taskId" : <TASK ID>,
"originCollectionChainId" : <Chain ID of the ChainZ network where the Collection is registered>,
"originCollectionId" : <Collection ID, Internal ChainZ ID>,
"mirrorCollectionChainId" : <Chain ID of the Ethereum network where the Mirror Collection is registered>,
"mirrorContractAddr" : <Contract address deployed on the Ethereum network>,
"mirrorContractAdminAddrs" : [ <List of admin addresses of Contracts deployed on the Ethereum network> ]
}
7. NFT export
NFTs created on the ChainZ network are exported to the Ethereum network. The Chain ID of the export target network and the address of the user who will own the NFT are required. The collection of the NFT to be exported must be registered as a mirror collection in the Chain ID of the export target network.
URL : https://nft-api.chainz.biz/api/v1/collections/{collection Id}/assets/{asset Id}/export
Request
{
"toChainId" : <Export target network chain ID>,
"toMinteeAddr" : <Account address owned when exporting NFTs>,
"callbackUrl" : <Callback Url>
}
Response
{
"taskId": <ID to be passed along with the result passed to Callback>
}
Callback
{
"result" : {
"state" : "SUCCESS" // result
},
"taskId" : <TASK ID>,
"originCollectionId" : <Collection ID, Internal ChainZ ID>,
"originAssetId" : <Assect ID, Internal ChainZ ID>,
"originTokenId" : <Token ID, Internal ChainZ ID>,
"mirrorContractAddr" : <Contract address deployed on the Ethereum network>,
"newTokenId" : <Token ID, External Ethereum network ID>
}
8. Searching Material Status
You can search the current status of the task by specifying the task ID received in the API Response.
URL : https://nft-api.chainz.biz/api/v1/tasks/{taskId}
Response
{
"taskId": <TASK ID>,
"type": <TASK Type>,
"statusType": <TASK Current Status>,
"reason": [Optional] <If the TASK status is FAIL, the reason for the failure>
"callbackData": [Optional] <If the TASK status is SUCCESS, SUCCESS_BUT_NOT_DELIVERY, the Callback data>,
"startedAt": <TASK start date and time>,
"finishedAt": [Optional] <If the TASK status is not PREPARING, the TASK end date and time>
}
List of NFT APIs
Last updated