(I received a question about this in the Metaplex Discord so I decided to make a StackExchange post on their behalf to answer the question so it is archived into search engines for the future for Solana developers) How do I get all NFTs in a Solana NFT collection? I have the Mint Address of an NFT in the collection and from that would like to get all the other NFTs that exist in that collection.

1 Answer 1


This script will put the results in a file called results.txt in the same folder as the script. First get the Mint Address of the NFT which you can often find in the URL of NFT Marketplaces when looking at the details of an NFT for instance https://coralcube.io/detail/61hPLmqccP6Gx8xQz8ekZh5Wun2FAnwRbzvs5ucxmXHm and the Mint Address is "61hPLmqccP6Gx8xQz8ekZh5Wun2FAnwRbzvs5ucxmXHm". Once you have that put it into a Solana Blockchain explorer like https://solscan.io/ and you will get to this page https://solscan.io/token/61hPLmqccP6Gx8xQz8ekZh5Wun2FAnwRbzvs5ucxmXHm go to the "Metadata" page and scroll down in the Metadata to where it says "creators" and there is an array. Take the address from creator array key [0] which is "6LQgfAN3LQMHKHQFUpMsCCQnPrnMAH46yQvt85vYTUb4", this is also known as the Candy Machine ID generally for Metaplex. Then use the function metaplex.nfts().findAllByCreator() from here https://github.com/metaplex-foundation/js but as of now ensure to use it with an RPC that is capable of processing it. As of now 11/1/22 I know Quicknode works with it but Alchemy has an issue and didn't give results when I tried with it. Here is a code example, in the below code example edit the "rpc" variable to be the URL of your RPC provider and edit the "creator_0_key" address:

// Mystopians root.data.creators[0].address 6LQgfAN3LQMHKHQFUpMsCCQnPrnMAH46yQvt85vYTUb4
// npm install bs58 bip39 ed25519-hd-key @solana/web3.js @metaplex-foundation/js
var rpc = "---edit---";
var creator_0_key = "6LQgfAN3LQMHKHQFUpMsCCQnPrnMAH46yQvt85vYTUb4";

(async function () {

var fs = require('fs');
var url = require('url');
var util = require('util');
var http = require('http');
var https = require('https');
var path = require('path');

var bs58 = require('bs58');
var bip39 = require('bip39');
var ed25519_hd_key = require('ed25519-hd-key');
var solana_web3 = require("@solana/web3.js");
var metaplex_module = require("@metaplex-foundation/js");

var connection = new solana_web3.Connection(rpc, 'confirmed');
var wallet = solana_web3.Keypair.generate();
var metaplex = metaplex_module.Metaplex.make(connection)

function full_inspect_obj(obj) {
    return util.inspect(obj, {
        showHidden: true,
        depth: null,
        colors: false,
        maxArrayLength: null

var rrr = await metaplex.nfts().findAllByCreator({
"creator": new solana_web3.PublicKey(creator_0_key),
"position": 1
fs.writeFileSync(`${__dirname}/results.txt`, full_inspect_obj(rrr));
console.log(`Results written to file ${__dirname}/results.txt`);


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.