[SOLVED] Getting NFT Owners (doesn't get all of them, only 500)

Hey, I’m trying to get all the owners of a certain nft and check if a WalletX owns that nft. Here’s what I’m using to get a list of all the owners.

const ownerData = await Moralis.Web3API.token.getNFTOwners(options);

Issue is that it only returns 500, when there are over >7k unique owners. How do I get the entire list and check if X user owns said NFT?

You need to use the cursor parameter to paginate through the rest of the pages. If you pass in the cursor from the response into the next request, it will fetch the next page of results.

Here is an example of how to use it. Billing & Rate Limits - Moralis

you can also use .next syntax now:
https://docs.moralis.io/moralis-dapp/web3-api#web3-api-pagination-examples-with-.next

Awesome, thank you - this worked!

1 Like

I ran into an error telling me to use cursor instead while trying out the .next syntax so ended up using that - thank you!