NFT
This page introduces how to get NFT information with Token History API.
Before Getting Started
API introduced in here should only be used with HTTP Request.
The x-chain-id value for calling the API is 8217 (Cypress) or 1001 (Baobab).
Essential parameters for calling APIs are described in individual examples.
Values that a user needs to enter for calling APIs will be represented with one pair of braces ({}). A user must enter the following values.
Item
Description
Note
chain-id
8217 or 1001
Cypress(Klaytn mainnet) or Baobab(Klaytn testnet
access-key-id
Auth ID
accessKeyId
obtained from KAS Console - Security - Credential
secret-access-key
Auth Password
secretAccessKey
obtained from KAS Console - Security - Credential
krn
(optional) ID of Account Pool
Unnecessary when using Default Account Pool
A KAS API Authentication Key (API Auth Key) provides access to all KAS services and all the rights to a Klaytn account which was created by calling Wallet API via this API Auth Key. The rights here include accessing and transferring all the assets (KLAY, etc.) of or sending a transaction from a Klaytn account. If you shared your API Auth Key with any unauthorized personnel, your Klaytn account could be compromised and might cause unwanted transaction execution.
DO NOT share your API Auth Key (Secret AccessKey or Authorization) with any unauthorized personnel. DO PUT efforts necessary to keep your API Auth Key safe for the security of your KAS/Klaytn account.
Get List of NFT Tokens
Search the NFT list that is issued by a specific labeled NFT contract.
NFT contract is a type of smart contract deployed to Klaytn that allows users to issue, delete, and send Non-fungible Token (Non-Fungible Token, NFT).
Label is a marker put on a specific token contract by KAS for tracking its information. KAS only tracks labeled token contracts. This API requests for the list of labeled FT contracts. For details about labeling, please visit here.
API Request
Search the NFT list as follows.
Query Parameter
You can receive API response values with Cursor-based Pagination.
Parameter
Description
Example
Required or Not
size
the number of items in the API response (min=1, max=1000, default=100)
size=100
False
cursor
the cursor required to get the next batch of response items
cursor=J9Ag...VM6z
False
curl --location --request GET "https://th-api.klaytnapi.com/v2/contract/nft/0x90d535c434e967ec6e9accb0de5dcb34010865e0/token?size=100&cursor=J9Ag...VM6z" \
--header "x-chain-id: {chain-id}" \
-u {access-key-id}:{secret-access-key}
nft-address
(0x90d535c434e967ec...) is a required input value that stands for an address of the NFT contract to be searched.
API Response
The NFT list will be received as a response as follows if the request is successful.
{
"items": [
{
"tokenId": "0xa",
"owner": "0x5160e376db4c5a445438d3a1998d2cf6a982adf2",
"previousOwner": "0x0000000000000000000000000000000000000000",
"tokenUri": "",
"transactionHash": "0x671cd9b3f7f990830fa4f39b8c3b7f926b92b2fd8a1b8e512f5bdc29ccd40831",
"createdAt": 1597748688,
"updatedAt": 1597748688
},
{
"tokenId": "0x9",
"owner": "0x5160e376db4c5a445438d3a1998d2cf6a982adf2",
"previousOwner": "0x0000000000000000000000000000000000000000",
"tokenUri": "",
"transactionHash": "0xe0c0132274d90d5d81bcbd125943d1c82d5ea03c344888bc1384e48b75501663",
"createdAt": 1597748685,
"updatedAt": 1597748685
},
...,
{
"tokenId": "0x1",
"owner": "0x6058233f589dbe86f38bc64e1a77cf16cf3c6c7e",
"previousOwner": "0x0000000000000000000000000000000000000000",
"tokenUri": "",
"transactionHash": "0x435385996ad7508d57fd495cd2a1aeeb314372ddb35b559c759021c8c6ac9a61",
"createdAt": 1597743760,
"updatedAt": 1597743760
}
],
"cursor": ""
}
For details about this API, please visit here. For inquires about this document or KAS, please visit KAS Developer forum.
Get List of NFT Tokens by EOA
Search for the NFT list owned by a specific EOA. A labeled token contract must have issued this token.
NFT contract is a type of smart contract deployed to Klaytn that allows users to issue, delete, and send Non-fungible Token (Non-Fungible Token, NFT).
Label is a marker put on a specific token contract by KAS for tracking its information. KAS only tracks labeled token contracts. This API requests for the list of labeled FT contracts. For details about labeling, please visit here.
API Request
Load the list of all tokens of a specific EOA as follows.
Query Parameter
You can receive API response values with Cursor-based Pagination.
Parameter
Description
Example
Required or Not
size
the number of items in the API response (min=1, max=1000, default=100)
size=100
False
cursor
the cursor required to get the next batch of response items
cursor=J9Ag...VM6z
False
curl --location --request GET "https://th-api.klaytnapi.com/v2/contract/nft/0x251f622e8b5e713f357e9c4d990e91da2f448134/owner/0xe5389503156ee02775ee18552f0c9d9846b66a91size=100&cursor=J9Ag...VM6z" \
--header "x-chain-id: {chain-id}" \
-u {access-key-id}:{secret-access-key}
nft-address
is a required input value that stands for an address of the NFT contract to be searched.owner-address
is a required input value that stands for the EOA to be searched.
API Response
If the API request was successful, you would get the list of tokens as follows.
{
"items": [
{
"tokenId": "0x7",
"owner": "0xe5389503156ee02775ee18552f0c9d9846b66a91",
"previousOwner": "0x0000000000000000000000000000000000000000",
"tokenUri": "http://example.mynft.com/meta/item7",
"transactionHash": "0x9b9d553d8b3141eabdc6ececd44958475366b1bc289088248b2b3dadcecf8ab4",
"createdAt": 1597308968,
"updatedAt": 1597308968
},
{
"tokenId": "0x6",
"owner": "0xe5389503156ee02775ee18552f0c9d9846b66a91",
"previousOwner": "0x0000000000000000000000000000000000000000",
"tokenUri": "http://example.mynft.com/meta/item6",
"transactionHash": "0x441c617bfc1e0baee363bc495617579a4e3eb2a6ddd6249ad3ece5363e3faee2",
"createdAt": 1597308146,
"updatedAt": 1597308146
},
...,
{
"tokenId": "0x2",
"owner": "0xe5389503156ee02775ee18552f0c9d9846b66a91",
"previousOwner": "0x0000000000000000000000000000000000000000",
"tokenUri": "http://example.mynft.com/meta/item2",
"transactionHash": "0xc7d07066e4e42a7d896c34420ed43568ba44ae15a8ef771b13ba1f6f2d2820c4",
"createdAt": 1597304701,
"updatedAt": 1597304701
}
],
"cursor": ""
}
For details about this API, please visit here. For inquires about this document or KAS, please visit KAS Developer forum.
Get NFT Token Information
Search for specific NFT information.
NFT contract is a type of smart contract deployed to Klaytn that allows users to issue, delete, and send Non-fungible Token (Non-Fungible Token, NFT).
API Request
Search for specific NFT information.
curl --location --request GET "https://th-api.klaytnapi.com/v2/contract/nft/0x251f622e8b5e713f357e9c4d990e91da2f448134/token/0x2" \
--header "x-chain-id: {chain-id}" \
-u {access-key-id}:{secret-access-key}
nft-address
is a required input value that stands for an address of the NFT contract to be searched.token-id
is a required input value and an identifier of the token to be searched.
API Response
The NFT information will be received as a response as follows if the request is successful.
{
"tokenId": "0x2",
"owner": "0xe5389503156ee02775ee18552f0c9d9846b66a91",
"previousOwner": "0x0000000000000000000000000000000000000000",
"tokenUri": "http://example.mynft.com/meta/item2",
"transactionHash": "0xc7d07066e4e42a7d896c34420ed43568ba44ae15a8ef771b13ba1f6f2d2820c4",
"createdAt": 1597304701,
"updatedAt": 1597304701
}
For details about this API, please visit here. For inquires about this document or KAS, please visit KAS Developer forum.
Last updated
Was this helpful?