# NFT Information Retrieval

NFT APIs allow you to read NFT metadata and ownership information.  These API's include:

* [getNFT](https://docs.manifold.xyz/manifold-for-developers/resources/widgets/connect-widget/data-client/nft-information-retrieval/getnft)\
  \&#xNAN;*Get NFT metadata (both ERC721 and ERC1155) and current ownership information (for ERC721)*
* [getNFTTsOfOwner](https://docs.manifold.xyz/manifold-for-developers/resources/widgets/connect-widget/data-client/nft-information-retrieval/getnftsofowner)\
  \&#xNAN;*Get NFTs of the current authenticated wallet*
* [ownerHasNFT](https://docs.manifold.xyz/manifold-for-developers/resources/widgets/connect-widget/data-client/nft-information-retrieval/ownerhasnft)\
  \&#xNAN;*Check if the current authenticated wallet owns an NFT*
* [getCollectors](https://docs.manifold.xyz/manifold-for-developers/resources/widgets/connect-widget/data-client/nft-information-retrieval/getcollectors)

  *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'
    },
  ]
})
```

{% content-ref url="nft-information-retrieval/getnft" %}
[getnft](https://docs.manifold.xyz/manifold-for-developers/resources/widgets/connect-widget/data-client/nft-information-retrieval/getnft)
{% endcontent-ref %}

{% content-ref url="nft-information-retrieval/getnftsofowner" %}
[getnftsofowner](https://docs.manifold.xyz/manifold-for-developers/resources/widgets/connect-widget/data-client/nft-information-retrieval/getnftsofowner)
{% endcontent-ref %}

{% content-ref url="nft-information-retrieval/ownerhasnft" %}
[ownerhasnft](https://docs.manifold.xyz/manifold-for-developers/resources/widgets/connect-widget/data-client/nft-information-retrieval/ownerhasnft)
{% endcontent-ref %}

{% content-ref url="nft-information-retrieval/getcollectors" %}
[getcollectors](https://docs.manifold.xyz/manifold-for-developers/resources/widgets/connect-widget/data-client/nft-information-retrieval/getcollectors)
{% endcontent-ref %}
