Skip to main content

Don't have an API key yet?

Sign-up to Moralis to get your free API key and start building today.

Get Your Free API Key
Version: 2.2

How to get all the NFT collections owned by an address

Step 1: Setup Moralis​

Read the article Setting Up Moralis: Getting Started and make sure to finish all the steps. Only after that you can go ahead to complete this guide.

Step 2: Get All NFTs Collections Owned By An Address​

In order to get all the NFTs owned by an address, Moralis provides you with a getWalletNFTCollections endpoint to do so.

Here you'll need two parameters: address and chain.

Once you've obtained both the address and chain, you can copy the following code:

const Moralis = require("moralis").default;
const { EvmChain } = require("@moralisweb3/common-evm-utils");

const runApp = async () => {
await Moralis.start({
apiKey: "YOUR_API_KEY",
// ...and any other configuration
});

const address = "0x26fcbd3afebbe28d0a8684f790c48368d21665b5";

const chain = EvmChain.ETHEREUM;

const response = await Moralis.EvmApi.nft.getWalletNFTCollections({
address,
chain,
});

console.log(response.toJSON());
};

runApp();

Step 3: Run the script​

To run the script, enter the following command:

node index.js

In your terminal, you should see the following JSON response:

{
"status": "SYNCED",
"page": 1,
"cursor": null,
"page_size": 100,
"result": [
{
"token_address": "0xfbc6f43c1d382da5f4dda34ae542bdd460423be5",
"possible_spam": true,
"contract_type": "ERC1155",
"name": "Toy Booger NFT",
"symbol": "Toy Booger NFT",
"verified_collection": false,
"collection_logo": "https://i.seadn.io/gae/eQ_ObnigEZr8aalXL71GO_3Cs6xGrIiNKRKtbvPS9d-OAIgQeBkqGyjtKZMcu4DuVaknkuk0_E4TtIpjs0UIe3cFBJmHXV5-mitjrw?w=500&auto=format",
"collection_banner_image": "https://i.seadn.io/gae/YjIHBPaMmBU1m-CHjZwcLNGhxhgDoJrSrXZCZi3xvBaGJKM-FQISrKzsWHdFoLifl-IzEWuVZ8uJLelUSE6oOjoxaizyswbI5wmkjFg?w=500&auto=format"
},
{
"token_address": "0xedc79f027bba6cfac31e21dc8b4c2c0b20866e31",
"possible_spam": true,
"contract_type": "ERC1155",
"name": "Bulls on Block",
"symbol": "Bulls on Block",
"verified_collection": false,
"collection_logo": "https://i.seadn.io/gae/WD6FfHhFGcmBlLsXlzFgq4Za8TlC5065GRUJwXjnRgUpkMrLLr8-SMcVgRzUnuxtKZ8mXcwvG_iydceIDJ2_NGxMTil0uWnB8i4IFg?w=500&auto=format",
"collection_banner_image": "https://i.seadn.io/gae/-zlLbVdkSG_IA9p_fJxajDyBA6SyzQ1_Q4lwFkpan_NM51rk7NsEM6Drs6sMaCkZP7QEfVNRYOLl7o-GLQzd4ShDWNZiTf6BHx-m?w=500&auto=format"
},
{
"token_address": "0xe786b5596a792d7beafcf08eaf9de711c7b7b14b",
"possible_spam": true,
"contract_type": "ERC721",
"name": "Gutter Punks - Otherside",
"symbol": "GPO",
"verified_collection": false,
"collection_logo": "https://i.seadn.io/gae/gqgi2DFDHPBBjsshtyPe2cN019JZmML8gBfy1Hg5LhOEckX-BRPLqWfQf_xqGyWB9YtFefq5jh35JIp-YSadq8fN9rlZKS-N6TK8?w=500&auto=format",
"collection_banner_image": null
},
{
"token_address": "0xe7198926b9f9b4ca0c7b2cc0cfb25b36f0dc7e45",
"possible_spam": true,
"contract_type": "ERC1155",
"name": "ZED RUN",
"symbol": "ZED RUN",
"verified_collection": false,
"collection_logo": "https://i.seadn.io/gae/jLDu2mpSekG6RxJI_XgVi4Uhf3NFZ5thkJrNwVXkbL3c7fKwQoxJSGiiolCjIijUPBf8_QtoDMLPla6PyDEo4mcDIysTp1LVp5s3tlU?w=500&auto=format",
"collection_banner_image": "https://i.seadn.io/gae/zSwvUVqzZpMjyOTiAQCtkb9Uw-G3O-j4Iilmb_QfcMSMMS4V9rNUjBs4icxxDzEfk1kMiwijCiT3tDxWBXDs-gI1TFyT6I6KaG20P70?w=500&auto=format"
},
...
}

Congratulations πŸ₯³ you just got all the NFT collections owned by an address with just a few lines of code using the Moralis NFT API!

Youtube Video​

API Reference​

If you want to know more details on the endpoint and optional parameters, check out:

Next Steps​

Learn how to use the Moralis NFT API to build dapps:

Support​

If you face any trouble following the tutorial, feel free to reach out to our community engineers in our Discord or Forum to get 24/7 developer support.