NFT Information Retrieval
NFT Data APIs
NFT APIs allow you to read NFT metadata and ownership information. These API's include:
getNFT Get NFT metadata (both ERC721 and ERC1155) and current ownership information (for ERC721)
getNFTTsOfOwner Get NFTs of the current authenticated wallet
ownerHasNFT Check if the current authenticated wallet owns an NFT
Get collectors of an NFT
More APIs will be added in the near future.
Supported Networks
Ethereum Mainnet
Optimism
Polygon
Base
Sepolia
Goerli(deprecated)Rinkeby(deprecated)
Filtering Data
Most APIs take in an array of filters and attribute filters, in the following format:
/**
* 1. Filter for specific tokens by passing in a tokenId
* 2. Filter for a set of tokens by passing in an array of tokenIds
* 3. Filter for a range of tokens by passing in the minTokenId and maxTokenId
* 4. Filter for a set of token attributes by passing in an array of TokenAttribute
* You can use either 1, 2 or 3, but not all of them together.
```
*/
interface Filter {
contractAddress: string;
tokenId?: string;
tokenIds?: Array<string>
minTokenId?: string;
maxTokenId?: string;
attributes?: Array<Attribute>;
}
interface Attribute {
traitType?: string;
value: string;
}
Each filter is treated as an 'or' statement.
Example: Get BAYC and MAYC NFTs for the user:
client.getNFTsOfOwner({
filters: [
{
contractAddress: '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d'
},
{
contractAddress: '0x60e4d786628fea6478f785a6d7e704777c86a7c6'
}
]
})
Example: Get Doodles with both 3D Glasses AND a Navy Sweater
client.getNFTsOfOwner({
filters: [
{
contractAddress: '0x8a90cab2b38dba80c64b7734e58ee1db38b8992e',
attributes: [
{
traitType: 'body',
value: 'navy sweater'
},
{
traitType: 'face',
value: '3d glasses'
},
]
},
]
})
Example: Get Doodles with both 3D Glasses OR a Navy Sweater
client.getNFTsOfOwner({
filters: [
{
contractAddress: '0x8a90cab2b38dba80c64b7734e58ee1db38b8992e',
attributes: [
{
traitType: 'face',
value: '3d glasses'
},
]
},
{
contractAddress: '0x8a90cab2b38dba80c64b7734e58ee1db38b8992e',
attributes: [
{
traitType: 'body',
value: 'navy sweater'
}
]
}
]
})
Example: Get Mad Dog Jones Thought as a System
client.getNFTsOfOwner({
filters: [
{
contractAddress: '0x4ac3d17fd6c2db18ec619fe2d68d2c22b18378ff',
minTokenId: '11600030001',
maxTokenId: '11600030050',
},
]
})
Example: Get Collectors of scuderia ferrari by yungwknd// Some code
client.getCollectors({
filters: [
{
contractAddress: '0xefE6A6032fd27B7B7615Fb0D0E08FB3E49Db53b8',
tokenId: '2'
},
]
})
Last updated