Advanced API
NFT API

NFT API

NFT API is an Advanced API's 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 (opens in a new tab) for interaction.

NFT API Methods

NFT API consists of the following methods to request NFT-related data across multiple chains:

Prefer interactive docs? See our OpenAPI specification (opens in a new tab) for NFT API methods.

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: arbitrum, avalanche, base, bsc, eth, fantom, flare, gnosis, linea, optimism, polygon, polygon_zkevm, rollux, scroll, syscoin, avalanche_fuji, polygon_mumbai.
      • Chains combination: [arbitrum, avalanche, base, bsc, eth, fantom, flare, gnosis, linea, optimism, polygon, polygon_zkevm, rollux, scroll, syscoin, avalanche_fuji, polygon_mumbai].
      • All chains: leave the value empty to query all the chains available.
    • 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.
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "ankr_getNFTsByOwner",
  "params": {
    "blockchain": [
      "string"
    ],
    "filter": [
      {
        "additionalProp1": [
          "string"
        ],
        "additionalProp2": [
          "string"
        ],
        "additionalProp3": [
          "string"
        ]
      }
    ],
    "pageSize": 0,
    "pageToken": "string",
    "walletAddress": "string"
  }
}

Response

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 (arbitrum, avalanche, base, bsc, eth, fantom, flare, gnosis, linea, optimism, polygon, polygon_zkevm, rollux, scroll, syscoin, avalanche_fuji, polygon_mumbai).
    • 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"
  }
}

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): either of the supported chains (arbitrum, avalanche, base, bsc, eth, fantom, flare, gnosis, linea, optimism, polygon, polygon_zkevm, rollux, scroll, syscoin, avalanche_fuji, polygon_mumbai).
    • contractAddress (string): an address of the NFT contract the metadata belongs to; supports the Ethereum Name Service (ENS).
    • forceFetch (boolean): source of NFT metadata — true the contract, false the database.
    • skipSyncCheck (boolean): if set to true, the info will be returned regardless of indexer health.
    • tokenId (integer): a token ID of the NFT the metadata belongs to. Created by the contract when minting the NFT.
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "ankr_getNFTMetadata",
    "params": {
    "contractAddress": "0x8d01c8ee82e581e55c02117a676b5bbd4734fabb",
    "forceFetch": true,
    "skipSyncCheck": true,
    "tokenId": "23240",
    "blockchain": "avalanche"
  },
}

Response

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 (arbitrum, avalanche, base, bsc, eth, fantom, flare, gnosis, linea, optimism, polygon, polygon_zkevm, rollux, scroll, syscoin, avalanche_fuji, polygon_mumbai).
      • 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:

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"
    }
  }
}

ankr_getNFTHolders

Retrieves the NFT's holders data.

Retrieves a list of holders (wallet addresses) of the NFT 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.

    • blockchain (string; required): either of the supported blockchains (arbitrum, avalanche, base, bsc, eth, fantom, flare, gnosis, linea, optimism, polygon, polygon_zkevm, rollux, scroll, syscoin, avalanche_fuji, polygon_mumbai).
    • 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 (max: 10000, default: 1000).
    • pageToken (string): a current page token provided at the end of the response body; 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"
  }
}

Response

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"
  }
}

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 (or list of addresses) to search for transactions.
    • blockchain (array of strings): either of the supported blockchains (arbitrum, avalanche, base, bsc, eth, fantom, flare, gnosis, linea, optimism, polygon, polygon_zkevm, rollux, scroll, syscoin, avalanche_fuji, polygon_mumbai).
    • descOrder (boolean): choose data order, either descending (if true) or ascending (if false).
    • 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 (max: 10000, default: 100).
    • pageToken (string): a current page token provided at the end of the response body; 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
    }
}

Response

A successful request returns information on transfers for an address specified.

Code Examples

Request

curl --location --request POST 'https://rpc.ankr.com/multichain' \
--header 'Content-Type: application/json' \
--data-raw '{
    "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"
            }
        ]
    }
}