Skip to main content
Version: 2.0

How to get NFT collections by creator

Prerequisites​

Before getting started, make sure you have the following ready:

  • Node v.14+ or Python
  • NPM/Yarn or Pip

Step 1: Setup Moralis​

First register your Moralis account and get your Moralis API Key.

Once you have your Moralis API Key, install the Moralis SDK in your project.

npm install moralis

Step 2: Get NFT Collections By Creator​

In order to get NFT collections by creator, Moralis provides you a getNFTCollectionsByCreator endpoint to do so.

Here you'll need two parameters: limit and creatorAddress.

Once you have obtained both the limit and creatorAddress, you can copy the following code:

const Moralis = require("moralis").default;

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

const limit = 10;

const creatorAddresses =
"0x57410cf1141dd18aef4acf956d3c35a9634111642c5ed0ab0d017d634869959b";

const response =
await Moralis.AptosApi.collections.getNFTCollectionsByCreator({
limit,
creatorAddresses,
});

console.log(response.result);
};

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:

[
{
"collection_data_id_hash": "43c343a58c54f0ce20ad9329d799b7e4e3f8dfb2ba76e4fae7a472f1bcf611ec",
"collection_name": "[REDACTED] Keys",
"creator_address": "0x57410cf1141dd18aef4acf956d3c35a9634111642c5ed0ab0d017d634869959b",
"description": "A set of mysterious keys. Is that a flamingo?",
"description_mutable": true,
"last_transaction_timestamp": "2022-12-23T08:25:31.000Z",
"last_transaction_version": "55833002",
"maximum": "7878",
"maximum_mutable": true,
"metadata_uri": "https://nftstorage.link/ipfs/bafybeichamqw2clzmpmfzm4v3dywdiitpl3pvd5wzaoxy6khizmtir3nwy/0.gif",
"supply": "1400",
"table_handle": "0x4190bb038ddb7d014118c6d45e3ac2db9166a1d0b43312750dc78e21139bca24",
"uri_mutable": true
}
]

Congratulations πŸ₯³ You just got NFT collections by creator 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:

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.