Links

nft_accountTokenIDs

Get all NFTs hold by the account address in any contract address without scanning the entire chain.
Through nft_accountTokenIDs, you can fetch all the data of NFTs that an account owns in that collection, contractAddress and accountAddress are necessary. You can clearly know what NFTs a holder owns in that collection. Some use cases could call this API such as accurate airdrop.
Supported on Ethereum, BNB Chain, Optimism, and Arbitrum.

Parameters

Object - An object with the following fields (required):
  • contractAddress(hex string, required) - the contract address of the collection. BlockVision currently support both ERC721 and ERC1155.
  • accountAddress(hex string, required) - the account address you want to query.
  • blockNumber(integer number, optional) - specify the blockNumber for snapshot query (default latest). BlockVision can not only support users to query the current position, but also support users to query the historical information at any time.
  • pageSize(integer number, optional, default 20 max 50) - max number of results to return per call.
  • pageIndex(integer number, optional, default 1) - page index.

Returns

Object - An object with the following fields:
  • id(integer number) - json-rpc id.
  • jsonrpc(string) - json-rpc version.
  • result(object) - an object with the following fields:
    • nextPageIndex(integer number) - next page index.
    • data(array of object, defined below) - response data.
  • Object schema:
    • tokenId(string) - id of the NFT.
    • contractAddress(hex string) - contract address.
    • quantity(string) - token amount.
    • standard(string) - ERC standard for NFT, The enumeration value is erc721, erc1155, or "".

Example

Request

curl
TypeScript
curl https://api.blockvision.org/v1/<api key> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "nft_accountTokenIDs",
"params": {
"accountAddress": "0x5F35265a7681673dd078616C5eFc9bcFb3a4C9dE",
"contractAddress":"0x495f947276749Ce646f68AC8c248420045cb7b5e",
"blockNumber": 0,
"pageSize": 100,
"pageIndex": 1
}
}'
import { BlockVisionProvider, BvNetwork } from 'blockvision.js'
// Optional parameters, but default to eth-mainnet and default api-key.
const bv = new BlockVisionProvider(BvNetwork.ETH_MAINNET)
// Access the BlockVision NFT API
bv.getNFTAccountTokenIDs({
accountAddress: '0x5F35265a7681673dd078616C5eFc9bcFb3a4C9dE',
contractAddress: '0x495f947276749Ce646f68AC8c248420045cb7b5e',
blockNumber: 0
}).then(console.log)

Result

{
"jsonrpc":"2.0",
"id":1,
"result":{
"data":[
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"7292",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"2928",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"7494",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"7568",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"6887",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"7952",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"3565",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"761",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"6514",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"5744",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"2325",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"1334",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"8491",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"5926",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"8636",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"6321",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"4262",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"7532",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"9304",
"quantity":1,
"standard":"erc721"
},
{
"contractAddress":"0xF75140376D246D8B1E5B8a48E3f00772468b3c0c",
"tokenId":"9305",
"quantity":1,
"standard":"erc721"
}
],
"nextPageIndex":2
}
}