NFT API
NFT API is an Advanced APIs' collection of methods that comes as a unique feature along with other extensive capabilities provided to our Premium Plan users.
NFT API serves to request NFT-related data (owners, listings for particular wallet addresses, collections, time it's been minted, transaction history, and other metadata) across multiple EVM-compatible chains.
NFT API empowers the Web3 projects integrating NFTs (virtual worlds, decentralized games, galleries, marketplaces) to instantly fetch all the necessary information across multiple blockchains in a single request.
NFT API implements the JSON-RPC 2.0 specification for interaction.
NFT API Methods
NFT API consists of the following methods to request NFT-related data across multiple chains:
ankr_getNFTsByOwner— retrieves an account-associated NFTs.ankr_getNFTMetadata— retrieves metadata of a particular NFT.ankr_getNFTHolders— retrieves holders of a particular NFT.ankr_getNftTransfers— retrieves NFT transfers info of a particular address.
ankr_getNFTsByOwner
Retrieves the account's NFT data.
Retrieves a list of NFTs (ERC721/ERC1155/ENS/POAP) that belong to the particular account specified.
Request
Build your request using the parameters below.
Parameters
-
id(int64; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(object): the data object containing request body parameters:walletAddress(string; required): an account address to query for NFTs; supports the Ethereum Name Service (ENS).blockchain(string): a chain or a combination of chains to query:- Single chain:
eth,bsc,fantom,avalanche,polygon,arbitrum,syscoin,optimism,eth_goerli,avalanche_fuji. - Chains combination:
[eth, polygon, bsc]. - All chains: leave the value empty to query all the chains available.
- Single chain:
pageSize(int32): a number of page results you'd like to get (default=10, max=50).pageToken(string): a token is provided at the end of the response body and can be referenced in the request to fetch the next page.filter(key-value): Filters your request by either of the following:- Smart contract address (
"0xd8682bfa6918b0174f287b888e765b9a1b4dc9c3": []) — retrieves all NFTs from the address. - Smart contract address and NFT ID (
"0xd8682bfa6918b0174f287b888e765b9a1b4dc9c3": ["8937"]) — retrieves a particular NFT specified.
- Smart contract address (
{
"id": 1,
"jsonrpc": "2.0",
"method": "ankr_getNFTsByOwner",
"params": {
"blockchain": [
"string"
],
"filter": [
{
"additionalProp1": [
"string"
],
"additionalProp2": [
"string"
],
"additionalProp3": [
"string"
]
}
],
"pageSize": 0,
"pageToken": "string",
"walletAddress": "string"
}
}Content-Type: application/jsonResponse
Returns all the NFTs that belong to the account address specified by request body parameters.
Parameters
A successful response contains the following parameters:
-
id(int64; required): -
jsonrpc(string; required): -
result(object): the data object containing a list of NFT assets and their metadata:-
blockchain(string; required): one of the supported chains (eth,bsc,fantom,avalanche,polygon,arbitrum,syscoin,optimism,eth_goerli,avalanche_fuji). -
collectionName(string): a collection name the NFT asset belongs to. -
contractAddress(string): an NFT collection's EVM-compatible contract address. -
contractType(int32): a type of the contract — either ERC721 or ERC1155. -
name(string): a name of the NFT asset. -
tokenId(string): an ID of the NFT asset. -
imageUrl(string): a URL that points to the actual digital file, usually an IPFS link. -
symbol(string): a symbol of the NFT asset. -
traits(array): an attribute of the NFT asset.trait_type(string): a trait's descriptive name.value(string): a value description.
-
Code Examples
Request
curl --location --request POST 'https://rpc.ankr.com/multichain' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "ankr_getNFTsByOwner",
"params": {
"blockchain": ["eth"],
"walletAddress": "0x0E11A192d574b342C51be9e306694C41547185DD",
"pageSize": 2,
"pageToken": "",
"filter": [
{
"0x700b4b9f39bb1faf5d0d16a20488f2733550bff4": []
},
{
"0xd8682bfa6918b0174f287b888e765b9a1b4dc9c3": ["8937"]
}
]
},
"id": 1
}'Response
Code: 200 OK
{
"error": {},
"id": 1,
"jsonrpc": "2.0",
"result": {
"assets": [
{
"blockchain": "string",
"collectionName": "string",
"contractAddress": "string",
"contractType": 0,
"imageUrl": "string",
"name": "string",
"quantity": "string",
"symbol": "string",
"tokenId": "string",
"tokenUrl": "string",
"traits": [
{
"bunny_id": "string",
"count": 0,
"display_type": "string",
"frequency": "string",
"mp_score": "string",
"rarity": "string",
"trait_type": "string",
"value": "string"
}
]
}
],
"nextPageToken": "string",
"owner": "string"
}
}{
"jsonrpc": "2.0",
"id": 1,
"result": {
"owner": "0x0e11a192d574b342c51be9e306694c41547185dd",
"assets": [
{
"blockchain": "eth",
"name": "Happy Bunny #555",
"tokenId": "555",
"imageUrl": "https://ipfs.io/ipfs/QmSRkmEDKWUeHi5FiNpQUBAcCq7rKinhf5Pbu8ZPZNkP8r/555",
"collectionName": "Happy Bunnies",
"symbol": "BUNNY",
"contractType": "ERC721",
"contractAddress": "0x700b4b9f39bb1faf5d0d16a20488f2733550bff4",
"traits": [
{
"trait_type": "Background",
"value": "Green Background"
},
{
"trait_type": "Body",
"value": "Black Pearl Necklace"
},
{
"trait_type": "Eyes",
"value": "Sad Eyes"
},
{
"trait_type": "Face",
"value": "Right Ear Band"
},
{
"trait_type": "Mouth",
"value": "Small Smile"
},
{
"trait_type": "Skin",
"value": "Pink"
}
]
},
{
"blockchain": "eth",
"name": "Happy Bunny #6907",
"tokenId": "6907",
"imageUrl": "https://ipfs.io/ipfs/QmSRkmEDKWUeHi5FiNpQUBAcCq7rKinhf5Pbu8ZPZNkP8r/6907",
"collectionName": "Happy Bunnies",
"symbol": "BUNNY",
"contractType": "ERC721",
"contractAddress": "0x700b4b9f39bb1faf5d0d16a20488f2733550bff4",
"traits": [
{
"trait_type": "Background",
"value": "Light Blue Background"
},
{
"trait_type": "Body",
"value": "Pirate Tanktop"
},
{
"trait_type": "Eyes",
"value": "Small Point Eyes"
},
{
"trait_type": "Face",
"value": "Light Blue Cap"
},
{
"trait_type": "Mouth",
"value": "Annoyed Mouth"
},
{
"trait_type": "Skin",
"value": "Yellow"
}
]
},
{
"blockchain": "eth",
"name": "Moon Boyz #8937",
"tokenId": "8937",
"imageUrl": "https://moon-boyz-api-do.com/metadata/8937",
"collectionName": "The Moon Boyz",
"symbol": "MOONBOYZ",
"contractType": "ERC721",
"contractAddress": "0xd8682bfa6918b0174f287b888e765b9a1b4dc9c3",
"traits": [
{
"trait_type": "Background",
"value": "Graphic Moon"
},
{
"trait_type": "Suits",
"value": "Body Suit Iridescent Purple"
},
{
"trait_type": "Lines",
"value": "Lines Suit Blue"
},
{
"trait_type": "Pocket",
"value": "Pocket Silver"
},
{
"trait_type": "Helmet Close",
"value": "Rare Irdiescent Dark Blue"
},
{
"trait_type": "Ear",
"value": "Lightning Red"
},
{
"trait_type": "Visor",
"value": "Black"
},
{
"trait_type": "Hologram",
"value": "Original Heart"
}
]
}
],
"nextPageToken": "BjxaEQyvWry96Z7VXNrffspsVkXZ8PXkMEc8epttW3Jn8JvEx2mF25WLU2cndjitQE4iDiECmMpVBwfPQ8b9hVabmBXipuN6y3gqzgWUbCCWAR2Lv99dF4QgbcANVeaqs7hGDAo"
}
}ankr_getNFTMetadata
Retrieves the NFT's metadata.
Retrieves the metadata that belongs to a particular NFT (ERC721/ERC1155/ENS/POAP).
Request
Build your request using the parameters below.
Parameters
-
id(int64; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(object): the data object containing request body parameters.blockchain(string; required): one of the supported chains (eth,bsc,fantom,avalanche,polygon,arbitrum,syscoin,optimism,eth_goerli,avalanche_fuji).contractAddress(string): a contract address of the NFT the metadata belongs to; supports the Ethereum Name Service (ENS).tokenId(integer): a token ID of the NFT the metadata belongs to.
{
"id": 1,
"jsonrpc": "2.0",
"method": "ankr_getNFTMetadata",
"params": {
"blockchain": "string",
"contractAddress": "string",
"tokenId": "string"
}
}Content-Type: application/jsonResponse
A successful request returns, along with the general parameters, the result object containing metadata info on the NFT specified by request parameters.
Parameters
-
id(int64; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
result(object): the data object containing the NFT metadata and NFT attributes:-
metadata(object): the data object containing the NFT metadata:blockchain(string; required): one of the supported chains (eth,bsc,fantom,avalanche,polygon,arbitrum,syscoin,optimism,eth_goerli,avalanche_fuji).contractAddress(string): a contract address of the NFT Collection; supports the Ethereum Name Service (ENS).contractType(string): a contract type of the NFT the metadata belongs to (example: ERC721, ERC1155).tokenId(string): a token ID of the NFT the metadata belongs to (example: 7822).
-
attributes: an object containing additional information on the NFT:contractType(string): a contract type of the NFT the metadata belongs to (example: ERC721, ERC1155).tokenUrl(string): a URL that points to the place storing an NFT's metadata (example: https://live---metadata-5covpqijaa-uc.a.run.app/metadata/7822)imageUrl(string): a URL that points to the actual digital file, usually an IPFS link (example: https://live---metadata-5covpqijaa-uc.a.run.app/images/7822)name(string): a name of the token (example: Rock 23240).description(string): a description of the NFT (example: A very angry NFT bird).traits: an array of pre-defined NFT traits:trait_type(string): a specific type of traits (example: Eyes).value(string): a specific value of traits (example: Angry).
-
Code Examples
Request
curl --location --request POST 'https://rpc.ankr.com/multichain' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "ankr_getNFTMetadata",
"params": {
"blockchain": "avalanche",
"contractAddress": "0x8d01c8ee82e581e55c02117a676b5bbd4734fabb",
"tokenId": "23240"
},
"id": 1
}'Response
Code: 200 OK
{
"error": {},
"id": 1,
"jsonrpc": "2.0",
"result": {
"attributes": {
"contractType": 0,
"description": "string",
"imageUrl": "string",
"name": "string",
"tokenUrl": "string",
"traits": [
{
"bunny_id": "string",
"count": 0,
"display_type": "string",
"frequency": "string",
"mp_score": "string",
"rarity": "string",
"trait_type": "string",
"value": "string"
}
]
},
"metadata": {
"blockchain": "string",
"collectionName": "string",
"collectionSymbol": "string",
"contractAddress": "string",
"contractType": 0,
"tokenId": "string"
}
}
}{
"jsonrpc": "2.0",
"id": 1,
"result": {
"metadata": {
"blockchain": "avalanche",
"contractAddress": "0x8d01c8ee82e581e55c02117a676b5bbd4734fabb",
"tokenId": "23240",
"contractType": "ERC721"
},
"attributes": {
"tokenUrl": "https://ipfs.io/ipfs/QmYen4cGUc3gF9UQnCycq2AADYLYzoM6mvVzoajAXTr7vH/rock23240.json",
"imageUrl": "https://ipfs.io/ipfs/QmPktcEDiRD9qNwc497mwQkJ3zYFQtHwFooPLkgDdRqU4R/23240.png",
"name": "Rock 23240",
"description": "Rock #23240, can be used to play Rock Game",
"traits": [
{
"trait_type": "face",
"value": "Brown"
},
{
"trait_type": "nose",
"value": "Regular Nose"
},
{
"trait_type": "mouth",
"value": "Chinstrap"
},
{
"trait_type": "eyes",
"value": "Big Shades"
},
{
"trait_type": "hair",
"value": "Stringy Hair"
},
{
"trait_type": "accessories",
"value": "Earring"
}
],
"contractType": "ERC721"
}
}
}ankr_getNFTHolders
Retrieves the NFT's holders data.
Retrieves a list of holders (wallet addresses) of the NFT specified by request body parameters.
Request
Build your request using the parameters below.
Parameters
-
id(int64; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(object): the data object containing request body parameters.blockchain(string; required): either of the supported blockchains (eth,bsc,fantom,avalanche,polygon,arbitrum,syscoin,optimism,eth_goerli,avalanche_fuji).contractAddress(string): a contract address of the NFT Collection; supports the Ethereum Name Service (ENS).pageSize(integer): a number of results you'd like to get.pageToken(string): a token is provided at the end of the response body and can be referenced in the request to fetch the next page.
{
"id": 1,
"jsonrpc": "2.0",
"method": "ankr_getNFTHolders",
"params": {
"blockchain": "string",
"contractAddress": "string",
"pageSize": 0,
"pageToken": "string"
}
}Content-Type: application/jsonResponse
A successful request returns a list of holders for the NFT specified.
Parameters
id(int64; required): a request ID (example: 1).jsonrpc(string; required): a JSON RPC spec used (example: 2.0).result(object): the data object containing a holder of the NFT specified by request parameters:holder(string): a list of holders.nextPageToken(string): a token is provided at the end of the response body and can be referenced in the request to fetch the next page.
Code Examples
Request
curl --location --request POST 'https://rpc.ankr.com/multichain' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "ankr_getNFTHolders",
"params": {
"blockchain": "arbitrum",
"contractAddress": "0xc36442b4a4522e871399cd717abdd847ab11fe88",
"pageSize": 10,
"pageToken": ""
},
"id": 1
}'Response
Code: 200 OK
{
"error": {},
"id": 1,
"jsonrpc": "2.0",
"result": {
"holders": [
"string"
],
"nextPageToken": "string"
}
}{
"jsonrpc": "2.0",
"id": 1,
"result": {
"holders": [
"0x000000000000000000000000000000000000dEaD",
"0x00000000000a29A0800f6F557ddbbe8249397dE7",
"0x00000000005dbcB0d0513FcDa746382Fe8a53468",
"0x0000000000F485A774ee60343AD3aC6D05d95Fba",
"0x0000000813B34008A225De08a6a61835508C71f9",
"0x00000010cfed5b9e642901Be70FE7f5C8104411e",
"0x0000006D14cE3CF81449c3BA1f26108DF0A4de8b",
"0x00000744009F1240f4218D6Ad4112AD257A28888",
"0x00002B503a75998C97508916A74Fdb41934Fa030",
"0x00005A06017eB8931b7FDAe82Bce8EB6852282b3"
],
"nextPageToken": "CA9QXqcwG5vQJxibSKdvTFikDeCznM8nzB5PCHNdGjaG1cajS9XdDh2nGALCfcyNqTspvpqPPEtVV4s"
}
}ankr_getNftTransfers
Retrieves info on NFT transfers.
Retrieves info on NFT transfers for an address specified.
Request
Build your request using the parameters below.
Parameters
-
id(int64; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(object): the data object containing request body parameters.address(array of strings; required): an address to search for transactions.blockchain(array of strings): either of the supported blockchains (eth,bsc,fantom,avalanche,polygon,arbitrum,syscoin,optimism,eth_goerli,avalanche_fuji).descOrder(boolean): choose data order, either descending (iftrue) or ascending (iffalse).fromBlock(integer): narrow your search indicating the block number to start from (inclusive;>= 0).toBlock(integer): narrow your search indicating the block number to end with (inclusive;>= 0).fromTimestamp(integer): narrow your search indicating the timestamp to start from (inclusive;>= 0).toTimestamp(integer): narrow your search indicating the timestamp to end with (inclusive;>=0).pageSize(integer): a number of result pages you'd like to get.pageToken(string): a token is provided at the end of the response body and can be referenced in the request to fetch the next page.
{
"id": 1,
"jsonrpc": "2.0",
"method": "ankr_getNftTransfers",
"params": {
"address": "string",
"blockchain": ["string"],
"fromTimestamp": 0,
"pageSize": 0,
"toTimestamp": 0
}
}Content-Type: application/jsonResponse
A successful request returns information on transfers for an address specified.
Code Examples
Request
{
"id": 1,
"jsonrpc": "2.0",
"method": "ankr_getNftTransfers",
"params": {
"address": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"blockchain": [
"bsc"
],
"fromTimestamp": 1655197483,
"pageSize": 2,
"toTimestamp": 1671974699
}
}Response
Code: 200 OK
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"transfers": [
{
"blockHeight": 19116577,
"blockchain": "bsc",
"collectionName": "",
"collectionSymbol": "",
"contractAddress": "0x36f8f51f65fe200311f709b797baf4e193dd0b0d",
"fromAddress": "0x186ea56f0a40c5593a697b3e804968b8c5920ff3",
"imageUrl": "",
"name": "",
"timestamp": 1656519782,
"toAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"tokenId": "12",
"transactionHash": "0x95ae64003124fe4c3e8702364136d25c3d0f2fdbbf953bd815785f06d5cb6025",
"type": "ERC1155",
"value": "1"
},
{
"blockHeight": 19357744,
"blockchain": "bsc",
"collectionName": "CheersBio Capsule",
"collectionSymbol": "CBC",
"contractAddress": "0x999017cb5652caf5f324a8e44f813903ba3c46eb",
"fromAddress": "0x0000000000000000000000000000000000000000",
"imageUrl": "https://ipfs.io/ipfs/QmZCS7HtmQZtUPLTR1LaLhCwW5W22c1jCociw7Pvi3Autg",
"name": "RSS3 Chain Friends #36957",
"timestamp": 1657244377,
"toAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"tokenId": "36957",
"transactionHash": "0xac2d856630eb80270a3b75538977832ac6d7c19100f41b804d3c100958bcb3ab",
"type": "ERC721",
"value": "1"
}
]
}
}